HP-UX HB v13.00 Ch-11 - Software Development

HP-UX Handbook Rev 13.00 Page 53 (of 101)
Chapter 11 Software Development
October 29, 2013
SHLIB_PATH enabled second
embedded path disabled first Not Defined
shared library list:
dynamic /mylib/libmine.sl
dynamic /usr/lib/libc.2
:
The embedded path list can only be defined at link time with the +b linker option, and is stored in
the executable. The default path is where the library was found at link time. The linker stores it
automatically in the executable.
On IA64, dld.so always uses the search path /usr/lib/hpux[32|64], if libraries could not be
found elsewhere, even if this path is not stored in the executable. The default path is no longer
stored separately. It became part of the embedded path list instead:
$ chatr a.out
a.out:
32-bit ELF executable
shared library dynamic path search:
LD_LIBRARY_PATH enabled first
SHLIB_PATH enabled second
embedded path enabled third
/tmp/mario:/usr/lib/hpux32:/opt/langtools/lib/hpux32
shared library list:
libmine.so
libc.so.1
:
Using SHLIB_PATH or LD_LIBRARY_PATH can be useful if a required library is located in a path
not stored in the executable, or if you want to make an executable use a special version of a
library. Put the desired library into a certain directory, put this path into SHLIB_PATH, and make
sure SHLIB_PATH is enabled in the executable.
chatr(1) belongs to the linker tools.
ldd(1)
While chatr(1) lists only the directly referenced libraries, ldd(1) displays all libraries that are
loaded at program start, including the ones that are referenced by other loaded libraries. The
ldd(1) output displays the order and path how the libraries would be loaded if the program was
executed.
ldd(1) can be used to check if an SHLIB_PATH setting works. If SHLIB_PATH is enabled for
a.out and is set to /tmp, where we put a special version of libc, the output would be: