Subject: libtool problem with runtime shlib path propagation
To: None <tech-pkg@netbsd.org, tech-toolchain@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-toolchain
Date: 02/13/2002 16:56:41
I've found a case where the runtime library search path
is not set as expected
(with i386-current and the newest pkgsrc/devel/libtool):

A package builds a shared library (using libtool) which
depends on X11 libraries.
The linker call looks like
libtool --mode=link cc -o lib.la *.lo -L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib 
-lX11

The "-Wl,-R" flag gets passed to the linker, the shared library looks well,
"ldd" shows that its search path is OK.

Then an executable is built which needs this library, but has
no dependency on X libraries itself:
libtool --mode=link cc -o mist path/to/lib.la

The linking succeeds, but the resulting binary doesn't have the
"/usr/X11R6/lib" in its runtime search path.

The problem seems to be that "libtool" does store the "-L"
part of the dependency in its lib.la file, but not the runtime
path - if it is given by "-Wl,-R". "libtool" supposedly dtrt if
the runtime path is given by a "-R" option.
Otoh, while this is documented behaviour, it is not portable
and hardly usable with these "gnome" style xxx-config scripts.
It would be better if "libtool" handled "-Wl,-R" the same way
like just "-R".

Worth a PR?
Or should I expect the linker itself to propagate runtime
library search paths?

best regards
Matthias