Hi Jan,

* Jan Engelhardt wrote on Sun, Nov 02, 2008 at 05:24:27PM CET:
> 
> I have two libraries in paths that are not searched by default (e.g. 
> /opt/foo/lib). So I have this in my pkgconfig files:
> 
> foo.pc: Libs: -L${libdir} -lfoo
> bar.pc: Libs: -L${libdir} -lbar
> 
> The linker will find -lfoo,-lbar and successfully create the output file 
> -- which is an .la library --, but running `ldd` on it says 
> "libfoo.so.0 => not found", and that seems fine to me, since no -rpath 
> was given. So I try to add -rpath in the pkgconfig files:

Bzzt.  Libtool's way to list additional run paths is not -rpath, but -R.
Yes, incredibly smart, I know, but we can't change it now.  -rpath is to
say "the library I'm creating is to be installed later in this
directory".

So use -R, with or without following space.  With multiple paths, use -R
path1 -R path2.  But even better if you don't use it at all; you should
never need it to link against libtool libraries (those where an .la file
is present).

If you need to specify a way that is both portable to libtool and a GNU
binutils ld-using compiler, then use -Wl,-rpath -Wl,$(libdir).  Of
course that breaks for some (few) non-GCC compilers (because they don't
understand -Wl), and many non-GNU linkers (because they use something
other than -rpath, or don't allow multiple instances of -rpath but need
one flag with colon-separated optarg, or so).

Hope that helps.

Cheers,
Ralf


_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool

Reply via email to