public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: GCC-provided runtime libraries.
@ 2007-06-15 12:55 Nick Maclaren
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Maclaren @ 2007-06-15 12:55 UTC (permalink / raw)
  To: gcc-help

Andrew Haley <aph-gcc@littlepinkcloud.COM> wrote:
>
> 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.

I did that for years, on many Unices, and it works very well, except
for one problem.

Software with poxious forms of autoconfiguration will poke around your
system and select one or other compiler at whim - or, in many cases,
a dysfunctional combination of all of them.  Unfortunately, MOST
modern, complex software does at least some of that and you have to
reverse engineer its autoconfiguration to hack around the bugs.  That
can be anywhere from simple to almost impossible.

The only solution to that problem involves the authors of the software,
a dark alley and a blunt instrument.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1@cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: GCC-provided runtime libraries.
@ 2007-06-15  0:27 Timothy C Prince
  2007-06-15  7:44 ` Christian Böhme
  0 siblings, 1 reply; 6+ messages in thread
From: Timothy C Prince @ 2007-06-15  0:27 UTC (permalink / raw)
  To: monodhs; +Cc: gcc-help



-----Original Message-----
From: Christian Böhme <monodhs@gmx.de>
To: gcc-help@gcc.gnu.org
Date: Thu, 14 Jun 2007 16:41:43 +0200
Subject: GCC-provided runtime libraries.

Hello all,

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.

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 system in question uses a SUSE Linux distribution.

These are the config options:

$ ../<gcc-src>/configure \
--with-gmp-include=<some-path>/include \
--with-gmp-lib=<some-path>/lib64 \
--with-mpfr-include=<some-path>/include \
--with-mpfr-lib=<some-path>/lib64 \
--disable-shared \
--enable-version-specific-runtime-libs \
--enable-threads=posix \
--enable-tls \
--enable-languages=c,c++,fortran \
--enable-__cxa_atexit \
--with-gxx-include-dir=<some-path>/include/C++ \
--with-long-double-128 \
--enable-decimal-float \
--with-arch=opteron \
--with-cpu=opteron \
--with-tune=opteron \
--disable-libssp \
--disable-libgomp \
--disable-checking \
--enable-bootstrap \
x86_64-generic-linux

-----------------------------------------------
When you add the --prefix option to specify the install path, your newly built g++ should put the corresponding library directories at the top of its search path:
/yourinstallpath/bin/g++ -print-search-dirs

You will have to put the corresponding library path in the front of LD_LIBRARY_PATH in order for the corresponding .so libraries to be used at run time.

Tim Prince

^ permalink raw reply	[flat|nested] 6+ messages in thread
* GCC-provided runtime libraries.
@ 2007-06-14 19:01 Christian Böhme
  2007-06-15  9:50 ` Kai Ruottu
  2007-06-15 12:16 ` Andrew Haley
  0 siblings, 2 replies; 6+ messages in thread
From: Christian Böhme @ 2007-06-14 19:01 UTC (permalink / raw)
  To: gcc-help

Hello all,

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.

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 system in question uses a SUSE Linux distribution.

These are the config options:

$ ../<gcc-src>/configure \
--with-gmp-include=<some-path>/include \
--with-gmp-lib=<some-path>/lib64 \
--with-mpfr-include=<some-path>/include \
--with-mpfr-lib=<some-path>/lib64 \
--disable-shared \
--enable-version-specific-runtime-libs \
--enable-threads=posix \
--enable-tls \
--enable-languages=c,c++,fortran \
--enable-__cxa_atexit \
--with-gxx-include-dir=<some-path>/include/C++ \
--with-long-double-128 \
--enable-decimal-float \
--with-arch=opteron \
--with-cpu=opteron \
--with-tune=opteron \
--disable-libssp \
--disable-libgomp \
--disable-checking \
--enable-bootstrap \
x86_64-generic-linux



Thanks & regards,
Christian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-06-15 12:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-15 12:55 GCC-provided runtime libraries Nick Maclaren
  -- strict thread matches above, loose matches on Subject: below --
2007-06-15  0:27 Timothy C Prince
2007-06-15  7:44 ` Christian Böhme
2007-06-14 19:01 Christian Böhme
2007-06-15  9:50 ` Kai Ruottu
2007-06-15 12:16 ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).