Reputation: 13369
Usually shared libs have two symbolic links:
libexample.so -> libexample.so.1
libexample.so.1 -> libexample.so.1.1
I link to my program a shared lib which also has two symbolic links:
libassimp.so -> libassimp.so.3
libassimp.so.3 -> libassimp.so.3.1.1
When I run ldd myprogram
I get:
libassimp.so.3 => /home/user/libs/assimp-3.1.1/lib/libassimp.so.3
(0x00007f34ab0bd000)'
What does it mean ? Why ldd shows second symbolic link ? When I run grep assimp /proc/myprogrampid/maps
I get path to the libassimp.so.3.1.1
which indicates that the library was loaded, but I don't understand form of the ldd output.
Upvotes: 3
Views: 2600
Reputation: 3244
Refer Michael's answer on https://unix.stackexchange.com/questions/475/how-do-so-shared-object-numbers-work
Binaries themselves know which version of a shared library they depend on, and request it specifically. The reason for the symbolic link is for the linker. When you want to link against libpthread.so directly, you give gcc the flag -lpthread, and it adds on the lib prefix and .so suffix automatically. You can't tell it to add on the .so.0 suffix, so the symbolic link points to the newest version of the lib to faciliate that
Upvotes: 1