> Concider the case of the simple bash interpreter.
> A ldd on bash binary show the use of the following libs :
> # ldd bin/bash        libreadline.so.5 => not found       
> libhistory.so.5 => not found        libncursesw.so.5 =>
> /usr/lib/libncursesw.so.5 (0x00d1f000)        libdl.so.2 =>
> /lib/libdl.so.2 (0x00cf4000)        libc.so.6 => /lib/tls/libc.so.6
> (0x00bc9000)        /lib/ld-linux.so.2 (0x00bb0000)
>
> Take the exemple of libncurses
>
> # ll ./lib/libncursesw.so.5lrwxrwxrwx  1 root root 18 Jul  9 15:12
> ./lib/libncursesw.so.5 -> libncursesw.so.5.5
>
> We see that libncursesw.so.5 is a link to libncursesw.so.5.5 !
>

I can give you a bit of insight into libncursesw.so.5. What you see is 
perfectly normal. The creation of this "link" is fundamental to shared 
objects in linux.

libncursesw.so.5.5 is the name of the lib with the version and release 
appended. libncursesw.so.5 is called the "soname". This is the name 
that should be used to link applications to a specific release of a 
shared object. Since a new release of a shared object does not change 
the abi, applications that use the shared object will not break when 
compiled with a new version (could also see objects with 
version.minor.release numbering).

The two main reasons for doing it this way is, first, to allow multiple 
versions of a shared object to exist on the same system and, second, to 
enhance maintainability (I'm sure there are other reasons). 

Imagine a lib that had a bug. A minor change was made to the lib so the 
release number was increased. If all applications that use this lib 
linked to the actual name of the lib instead of the soname, then all of 
these applications would need to be updated. Ouch.

If you do this...
readelf -d /lib/libncursesw.so.5.5
you will see a "tag" with the name "soname".

How is the "soname" created. Well, the object's developer must plan for 
this and add the following ld switch to the link:
-soname=libncursesw.so.5

When the object is installed and a ldconfig is performed, ldconfig looks 
for the "soname" tag and, if it is found, creates a link with the value 
of the soname to the actual lib.

That said, not all people follow this convention and you will find 
shared objects that do not contain the "soname" tag.

I hope that helps a bit. :)

Shawn
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to