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

HP-UX Handbook Rev 13.00 Page 74 (of 101)
Chapter 11 Software Development
October 29, 2013
this product is not installed. Other paths might have been available only on the system where
your program has been developed.
If the library exists in a different path than the ones searched, point the environment variables
SHLIB_PATH or LD_LIBRARY_PATH to it.
In any case of uncertainty, ask the vendor of the program from where to get the library and in
which path to store it.
Symbol Resolution Problems
/usr/lib/dld.sl: Unresolved symbol: x (code) from ./libmylib.sl
Abort(coredump)
The message says that there was a reference to a function named x()in libmylib.sl, but neither
the executable nor one of the shared libraries contain it.
Usually there are two reasons for such a problem. Either this is a versioning problem where at
runtime different versions of the shared libraries are used than at build time. In general, the first
approach to resolve this problem is to get the latest versions of all used shared libraries. Or if this
is a third party program, ask the vendor if it requires certain versions of the libraries, and install
them.
This problem could also be caused by a link time problem. Normally, the linker checks if there
are unsatisfied symbols, but only for executables, not for shared libraries. If a shared library
references symbols from another library, but it is not linked against this library, the linker will
not complain. When linking an executable against this library, but not against the dependent
library, the linker again does not check for unresolved symbols in shared libraries and does not
realize that there's something missing.
Such unsatisfied shared library symbols can be made visible at link time by applying the linker
option +vshlibunsats when linking the executable. This makes ld also check for unsatisfied
symbols from shared libraries, and report them:
/usr/ccs/bin/ld: Unsatisfied shared library symbols:
x (first referenced in ./libmylib.sl) (code)
The developer then can check which library is missing.
This problem can be worked around at runtime, but this should never be considered as a final
solution. You must find the shared library that contains the missing symbol with nm(1), and put
the path to the library into LD_PRELOAD before starting the program.
The only clean solution in case of a missing library is to add it at link time.