Subject: packages installing shared libraries for loading with dlopen
To: None <tech-pkg@netbsd.org>
From: Brook Milligan <brook@biology.nmsu.edu>
List: tech-pkg
Date: 10/27/2006 11:48:53
I am having trouble with resolving symbols in a shared library created
by a package I am working on.  The situation is this:

- package 1:  creates a shared library libpkg1.so
- package 2:  creates a shared library libpkg2.so, which is linked
  against libpkg1.so
- package 3:  tries to load libpkg2.so via dlopen(3) and complains
  about not finding libpkg1.so

All the symbols in libpkg1.so are resolved fine as determined by 'ldd
libpkg1.so'.  This is not true for libpkg2.so, as ldd complains about
not finding libpkg1.so.

I have tried building libpkg2.so with '-Wl,-rpath,<path to
libpkg1.so>' (and with -rpath-link), but that seems to make no
difference.  Indeed, there seems to be no reference to any search
paths in libpkg2.so as determined by 'objdump -x'.  Furthermore, if
the link is done with 'c++ --verbose -t' there is no evidence of the
-rpath option being passed on to ld.  ld is, however, finding all the
appropriate libraries within the buildlink directory.

I thought I understood the use of -Wl,-rpath, but apparently not.

What am I missing?  How can I get the appropriate search path embedded
into libpkg2.so so that this all works?

Thanks for your help.

Cheers,
Brook