public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "skunk at iskunk dot org" <gcc-bugzilla@gcc.gnu.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	[thread overview]
Message-ID: <bug-58638-4-4XJzaBev5E@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58638-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58638

--- Comment #8 from Daniel Richard G. <skunk at iskunk dot org> ---
(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?


  parent reply	other threads:[~2014-05-23  4:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-06  3:40 [Bug libstdc++/58638] New: " skunk at iskunk dot org
2013-10-07  6:19 ` [Bug libstdc++/58638] " skunk at iskunk dot org
2013-12-04 11:29 ` hjl.tools at gmail dot com
2014-05-21 10:23 ` redi at gcc dot gnu.org
2014-05-21 20:25 ` redi at gcc dot gnu.org
2014-05-21 21:09 ` skunk at iskunk dot org
2014-05-23  4:39 ` skunk at iskunk dot org [this message]
2015-01-08 14:25 ` slipcon at gmail dot com
2015-04-14  0:02 ` redi at gcc dot gnu.org
2022-08-01 22:27 ` pinskia at gcc dot gnu.org
2022-08-01 23:07 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-58638-4-4XJzaBev5E@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).