This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Building libstdc++ non-shared with -fpic ?
- To: gcc at gcc dot gnu dot org
- Subject: Building libstdc++ non-shared with -fpic ?
- From: Ingo Rohloff <lundril at gmx dot net>
- Date: Fri, 30 Jun 2000 16:20:46 +0000
Hi,
I'm one of the few people out there, which use a homegrown linux
system. One of the main problems I have to deal with are
binaries linked to a version of libstdc++ I don't have.
I complained about this to some folks (e.g. the Mozilla team),
and said that gcc doesn't even build libstdc++ as shared library
when build with the default configuration.
After browsing through some bug reports pointed out to me,
the following turned up:
libstdc++ HAS to be a shared library, because other shared
libraries (such as qt) depend on it.
Now if you try to build a shared library, which uses code of a
static libstdc++, this will lead to problems, because the
static libstdc++ will contain code which is NOT position
independent.
A resolution to this problem seems to compile libstdc++ as
static library BUT with the -fpic option, so that the code
included in the static archive is PIC.
I browsed through the configuration files of gcc-2.95.2
and found out that the libstdc++ will only be build in
PIC, if it is also build as a shared library. (no surprise)
Could this be changed ? Or won't this work anyway...
(So that it libstdc++ will always contain PIC, even if it
is build non-shared ?)
so long
Ingo
PS: Some people said that the linker should be able to recognize
if non PIC is linked to a shared library and complain, but I'm not
sure if this is possible. Comments ?