Re: rpath problems



>I'm trying to compile gtk with the runtime library search
>path set to include the path to my X libraries. I've tried
>many things, and the only way I've been able to get it to
>work has been to copy and paste the gcc command that does
>the linking, and then add this to it: 
>-Wl,--rpath -Wl,/opt/xfree86-4.2.0/lib
>
>Thus, this works:
>$ gcc blah blah -Wl,--rpath -Wl,/opt/xfree86-4.2.0/lib
>
>but somehow, this does not:
>$ LDFLAGS="-Wl,--rpath -Wl,/opt/xfree86-4.2.0/lib" gcc blah blah 
>Neither do
>$ LDFLAGS="--rpath /opt/xfree86-4.2.0/lib" gcc blah blah
>or
>$ LDFLAGS="-R/opt/xfree86-4.2.0/lib" gcc blah blah
>or
>$ LD_RUN_PATH=/opt/xfree86-4.2.0/lib gcc blah blah
>
>Presumably, if any of these worked, I could set the same
>environment variables when running make, and it would work
>for the whole thing.
>
>So, I guess the question is, how do I get that string into
>the Makefiles and onto the command line? Setting LDFLAGS to
>it when running ./configure doesn't work, either.

it depends on the Makefile, not on gcc. gcc knows nothing about
LDFLAGS. and you're not using make in any of the examples above.

i believe that in general, the use of -rpath as a linker option is
deprecated by most people. it will produce a binary that may do
undesirable things on some systems. its preferred to make the
"executable" a shell script that sets LD_LIBRARY_PATH and then execs
the "real" (binary) executable.

--p



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