On 19 October 2011 16:03, Delcypher wrote: >> >> The failure appears to be that you are compiling libstdc++ with a different >> version of g++. In general you must build libstdc++ with the version of >> g++ that it is shipped with. libstdc++ includes non-standard code which >> is dependent on the specific version of the compiler. > > Okay I've found the correct source tarball that matches the version of > g++ on my system. So now how do I go about building libstdc++ only the > correct way with debugging symbols? Assuming `gcc-root' is the root > source tree as before. > > Is running this correct? > $ ../gcc-root/configure --enable-languages=c++ > --enable-libstdcxx-debug --prefix=$HOME/local > > Will the --enable-libstdcxx-debug option be accepted correctly even > though it's being passed to ../gcc-root/configure rather than > ../gcc-root/libstdc++/configure ? Yes. That will put unoptimised, unstripped copies of libstdc++.so etc. in $PREFIX/lib/debug > Assuming that's right do I run > $ make all-target-libstdc++-v3 > > ? I found that make target by looking at the script that builds > libstdc++-v3 for my distribution (Arch Linux). If that is the make > target I need to build only libstdc++-v3 then maybe that should be in > the documentation somewhere? Why? I've not heard of anyone trying to build only libstdc++ before, it's usually built as part of the compiler. IMHO the documentation is correct - had you followed it instead of second-guessing it you'd have got what you wanted. >> Many functions in libstdc++ are inlined from header files, and as such are >> affected by the use of -g when you compile, rather than whether -g was >> used when libstdc++ itself was built. Note that -D_GLIBCXX_DEBUG >> does not affect whether debugging symbols are generated; it produces >> a debugging version of the code which adds runtime checks to make >> sure that functions are being used correctly. > > That's good to know. You really, really don't want to build libstdc++.so itself with _GLIBCXX_DEBUG defined. It's for you to define when compiling *your* code.