As part of my job as a systems administrator, I occassionally need to develop scripts to start applications at system bootstrap. Periodically while developing these scripts I will encounter an application that relies on libraries in obscure locations. To allow my scripts to work with these applications, I typically need to set LD_LIBRARY_PATH so the runtime linker can locate the libraries needed to make the application work ( I say typically since setrpath can be used on occassion ). Since the Solaris linker searches for libraries in the following order:
It is usually unnecessary to explicitly add /lib and /usr/lib to the search path. To see this first hand, the ldd utility can be invoked with the “-s” (display search path) option and an executable to process:
ldd -s slapd
find object=libdb-4.3.so; required by /usr/local/openldap-2.2.26/libexec/slapd search path=/lib:/usr/lib (default) trying path=/lib/libdb-4.3.so trying path=/usr/lib/libdb-4.3.so libdb-4.3.so => (file not found) find object=libsasl.so.1; required by /usr/local/openldap-2.2.26/libexec/slapd search path=/lib:/usr/lib (default) trying path=/lib/libsasl.so.1 trying path=/usr/lib/libsasl.so.1 libsasl.so.1 => /usr/lib/libsasl.so.1 [ ..... ]
Each stanza contains the name of a library that the executable requires, along with the directories that are searched to locate the library. This is some useful stuff!