As an example the following will set RUNPATH
matthewh@ORAC:~/dev/test$ g++ test.cpp -ldl -Wl,-rpath,\$ORIGIN
matthewh@ORAC:~/dev/test$ objdump -x a.out | grep RUN
RUNPATH $ORIGIN
However, as a more complex example I'm trying to set this for a library that is compiled with a makefile generated with configure.
I run
export LDFLAGS=-Wl,-rpath,\$ORIGIN
./configure
make
objdump -x library.so | grep RUN
RUNPATH RIGIN
Obviously Make is expanding $O instead of putting a literal $O in the output.
How do I overcome this? I've tried escaping it but it's presenting strange output into runpath.
Ok, Specifically I'm attempting to compile ilmbase-2.2.1 from OpenEXR and set the RUNPATH. It's more complicated than a single Makefile as it's using recursive Make!
The top level Makefile ends up setting the variable LDFLAGS= I've tried manually editing that to be $$ORIGIN as suggested in other places but still, it comes through as -Wl,-rpath,RIGIN
Now I'm a bit stuck. Short of editing it after the path is set by rewriting it with some kind of ELF editor which is ugly.