From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8270 invoked by alias); 23 May 2014 04:39:11 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 5602 invoked by uid 48); 23 May 2014 04:39:06 -0000 From: "skunk at iskunk dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/58638] libstdc++ builds as non-PIC when --with-pic is specified Date: Fri, 23 May 2014 04:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: skunk at iskunk dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg02053.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58638 --- Comment #8 from Daniel Richard G. --- (In reply to Jonathan Wakely from comment #7) > Seems unlikely, but if -static-libgcc -static-libstdc++ gives you a runtime > dependency on GCC then that should be reported as a bug. I tried a 4.9.0 build without --disable-shared to jog my memory. The problem was twofold: First, GCC can't find its own runtime library when linking programs: /usr/bin/ld: cannot find -lgcc_s I can specify -L$(PREFIX)/lib/gcc/x86_64-unknown-linux-gnu/lib64 manually, and that allows things to link. But then, unless I futz with ld.so.conf/LD_LIBRARY_PATH, the resulting executable uses the wrong instance of libgcc/libstdc++: $ ldd swig linux-vdso.so.1 => (0x00007fff76839000) libdl.so.2 => /lib64/libdl.so.2 (0x000000302ee00000) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003039a00000) libm.so.6 => /lib64/libm.so.6 (0x000000302e600000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003035a00000) libc.so.6 => /lib64/libc.so.6 (0x000000302ea00000) /lib64/ld-linux-x86-64.so.2 (0x000000302e200000) (Note: It's probably relevant that I also build GCC with --enable-version-specific-runtime-libs, to avoid a different way that the runtimes can get mixed up.) Not having to specify -static-libblah is a bonus, but these were the real reasons that I was using --disable-shared. Should I file a new bug for this?