This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Spec strings to pass ‘-rpath’ for each ‘-L’


On Fri, 14 Sep 2012, Ludovic CourtÃs wrote:

Marc Glisse <marc.glisse@inria.fr> skribis:

On Thu, 13 Sep 2012, Ludovic CourtÃs wrote:

Hi,

The page at <http://gcc.gnu.org/faq.html>, under âDynamic linker is
unable to find GCC librariesâ reads:

 The short explanation is that if you always pass a -R option to the
 linker, your programs become dependent on directories which may be NFS
 mounted [...]

 However, if you feel you really need such an option to be passed
 automatically to the linker, you may add it to a GCC specs file. [...]
 You may add linker flags such as -R or -rpath, depending on platform
 and linker, to the *link or *lib specs.

After spending some time looking at spec strings and at the manual, I
canât think of a way of emitting â-rpath LIBDIRâ for every â-LLIBDIRâ
encountered.

%{L*:-rpath %*} maybe?

I realize this isnât sufficient for my purposes: when $LIBRARY_PATH is used, -L can be omitted, thus bypassing the above trick.

Ideally, for every â-lLIBâ, it would add â-rpath $(dirname $(which
LIB))â, so to speak.  That may be beyond what spec strings can express,
though.  Or maybe not? :-)

If you bypass the compiler to talk to the linker (LD_* environment variables, -Wl,* flags), only the linker can help you.


--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]