A question about RPATH
Dennis Clarke
dclarke@blastwave.org
Thu Dec 20 00:31:00 GMT 2012
> On 20 December 2012 00:15, Dennis Clarke wrote:
> >
> >> > I am a firm believer that LD_LIBRARY_PATH is evil, certainly
> >> > at least dangerous and the
> >> > output binary from any compile should have an RPATH set to
> >> > ensure that the correct
> >> > libs are found that the developer wanted.
> >> >
> >> > Having said all that, is there a magic
> >> > LD_OPTIONS_INCANTATION=-Wl,-rpath=/usr/local/lib type thing
> >> > to set to ensure I get my RPATH ? I should point out
> >> > this is trivial to do in the Solaris world and perhaps I am
> >> > missing something really obvious here.
>
> GCC does not tell the linker to set RPATH unless explicitly requested,
> see http://gcc.gnu.org/faq.html#rpath
I guess because I tend to enjoy the Linux From Scratch project I like to build a
compiler which is isolated away from the host operating system that I am
doing the build with. Ultimately I can get a full GNU toolchain in /usr/local
that is self enclosed and will not use libs from /usr/lib etc.
> > So I will rebuild gcc with
> LD_RUN_PATH=/usr/local/lib:/usr/local/gcc4/lib64 and see what
> > I get.
>
> That's what I've done when building on Solaris
I have a good hands on familiarity with Solaris/OpenSolaris and have managed
to get reasonable toolchains built there. In that case I tend to use LD_OPTIONS
as well as a few options passed to the compiler to get the desired RPATH.
> although in my case it
> was for the runtime libs, not the gcc executables (see
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354#c9). There has been
> a suggestion to add a new configure option to set RPATHs, see
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45508#c10
Well I am all for a RPATH option.
Dennis
More information about the Gcc-help
mailing list