Difference between libasan packes (libasan0, libasan2, libasan3, etc)

There are many similar named packages for libasan (the address sanitizer for gcc and clang):

$ apt-cache search libasan | grep -v dbg | grep -v cross
libasan2 - AddressSanitizer -- a fast memory error detector
libasan3 - AddressSanitizer -- a fast memory error detector
libasan4 - AddressSanitizer -- a fast memory error detector
libasan0 - AddressSanitizer -- a fast memory error detector

(Output is from Ubuntu 17.10. Ubuntu 18.04 also has libasan5.)

  • What is the difference between these packages?
  • Which one should I install?

Solution 1:

What is the difference between these packages?

The different packages are for different versions of gcc:

  • libasan0: gcc-4.8
  • libasan2: gcc-5
  • libasan3: gcc-6
  • libasan4: gcc-7
  • libasan5: gcc-8

To find out that information, you can look at the packages details: apt-cache show libsan0

Which one should I install?

The version that matches the gcc version that you used to compile the program.