next up previous
Next: Environmental awareness Up: Analyzing dependencies Previous: Analyzing dependencies

How sowhat works

Sowhat is currently written to analyze a Solaris 2.x environment. In this environment, the dynamic linker ld.so utilizes hard-coded library paths encoded into the executable program, as well as search requests that tell ld.so to scan a library path for a library matching a given name pattern and version. This scan checks all directories listed in the environment variable LD_LIBRARY_PATH. The function of ld.so is mimiced by the diagnostic program ldd, which reports the full pathnames of libraries that will satisfy each search request when ld.so is invoked prior to program execution.

To function properly, sowhat has to intimately understand the possible responses of the ldd command. The command ldd lists dynamic dependencies of executable files or shared objects. For example, for the executable file /local/bin/g++, ldd lists the path names of all shared objects that will be loaded whenever /local/bin/g++ is loaded, e.g.:

 
libc.so.1 =>  /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
These records are relative; g++ asks for the first version of the library in the current library path matching the pattern libdl.so.1. This matches /usr/lib/libdl.so.1.

The output of ldd can look quite different for vendor-supplied software. Consider the output of ldd for the tnshut command supplied with Sun's TotalNet software:

libdl.so.1 =>    /usr/lib/libdl.so.1
libsocket.so.1 =>/usr/lib/libsocket.so.1
libnsl.so.1 =>   /usr/lib/libnsl.so.1
libintl.so.1 =>  /usr/lib/libintl.so.1
libc.so.1 =>     /usr/lib/libc.so.1
libmp.so.2 =>    /usr/lib/libmp.so.2
/usr/platform/SUNW,Ultra-250/lib/libc_psr.so.1
The last library has an absolute binding. It must exist in exactly that place in the filesystem or the program will not function. In this case there is a good reason for the absolute binding as the existence of the library in question is dependent upon the sub-architecture of the particular machine. If it is not present, the system in question has the wrong architecture to run the software!

In order to find failures, sowhat must also understand the meaning of the various and sundry error messages provided by ldd. These include:

1.
No match to library pattern:
 
libucb.so.1 => (file not found)
2.
Correct version not found:
libm.so.1 (SUNW_1.1) => (version not found)
In both cases, sowhat will record the actual library name as NotHere. If you then ask sowhat to list the programs that use the library NotHere, it will list all programs that cannot run due to missing libraries.


next up previous
Next: Environmental awareness Up: Analyzing dependencies Previous: Analyzing dependencies
Alva L. Couch
2001-11-05