Role <br /> to view the shared libraries necessary to run the program, the program used to solve the lack of a library can not run some of the problems.
ldd command theory
1, the first ldd not an executable program, but just a shell script
2, ldd will show the executable module dependency, the principle is by setting a series of environmental variables, as follows:
LD_TRACE_LOADED_OBJECTS, LD_WARN, LD_BIND_NOW, LD_LIBRARY_VERSION, LD_VERBOSE so.
When LD_TRACE_LOADED_OBJECTS environment variable is not empty, all executable code at run time, he will only display module dependency, but does not really implement the program. Or you can test in the shell terminal, as follows:
a, export LD_TRACE_LOADED_OBJECTS = 1
b, then the implementation of all programs, such as ls and so on, to see the program running results
3, ldd shows the work of the executable module dependency theory, the essence of this is ld-linux.so (elf dynamic library loader) to achieve. We know, ld-linux.so module will first work on the executable program modules, and access control, so when those mentioned above when the environment variable is set, ld-linux.so chosen display executable module dependency.
4, in fact, a direct implementation of the ld-linux.so modules, such as: / lib/ld-linux.so.2 - list program (which is equivalent to ldd program)
ldd command to use
(From ldd - help)
Name ldd - print shared library dependencies
Outline ldd [option] ... file ...
Description ldd output specified on the command line program or shared library needed for each shared library.
Print the version number of ldd
-V - verbose
Print all information, including, for example symbol version information
-D - data-relocs
Implementation of the symbolic re-deployment, and report missing target object (only ELF format applicable)
-R - function-relocs
Implementation on the target object and function of re-deployment, and report the lack of objective targets and function (ELF format only applicable)
- Help usage information
The standard version of ldd and glibc2 provided with. Libc5 and old versions of previously provided, in some systems there. In libc5 version does not support long options. On the other hand, glibc2 version does not support the-V option, only the equivalent - version option.
If the command line in a given library name contains '/', the libc5 version of this program will use his name as a library; otherwise he will search for libraries in the standard position. Run a current directory of shared libraries, add prefix "./"。
ldd does not work in the a.out format shared library.
ldd can not work in some very old a.out programs, these programs support the ldd issue before the compiler to create. If this type of program you use ldd, program will try to argc = 0 operating mode, and the results unpredictable