lions and tigers and LDFLAGS, oh my!

Marc Glisse marc.glisse@normalesup.org
Sat May 23 06:54:00 GMT 2009


On Fri, 22 May 2009, Poor Yorick wrote:

> I'd like to embed an RPATH/RUNPATH into all gcc binaries.  It isn't enough to
> just set LDFLAGS and BOOT_LDFLAGS in the environment; those two variables must
> also be passed explicitly as part of the make command:
>
>    make LDFLAGS="$LDFLAGS", BOOT_LDFLAGS="$BOOT_LDFLAGS"
>
> So far, so good.  However, I'd also trying to use the magic word, '$ORIGIN',
> with a literal dollar sign, in the embedded RPATH.  LDFLAGS currently looks
> like this:
[...]
> The problem is that the top-level Makefile specifies enough layers of recursive
> calls to make and the shell that I haven't found a way to quote the dollar sign
> so that it stays quoted throughout the process.  Any hints?

One usual trick to simplify the problem a bit with the shell is:
export 'ORIGIN=$ORIGIN'
You could try:
export 'O=$$O' or something similar to help with make ('O=$O' is not 
accepted).
Consider yourself lucky you don't have a qmake layer on top...

It doesn't solve the problem completely, but I thought I'd mention it.

An other trick is to use a wrapper to the linker, that either adds the 
$ORIGIN thing, or replaces MYRECOGNIZABLESTRINGWITHOUTDOLLAR with $ORIGIN.

-- 
Marc Glisse



More information about the Gcc-help mailing list