Re: GCC-provided runtime libraries.

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

 



Christian Böhme writes:
 > 
 > I am currently trying to install the 4.2.0 version of GCC on a
 > Linux system that has not seen much administration work over the past
 > years.  This system has an old and broken (apparently misadminstered)
 > version of g++ installed that is not usable.  It also happens that
 > said system has some commercial production software on it which is
 > not available in source form.  Since I am not going to want to do a
 > full bootstrap of the whole system, let alone experimenting with
 > (in)compatibilities of versions of all sorts of runtime libraries
 > (eg, libc, libstdc++) with said software, the logical approach would
 > be to install the new compiler in a separate location that is to use
 > the binutils, runtime linker and libc of the system.

Yes.

 > The problem here is that this new compiler with its updated/
 > improved/bug-less runtime libraries (such as libgcc_s.so,
 > libstdc++.so, libgfortran.so) does not explicitly tell the linker
 > to link against them (or set DT_RUNPATH in the resulting executables
 > accordingly) but to use what is setup by the sysadmin (via /etc/ld.so.conf
 > and friends).  Consequently, I reverted back to configuring with static
 > runtime libraries which even more surprisingly yielded the same result.
 > It appears that g++ only passes a lone -lstdc++ to the linker
 > but not the path where GCC supposedly installed its own sparkly
 > new libraries (either shared or static).
 > 
 > While it would certainly be _possible_ to set LD_RUN_PATH to the
 > location of the libraries during link time, it nevertheless is tedious
 > to do so for every invokation.  It would, of course, require knowledge
 > about their exact location in the filesysytem which is definitely not
 > what every user should be expected to know.
 > 
 > What I want is that executables compiled with the new compiler
 > shall be linked against the new runtime libraries installed with
 > that compiler while existing software is to use the existing runtime
 > libraries.
 > 
 > Is there a way to do that without hacking the GCC sources ?

The simplest and probably best idea is the most obvious one: replace
your installed gcc with a script that invokes gcc with "-specs=FILE".
You can then add any specs you want in FILE, such as invoking ld with
-rpath.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux