Many Linux programs use dynamic shared libraries (.so=shared object), similar to Windows DLLs. The list of directories that Linux searches for shared libraries is defined in /etc/ld.so.conf. At run time, Linux uses a cache of available libraries (updated during boot from /etc/ld.so.conf) to determine what to load from where when a call is made to a shared library. The cache file is /etc/ld.so.cache.
Adding or updating libraries
After a change to /etc/ld.so.conf or after new libraries are installed, update the library cache file (as root):
ldconfig
To determine which libraries are used by a program or another library:
ldd [program-name | library-name]
Stack tracing
To see all system calls made by a program, calls to libraries, and signals received, use:
strace program-name
note: see also ltrace
Static linking with gcc
To statically link libraries with a program while compiling, pass the -static flag to gcc:
gcc [other options] -static
If compiling from a Makefile, set the linker options in the LDFLAGS variable:
LDFLAGS = -static