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++.