This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/58638] libstdc++ builds as non-PIC when --with-pic is specified
- From: "slipcon at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Jan 2015 14:25:09 +0000
- Subject: [Bug libstdc++/58638] libstdc++ builds as non-PIC when --with-pic is specified
- Auto-submitted: auto-generated
- References: <bug-58638-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58638
Scott Lipcon <slipcon at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |slipcon at gmail dot com
--- Comment #9 from Scott Lipcon <slipcon at gmail dot com> ---
We saw the same issue with gcc 4.9.2 on x86_64 Linux - we build the compiler
with --disable-shared in order to be able to deliver our software on systems
without libstdc++.so. Without the patches in this issue, we were unable to
link our .sos to libstdc++.a because of the missing -fPIC. The patch I ended
up using was a bit different than those in the comments below, but seems to be
working for our installation:
--- libstdc++-v3/configure.ac.orig 2015-01-08 08:40:40.480754159 -0500
+++ libstdc++-v3/configure.ac 2015-01-08 08:43:27.633844665 -0500
@@ -120,6 +120,11 @@
glibcxx_compiler_pic_flag="$lt_prog_compiler_pic_CXX"
glibcxx_compiler_shared_flag="-D_GLIBCXX_SHARED"
+elif test "${with_pic+set}" = set; then
+ glibcxx_lt_pic_flag="-prefer-pic"
+ glibcxx_compiler_pic_flag="$lt_prog_compiler_pic_CXX"
+ glibcxx_compiler_shared_flag=
+
else
glibcxx_lt_pic_flag=
glibcxx_compiler_pic_flag=
I hope this gets applied to an official release at some point.