This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Problem with -static-libstdc++ on Mac OS X
- From: Simon Wright <simon at pushface dot org>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 17 Jun 2015 20:43:04 +0100
- Subject: Problem with -static-libstdc++ on Mac OS X
- Authentication-results: sourceware.org; auth=none
For reasons connected with https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61027 I want to build GCC with shared libgcc (so cross-library exception handling works) and static libstdc++.
You would think that configuring GCC with --with-boot-ldflags=-static-libstdc++ (or --with-stage1-ldflags=-static-libstdc++ for a cross-compiler) would do the trick; but it’s ignored.
It turns out that on Mac OS X (Mavericks, Darwin 13.4.0) g++ ignores -static-libstdc++ unless you also say -static-libgcc (which is exactly what I need to avoid). Same behaviour on GCC 5.1.0, 4.9.1, 4.8.1, 4.7.0.
GCC 4.9.1 built on Debian wheezy doesn’t have this problem (the ld command is something like -Bstatic -lstdc++ -Bdynamic).
Any workrounds?