Why does libc have two version numbers (on Ubuntu)?

前端 未结 1 1053
谎友^
谎友^ 2021-01-21 21:53

If I run this in Docker\'s ubuntu:latest:

root@4304dfbfa661:/# ls lib/x86_64-linux-gnu/libc* -l
-rwxr-xr-x 1 root root 1868984 Jan 15 02:51 lib/x86_         


        
1条回答
  •  礼貌的吻别
    2021-01-21 22:24

    What confuses me is the existence of two numbering schemes.

    Before the invention of GNU symbol versioning, any change to the ABI required that an entirely new version of the library was introduced, and two (or more) copies had to be present on the system.

    External library versioning is described e.g. here.

    With the introduction of per-symbol versioning (GNU symbol versioning), external library versioning became completely unnecessary: multiple ABIs could be supported in a single library.

    This is why libc.so.6 stayed at version 6 since forever (late 1990s). There is no reason to have a symlink at all -- the library could simply be named libc.so.6. However, it is convenient to have the symlink and have it point to current library version, e.g. libc-2.27.so.

    The libstdc++.so is also stuck at libstdc++.so.6, but it is different: maintaining multiple C++ ABIs is much more difficult. So the library keeps incrementing minor version with each GCC version (newer GCC requires newer versions of libstdc++.so).

    But they don't change the .so.6 part because doing so would require having multiple libstdc++.so copies (which will share 99% of the code).

    0 讨论(0)
提交回复
热议问题