Problem with -static-libstdc++ on Mac OS X

Simon Wright simon@pushface.org
Wed Jun 17 19:43:00 GMT 2015


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?


More information about the Gcc-help mailing list