Kbase P76531: How does HPUX locate and load shared libraries?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/14/2004 |
|
Status: Unverified
GOAL:
How does HPUX locate and load shared libraries?
GOAL:
How does HPUX locate and load runtime libraries?
GOAL:
What tools can be used to trouble shoot shared library problems?
FACT(s) (Environment):
HP-UX
FACT(s) (Environment):
HP-UX 11.0
FACT(s) (Environment):
HP-UX 11i
FIX:
chatr is a utility on HPUX that can help with identifying and modifying shared library problems.
Running chatr against an executable or a library will identify runtime dependencies and also can alter the dependency.
For example,
64-bit ELF shared library
shared library dynamic path search:
LD_LIBRARY_PATH enabled first
SHLIB_PATH enabled second
embedded path enabled third /gateways/hpux1164/oracle/client/9.0.1/lib
internal name:
libclntsh.sl.9.0
shared library list:
libwtc9.sl
librt.2
libnss_dns.1
libdl.1
libm.2
libc.2
libcl.2
The output given above shows:
i. this is a 64 bit executable
ii. LD_LIBRRAY_PATH and SHLIB_PATH will be searched
iii. the embedded path is searched if a shared lib is not in LD_LIBRARY_PATH or SHLIB_PATH
iv. the list of shared libraries to be loaded at runtime is given
If an executable does not have setuid bit set, the search for shared libraries is in following order
1. LD_LIBRARY_PATH
2. SHLIB_PATH
3. Embedded PATH
If a executable has the setuid bit set, as in the case of most progress executables, then SHLIB_PATH and LD_LIBRARY_PATH are ignored (unless the userid and groupid of the user executing the command matches that of the executable). In this case, the embedded path is always used to find the shared libraries. If the embedded path is incorrect, then errors will occur.
Another example,
chatr $ORACLE_HOME/lib/libclntsh.sl
/gateways/hpux/oracle/client/8.1.7/lib/libclntsh.sl:
shared library
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first Not Defined
internal name:
libclntsh.sl.8.0
shared library list:
dynamic /gateways/hpux/oracle/client/8.1.7/JRE/lib/PA_RISC
ative_threads/libjava.sl
dynamic /gateways/hpux/oracle/client/8.1.7/lib/libwtc8.sl
dynamic /usr/lib/librt.2
dynamic /usr/lib/libpthread.1
dynamic /usr/lib/libnss_dns.1
dynamic /usr/lib/libdld.2
dynamic /usr/lib/libm.2
dynamic /usr/lib/libc.2
dynamic /usr/lib/libcl.2
line 1 shows the name of the executable
line 2 is similar to the output of 'file <exe name>'
lines 3-5 show
a. usage of the environment variable SHLIB_PATH is disabled
b. an embedded search path was not given at link time
line 6 onwards gives a list of shared libraries that will be loaded at runtime Note that full path names are given.
Since full path names are given for libraries, these will be searched first. If a library is not present in that location, then SHLIB_PATH will not searched, as it is disabled. The embedded path will not be searched as it is disabled.
To enable shared library path search, use chatr +s enable
chatr +s enable $ORACLE_HOME/lib/libclntsh.sl
/gateways/hpux/oracle/client/8.1.7/lib/libclntsh.sl:
current values:
shared library
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first Not Defined
internal name:
libclntsh.sl.8.0
shared library list:
dynamic /gateways/hpux/oracle/client/8.1.7/JRE/lib/PA_RISC
ative_threads/libjava.sl
dynamic /gateways/hpux/oracle/client/8.1.7/lib/libwtc8.sl
dynamic /usr/lib/librt.2
dynamic /usr/lib/libpthread.1
dynamic /usr/lib/libnss_dns.1
dynamic /usr/lib/libdld.2
dynamic /usr/lib/libm.2
dynamic /usr/lib/libc.2
dynamic /usr/lib/libcl.2
shared vtable support disabled
static branch prediction disabled
executable from stack: D (defa.ult)
kernel assisted branch prediction enabled
lazy swap allocation disabled
text segment locking disabled
data segment locking disabled
third quadrant private data space disabled
fourth quadrant private data space disabled
third quadrant global data space disabled
data page size: D (default)
instruction page size: D (default)
nulptr references enabled
new values:
shared library
shared library dynamic path search:
SHLIB_PATH enabled second
embedded path disabled first Not Defined
internal name:
libclntsh.sl.8.0
shared library list:
dynamic /gateways/hpux/oracle/client/8.1.7/JRE/lib/PA_RISC
ative_threads/libjava.sl
dynamic /gateways/hpux/oracle/client/8.1.7/lib/libwtc8.sl
dynamic /usr/lib/librt.2
dynamic /usr/lib/libpthread.1
dynamic /usr/lib/libnss_dns.1
dynamic /usr/lib/libdld.2
dynamic /usr/lib/libm.2
dynamic /usr/lib/libc.2
dynamic /usr/lib/libcl.2
shared vtable support disabled
static branch prediction disabled
executable from stack: D (default)
kernel assisted branch prediction enabled
lazy swap allocation disabled
text segment locking disabled
data segment locking disabled
third quadrant private data space disabled
fourth quadrant private data space disabled
third quadrant global data space disabled
data page size: D (default)
instruction page size: D (default)
nulptr references enabled.