Error when building GCC 4.7.1 on hppa2.0-unknown-linux-gnu

Jonathan Wakely
Thu Jul 5 15:17:00 GMT 2012

On 5 July 2012 15:53, Vincent Lefevre wrote:
> On 2012-07-05 13:37:11 +0100, Jonathan Wakely wrote:
>> On 5 July 2012 13:21, Vincent Lefevre wrote:
>> > On 2012-07-05 15:07:53 +0300, Kai Ruottu wrote:
>> >> The '--with-*' options only advice the compile time linker to find
>> >> the right libraries but don't do anything for the runtime
>> >> situation...
>> >
>> > Ah, OK. Why isn't this fixed, e.g. by adding --with-* paths to
>> > the runpath of the generated executables needed for the build?
>> The --with-xxx options only affect -I and -L
>> GCC never adds runpaths to executables by default.  This is also a FAQ:
> No, this FAQ covers the executables that are generated for the user
> by the build (e.g. when the user runs the gcc command), not those
> used for the build.

The GCC build system doesn't set an RPATH in GCC for the same reason
GCC doesn't set an RPATH in the executables it produces.  It's a GCC

When bootstrapping GCC is built by GCC, so an answer explaining why
GCC doesn't set RPATH in executables produced by GCC is entirely

> For instance, to build MPFR when using --with-gmp=GMP_DIR, setting
> LD_LIBRARY_PATH is not necessary for the build and "make check".
> But after installing MPFR, if the user wants to use it and that
> GMP can be found in GMP_DIR, the user may need to set up

GCC is different.

Feel free to suggest changing that, but until that happens the docs
reflect reality.

>> > I'd say that the goal of the --with-* options is to provide the
>> > paths when they are not in the default environment (including
>> > the runtime linker).
>> What if the location of those libs during bootstrap is not the same as
>> the location will be when the installed compiler is used?
> Doesn't LD_LIBRARY_PATH have the precedence?

There are several ways to tell the runtime loader how to find the
libraries, users can decide which to use.

If they use the DT_RPATH section then that has precedence over
LD_LIBRARY_PATH. If they use LD_LIBRARY_PATH then it has precedence
over DT_RUNPATH or ldconfig.

The --with-xxx options don't use any method. You can use LD_RUN_PATH
or LD_LIBRARY_PATH during the build to control it if you want to.  I
consider it much simpler to install the support libs in standard
locations or to build them in-tree, and the problem simply doesn't
exist, which is the best option for at least 90% of people building

> Or if the locations
> of the libraries have definitely changed, can't the user update
> the rpath with a utility like chrpath?

That's not widely available.

You asked where the problem came from, so I pointed you to the
relevant documentation which answers the question and says how to
avoid the problem. Now you're arguing about whether it should be that
way, which is a different discussion and not one I'm interested in
right now.

More information about the Gcc-help mailing list