Subject: Re: "-Ldir -lname" vs. "dir/libname.so"
To: Todd Vierling , Nick Hudson <skrll@netbsd.org>
From: Nick Hudson <skrll@netbsd.org>
List: tech-toolchain
Date: 03/14/2002 16:45:43
On Thursday 14 March 2002 3:52 pm, Todd Vierling wrote:
> On Thu, 14 Mar 2002, Nick Hudson wrote:
> 
> : > [ELF]
> : >
> : > 	cd libfoo
> : > 	cc -shared -o libfoo.so.0.0 -Wl,-soname,libfoo.so.0 ... \
> : > 		-R/usr/pkg/some/lib -L/usr/pkg/some/lib -lsomelib
> : > 	ln -s libfoo.so.0.0 libfoo.so.0
> : > 	ln -s libfoo.so.0.0 libfoo.so
> : >
> : > 	cd ../libbar
> : > 	cc -shared -o libbar.so.0.0 -Wl,-soname,libbar.so.0 ... \
> : > 		-R/usr/pkg/foo/lib -L../libfoo -lfoo \
> : > 		-Wl,-rpath-link,/usr/pkg/some/lib
> :
> : Two things to note about this are
> :
> : 	- The -Wl,-rpath-link part is no longer needed. The 2.11.2 based ld and
> :       the patched 2.9.3 ld (in 1.5.3) automatically look for NEEDED
> :       libraries in the RPATH of the dependent library.
> :
> : 	- The uninstalled libbar won't contain the necessary RPATH to find the
> : 	  uninstalled libfoo.
> 
> You just contradicted yourself.  If -Wl,-rpath-link is not needed as you
> say, then the only place ld can find out libfoo's location is from the rpath
> ... which points at a directory where libfoo is not yet installed!  (Yes,
> I'm assuming that libbar is being linked with an rpath pointing at *only*
> the install path of libfoo, as I illustrated in my examples.)

The -rpath-link is not needed to find libsome (the already installed library) 
as I assumed that its install directory was passed using -R when creating 
libfoo.

> The -rpath-link is needed in order to resolve uninstalled dependencies, such
> as the one on libfoo.  This is the *correct* way to do a link of a shared
> object with dependencies on ELF.

Do a search for -rpath-link in libtool... Find it? No? Well I guess libtool's 
doing the wrong thing then. Feel free to fix libtool. :)

All of which doesn't really solve Johnny's problem.


Nick