[lug] runtime link directory specification

D. Stimits stimits at idcomm.com
Tue Sep 4 15:13:09 MDT 2001


On SunOS I'm able to specify a search for a library to link with (e.g.,
libSomething.so.1, via -lSomething) such that it can find the lib in a
non-linker-search location...appending to the path that the linker
normally searches for at run time, rather than being part of the system.
All I need to do is use something like "-R/home/myself/lib", and then I
can use /home/myself/lib/libSomething.so.1 from this program even
without ld having that directory in its path. E.G., -lSomething will not
cause an error during compile.

I can't seem to achieve this with the linux linker options for rpath.
(The -R of SunOS has instead --rpath on RH 7.1 it seems). My goal is to
have a program directory "bin" with a subdirectory "lib", and specify
that at runtime it search in "./lib", such that dlopen is not needed,
and the lib can be linked against with a simple -lSomething. All of my
rpath experiments are failing, it appears that I must put my lib in a
system search path and run ldconfig, or else it dies at compile time.
Does anyone have a suggestion on forcing compile to complete and looking
for the required library only at runtime via the appended rpath
location?

D. Stimits, stimits at idcomm.com



More information about the LUG mailing list