http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55533
Bug #: 55533 Summary: Can't bootstrap libsanitizer Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer AssignedTo: unassig...@gcc.gnu.org ReportedBy: hjl.to...@gmail.com CC: do...@gcc.gnu.org, dvyu...@gcc.gnu.org, ja...@gcc.gnu.org, k...@gcc.gnu.org Created attachment 28830 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28830 A patch to boostrap libsanitizer When bootstrap libsanitizer with target_modules = { module= libsanitizer; bootstrap=true; lib_path=.libs; }; on Linux/ia32 and Linux/x86-64, I got /bin/sh ../libtool --tag=CXX --mode=compile /export/build/gnu/gcc/build-x86_64-linux/./gcc/xg++ -B/export/build/gnu/gcc/build-x86_64-linux/./gcc/ -nostdinc++ -funconfigured-libstdc++-v3 -L/export/build/gnu/gcc/build-x86_64-linux/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/export/build/gnu/gcc/build-x86_64-linux/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -B/usr/gcc-4.8.0/x86_64-unknown-linux-gnu/bin/ -B/usr/gcc-4.8.0/x86_64-unknown-linux-gnu/lib/ -isystem /usr/gcc-4.8.0/x86_64-unknown-linux-gnu/include -isystem /usr/gcc-4.8.0/x86_64-unknown-linux-gnu/sys-include -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I/export/gnu/import/git/gcc/libsanitizer/interception -I /export/gnu/import/git/gcc/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -Wno-c99-extensions -g -O2 -D_GNU_SOURCE -c -o interception_linux.lo /export/gnu/import/git/gcc/libsanitizer/interception/interception_linux.cc xg++: error: unrecognized command line option ‘-funconfigured-libstdc++-v3’ make[5]: *** [interception_linux.lo] Error 1 make[5]: *** Waiting for unfinished jobs.... From Makefile.tpl: # CXX_FOR_TARGET is tricky to get right for target libs that require a # functional C++ compiler. When we recurse, if we expand # CXX_FOR_TARGET before configuring libstdc++-v3, we won't get # libstdc++ include flags from the script. Instead, we get an # -funconfigured-* word, so that we'll get errors if this invalid C++ # command line is used for anything, but also so that we can use the # word to decide whether or not to pass on this CXX_FOR_TARGET. If we # don't pass it on, sub-make will use the default definition, that # re-expands it at the time of use, so we'll get it right when we need # it. One potential exception is the expansion of CXX_FOR_TARGET # passed down as part of CXX within TARGET_FLAGS, but this wouldn't # really work, for C++ host programs can't depend on the current-stage # C++ target library. CXX_FOR_TARGET_FLAG_TO_PASS = \ $(shell if echo "$(CXX_FOR_TARGET)" | grep " -funconfigured-" > /dev/null; then :; else echo '"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"'; fi) When we expand CXX_FOR_TARGET for libsanitizer before configuring it, libstdc++-v3/scripts/testsuite_flags isn't available yet. The solution is to set raw_cxx=true and use -I to include libstdc++ header file explicitly when the C++ library is used for bootstrap.