Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Below is a situation description concerning dynamic linking. Please read carefully. NOTES:
1) Everything preceded by a '$' is run on the CLI.
2) Assume a generic gnu/linux system.
Code:
$ldd TEST1
linux-vdso.so.1 (0x00007fffb1ffe000)
libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007f6e05a85000)
libz.so.1 => /lib64/libz.so.1 (0x00007f6e0586f000)
librpmbuild.so.2 => not found
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f6e05567000)
libm.so.6 => /lib64/libm.so.6 (0x00007f6e05264000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f6e0504d000)
libc.so.6 => /lib64/libc.so.6 (0x00007f6e04c9e000)
librpm.so.2 => not found
librpmio.so.2 => not found
libdl.so.2 => /lib64/libdl.so.2 (0x00007f6e04a9a000)
liblzma.so.5 => /usr/lib64/liblzma.so.5 (0x00007f6e04874000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6e05df0000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6e04656000)
As you can see the library files "librpm.so.2", "librpmio.so.2" and "librpmbuild.so.2" are reported as missing.
However, running "ls -l /usr/lib64 | grep rpm" shows the following files
Code:
$ ls -l ls -l /usr/lib64 | grep rpm
-rwxr-xr-x 1 root root 152952 Dec 19 16:14 librpmbuild.so.3.2.0
-rwxr-xr-x 1 root root 321624 Dec 19 16:14 librpmio.so.3.2.0
-rwxr-xr-x 1 root root 1916184 Dec 19 16:14 librpm.so.3.2.0
** OUTPUT TRUNCATED **
Needless to say it's known that creating symlinks such as "ln -s librpm.so.3.2.0 librpm.so.2" could solve the problem.
QUESTION 1: What determines the library name suffix (i.e ".so.2", ".so.3.2.", ".so.0", ".so.1" .....etc) that is hardcoded into the ELF binary?
QUESTION 2: How can the hardcoded library name suffix be changed?
QUESTION 3: Related to Q2. How can a system be configured to link all binaries to something like "librpm.so" rather than to "librpm.so.0" or "librpm.so.2" ..etc ?
QUESTION 4: What is the purpose of these suffixes, considering that they aren't related to the version number of the originating package or application?
Answer 1: The version of the shared library against which the program was compiled.
Answer 2: It wouldn't make sense to change it as that would feed the linker with a wrong information
Answer 3: Usually files with short names are symlinks. For instance here (Slackware 14.0)
But how can this be? From the data provided above we can see that the supposed library version is "3.0.0". In reality however, rpm has a version number of 4.xx clearly not 3.0.0. In addition the library file "librpmsign.so" has a suffix number of 1.0.0. Again that doesn't seem to coincide with the rpm version number.
From the data provided above we can see that the supposed library version is "3.0.0". In reality however, rpm has a version number of 4.xx clearly not 3.0.0. In addition the library file "librpmsign.so" has a suffix number of 1.0.0. Again that doesn't seem to coincide with the rpm version number.
Well, in case of Slackware 14.0 at least, the package rpm-4.10.0 that ships these libraries contains a lot of files, libraries, binaries, documentation, translation files, etc. Its version number is *not* related to those of these libraries, which are in fact a very small part of the package. In this case, 4.10.0 is just the version of the source tarball, provided by http://rpm.org/ from which the package is built. And a package can contain several libraries just bundled together, but independent from each other thus not having the same version number.
PS To add to the possible confusion there can be two levels of packaging:
Packaging by upstream, in other words the provider of the source files.
Packaging by the maintainer(s) of the distribution.
This explains why packages can have the same name but not at all the same content in two different distributions. For instance some distributions ship separately the "devel" files, but Slackware usually puts all the files of a given application in the same package. This is also one of the reasons for which it's not recommended to install a package intended for another distribution.
Last edited by Didier Spaier; 04-13-2014 at 04:12 PM.
So If I understand you correctly, the library suffix "3.2.0" or "3.0.0" refers to the version number of a single library subsystem, Potentially one out of many. "1.0.0" or "1.2.0" would refer to the version number of the rpmsign subsystem.
Question 5: If this is the case, then what's the point of creating symlinks to them without the library version number?
Doesn't this create confusion since binaries would link against the symlinks and therefore ending up linking to a library with either a higher or lower version number?
Question 6: And what's the point of creating multiple symlinks to the same library file such as "libxx.so.6" and "libxx.so" linking to libxx.so.6.2.9 ?
As you can see in this batch of data:
this hypothetical binary is linked to "librpmbuild.so.3" (among others), but it's full subsystem version number is 3.2.0 (at least on my system). Now if the library version number is important then why link to a symlink with a truncated library version number? That doesn't make sense, does it?
Answer 5 & 6. Not 100% sure about that, but requirements of the linker regarding some shared libraries version can be more or less picky (or relaxed). Some can require a specific version number, other any version beginning with some digit, or even accept any version. So they could look for instance for version 3.2.1 or for a version greater than 3.2.0 or any version whose number begins with 3, or even any version.
Having several symlinks at different levels is a mean to tell the linker what's available, I think.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.