public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "baker at usgs dot gov" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/54630] [4.8 Regression] GCC 4.8 --enable-languages=c build fails: Undefined symbols: ___cxa_guard_acquire and ___cxa_guard_release
Date: Wed, 21 Nov 2012 21:38:00 -0000	[thread overview]
Message-ID: <bug-54630-4-2GJxqXbp4Z@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54630-4@http.gcc.gnu.org/bugzilla/>


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54630

--- Comment #17 from Larry Baker <baker at usgs dot gov> 2012-11-21 21:37:26 UTC ---
Jonathan,

Yes, I should have said "link with a C++ driver" instead of "link with a C++
compiler".

>No, it's not equivalent, -static-libstdcxx does not imply -lstdc++,
> which is why you get missing symbols.

-static-libstdcxx has nothing to do with why I get the missing symbols.  I get
the missing symbols because the LINKER changed from $(CC) to $(CXX).

>Why not just use the Sourcery configuration that works?

Why change the LINKER for a C++ program from $(CXX) to $(CC)?  That is what
causes the link to fail.  The g++ driver may have any number of built-in ld
options that differ from the gcc driver.  Why should I care?  The point of
using the g++ driver for a C++ program is that it takes care of all that for
me.

If I get everything working for my cross compiler without using
--with-host-libstdcxx, then the LINKER is $(CXX), which implies -lstdc++.  Now,
suppose I want to eliminate the dependencies of my cross compiler on the libc
and llibc++ shared libraries that happen to be on my Linux system, so that my
cross compiler will run on many Linux systems with possibly different libc's
and libc++'s.  In that case, I do not want to select different library (e.g., a
debug variant), I want to select the .a variant in place of the .so variant. 
If I were writing my own link command, I would use g++ to do the linking with
the options "-static-libgcc -static-libstdc++".  So, how to do the same when
building a GCC cross compiler?

The GCC installation notes, http://gcc.gnu.org/install/configure.html, offer
only one method to add linker options to build GCC: --with-host-libstdcxx.  The
example given there is `-Wl,-Bstatic,-lstdc++,-Bdynamic -lm', which is
equivalent to g++ -static-libstdc++ (plus -lm, which I have no idea why it is
there).  (As far as I can tell, Sourcery copied this example verbatim,
including the unnecessary -lm.)  This example was likely written before the g++
-static-libstdc++ options existed, and certainly was written before the GCC
implementation language was changed from C to C++.  What is not mentioned is
the side effect that the LINKER will change from $(CXX) to ($CC).

>To allow fine-tuning the libs, you need the
>additional libs to not be used, which implies not linking with g++.

Then they should specify CXX=gcc (since there is no way to specify the LINKER
directly).

All this will be moot, I think, when others start bumping into GCC builds that
fail as more of GCC is implemented in C++.


  parent reply	other threads:[~2012-11-21 21:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 21:15 [Bug libstdc++/54630] New: " baker at usgs dot gov
2012-09-20 11:37 ` [Bug middle-end/54630] [4.8 Regression] " rguenth at gcc dot gnu.org
2012-09-20 20:28 ` baker at usgs dot gov
2012-09-20 20:30 ` baker at usgs dot gov
2012-09-21 18:58 ` baker at usgs dot gov
2012-09-21 19:17 ` baker at usgs dot gov
2012-09-21 20:35 ` baker at usgs dot gov
2012-09-22  1:14 ` baker at usgs dot gov
2012-09-22  1:45 ` baker at usgs dot gov
2012-09-25  1:53 ` baker at usgs dot gov
2012-11-19  3:02 ` jason at gcc dot gnu.org
2012-11-19 13:44 ` jakub at gcc dot gnu.org
2012-11-20  9:24 ` jakub at gcc dot gnu.org
2012-11-20 19:58 ` baker at usgs dot gov
2012-11-20 20:20 ` jakub at gcc dot gnu.org
2012-11-20 22:25 ` baker at usgs dot gov
2012-11-21 11:20 ` redi at gcc dot gnu.org
2012-11-21 21:38 ` baker at usgs dot gov [this message]
2012-11-22  0:51 ` ian at airs dot com
2012-11-26 19:44 ` baker at usgs dot gov

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-54630-4-2GJxqXbp4Z@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).