28

When exploring the C++ binary, I find that libstdc++.so.6 is dyn-linked into libm.so.6 and libc.so.6:

$ ldd /lib/x86_64-linux-gnu/libstdc++.so.6 
        linux-vdso.so.1 (0x00007ffcb737b000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd3b2295000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd3b1c00000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fd3b2396000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd3b2275000)

My questions are:

  1. What does 6 mean in the name? I originally thought it was the version of glibc, but the version is 2.35, which is not relevant to 6.

    $ strings /lib/x86_64-linux-gnu/libc.so.6  | grep GLIBC_2.3
    GLIBC_2.3
    ...
    GLIBC_2.35
    
  2. Why is the suffix 6 so popular?

  3. Is there a schedule of when libc.so.7 will be released?

5

2 Answers 2

36

The 6 suffix is used for historical reasons, detailed in man libc on Linux. Essentially, a fork of the GNU C library was used on Linux; this released major versions 2 through 5. Version 5 used ELF and was published with a shared library soname of libc.so.5. When version 2 of the GNU C library was released on Linux, it used the shared library soname libc.so.6 to avoid confusion with earlier libraries.

Related libraries use the same suffix. Some architectures use a slightly different suffix; for example, the GNU C library on Alpha and Itanium is libc.so.6.1.

The GNU C library has a strong history of backward compatibility and uses many different mechanisms to support introducing significant changes without breaking old binaries (including versioned symbols). A new soname (libc.so.7) would only be used if a breaking change that couldn’t be mitigated was absolutely required, so it’s unlikely we’ll see one any time soon.

4
  • Does Itanium also have the symlink libc.so.6 -> libc.so.6.1?
    – OrangeDog
    Apr 20 at 9:40
  • @OrangeDog no, the soname is libc.so.6.1, and binaries reference that directly. There is no libc.so.6 symlink. Apr 20 at 12:24
  • Back in the day, glibc distro packages had 6 in the package name, so you could have libc5 and libc6 installed at once when not all binary packages had been rebuilt for the new libc ABI version yet. (I was using Debian at the time; I started in about 1997, right around the switchover from libc5 to libc6, and when the a.out executable format was still a semi-recent memory.) Apr 21 at 4:59
  • 1
    @PeterCordes they still do — on Debian and derivatives at least, that’s a consequence of the requirement that library package names reflect their libraries’ sonames. (And yes, that requirement is there exactly for the reason you give, so that libraries with different sonames can be installed in parallel.) Apr 22 at 13:34
14

It is the ABI (Application Binary Interface) version.

It is only incremented when a breaking change is made, which is now strongly avoided for libc, hence most distributions having been on libc.so.6 for some time.

In general, it allows for multiple incompatible versions of a library to exist on a system at the same time, supporting different applications that were built for the different versions.

For example, Ubuntu 18.04 provided libcurl.so.3 (via package libcurl3) and libcurl.so.4 (via package libcurl4), both built from cURL version 7.58.0.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .