type
status
date
slug
summary
tags
category
icon
password
TL;DR: 1).
Real Name and SONAME
Real Name:
lib[name].so.[main].[minor].[release]
, e.g., libcudart.so.11.8.89
SONAME: lib[name].so.[main]
, e.g. libcudart.so.11.0
In short, Real Name is the file name, SONMAE is a “logical name” used by dynamic linker to search for libraries.
Every shared library has a special name called the SONAME. For example, in CUDA toolkit-11.8, libcudart.so.11.8.89 has SONAME
libcudart.so.11.0
while libcublas.so.11.11.3.6 having libcublas.so.11
Dynamic linker uses SONAME instead of file name when loading libraries. It is designed for the purpose of library version control. Libraries with the same SONAME should have unchanged interface (imagine Python3.10.*). (as a special exception, the lowest-level C libraries don't start with lib). A fully-qualified SONAME includes as a prefix the directory it's in; on a working system a fully-qualified SONAME is simply a symbolic link to the shared library's real name.
dynamic linker GNU ld.so
At runtime
- Directories specified in DT_RPATH if present DT_RUNPATH does not exist (deprecated)
- path specified in LD_LIBRARY_PATH unless in secure-execution mode
- Directories specified in -rpath (DT_RUNPATH)
- Directories specified in /etc/ld.so.conf
- Default path /lib or /lib64
- /usr/lib or /usr/lib64
This answer provides a excellent explanation
ldconfig
ldconfig
generates a cache file /etc/ld.so.cache
for dynamic linker run-time bindings. of the directories specified in the library path /lib
and /usr/lib
, /etc/ld.so.conf
, and in the trusted directories.ldconfig
and generate a cache file /etc/ld.so.cache
to make the setting in /etc/ld.conf.d
active- Search
/usr/lib
,/lib
and/etc/ld.so.conf
lib