Linux Dependencies on Programs and Shared Libraries
The operating and its binaries are currently designed to rely on shared libraries, much like dynamically linked libraries (DLLs) in the windows environments. Therefore most binarys, such as init, login, ls, cp, to name a few will likely use some shared library. Loadable modules are loaded into the kernel by the program "/sbin/insmod". Most libraries are in the /lib directory. The libncurses.so.4 library is in /usr/lib. The file "/etc/ld.so.conf" contains a list of directory locations where the system finds its library files. See the man page on ldconfig. The program ld.so is the dynamic linker the programs use to load and run the shared library. Librarys that contain the same major number are compatible with programs that require that major number, but not compatible with programs requiring a different major number. The file /etc/ld.so.conf contains a list of directories that the linker will search to find shared library files. If you add entries to their file, use the "ldconfig" command afterwards to regenerate the shared library cache. The environment variable LD_LIBRARY_PATH can add more directories to this search path. For each library there are generally two separate files. One with a .a or .o extension is the static version, linked in at compile time, and .so.version which is the dynamically linked version. The static files are usually in /usr/lib. When changing dynamic link files use "ln -sf" to change it rather than removing it and replacing it since temporarily removing a library file may stop many functions from working.
- libc - standard c library
- libm - Standard math library
How to determine what library a binary needs
Using the "ldd" command, type "ldd /bin/ls" to see the shared libraries used by the "ls" command. Do the same for any other binary you are interested in. This way if a binary (newly created, down loaded, etc) requires a library you can check your "lib" directory to see if it is there. If it is not, you will need to create and install it.
How to tell if a library is a.out or ELF type
Type "file library.so.x", substituting the name of your library for "library.so.x". If ELF is used the loader library "ld-linux.so" is required, and if a.out is used, "ld.so" is required.