I am trying to understand how/why certain library files are dynamically loaded by the linker on Solaris. I am using ldd to see this (with the -s switch to see what paths are tried by the linker). As an example, if I run "ldd /usr/local/bin/isql -s" I notice that one of the libraries that is searched for is called "libodbc.so.1". I notice that this does NOT match a file it finds along the way called "libodbc.so". So, it finally resolves to a place where there is a symbolic link between "libodbc.so.1.0.0" and "libodbc.so.1". My question is - what is the significance of the ".1" here? Is it to indicate a version number? Why do some installers create these symbolic links, while others don't?
This question is not specific to Solaris.
When you install a shared library (or a piece of software that provides a shared library), you get three files, they all look similar but have different purposes.
This setup allows you to have multiple versions of the same library installed alongside each other. Different binaries may require different versions of the library, and each binary will find the right version of the library. Usually, the SONAME of the library is changed by the upstream when there is a backward-incompatible API change. All the old binaries still use the old API, while newly linked binaries use the new one.
Some packaging projects, Debian would be one example, use different package names for different versions of a library. This allows you to install and uninstall each version of the shared library independently.
There are some edge cases. For example, dependencies between shared libraries can lead to two versions being pulled in at the same time. Consider:
Imagine that we install a new version of libbaz and recompile foo. Now we have:
At runtime, foo will load
Yes, the ".1" indicates the version number. This makes it possible to have multiple versions of the same library side-by-side, whereas the most common version has a link with no version number.
If there is no need to distinguish between different versions, the version suffix might not be present.