[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple -rpaths

From: Ralf Wildenhues
Subject: Re: Multiple -rpaths
Date: Sun, 2 Nov 2008 21:56:31 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

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 
> " => 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

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]