Glenn MacGregor wrote:

>       I am writing a program that uses some shared objects that I have
> written.  One shared object I have depends on another shared object
> which should work fine.  On the link line to create this .so I give ld
> -shared, -rpath and -rpath-link.  So in debugging the program I found
> that the dlopen of this .so fails so I step into the dlopen code and bug
> until I found the problem.  This will be easier if I give an example, so
> here goes:
>       test.so is made.
>       gtest.so is made and is linked with test.so, so if I do a ldd on
> gtest.so I see that test.so is a dependancy but ldd says it can not find
> it.
>       steping through the dlopen call for gtest.so when opening all the
> dependancies I see that the file it is trying to open in
> /usr/lib/test.so which is not where it is.  It never looks in the dirs
> that I specified with the -rpath and the -rpath-link options to the
> linker.

I think that -rpath only applies when running executables, not for
dlopen(). -rpath-link is only used by the linker; the path isn't
stored in the file which the linker creates.

You will need to add the appropriate directory to LD_LIBRARY_PATH.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to