https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88749
--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #10) > (In reply to Romain Geissler from comment #9) > > This may be some naive question, but if we are currently trying to build a > > libstdc++, shouldn't we assume there is no pre-existing libstdc++ and run > > the different checks in the configure script either with the C compiler (if > > indeed we never use C++) > > No, because testing whether a C compiler can use those functions tells us > nothing about whether G++ will be able to use them. C libraries expose > different declarations to C and C++ programs. > > > or with CXXFLAGS like -nodefaultlib ? > > That would also make libc unavailable. The C++ configure tests are done with the newly-built xgcc, which means it won't try to link to libstdc++. In my config.log I see this command: configure:80504: checking for utime configure:80554: /tmp/build/./gcc/xgcc -shared-libgcc -B/tmp/build/./gcc -nostdinc++ -L/tmp/build/x86_64-pc-linux-gnu/libstdc++-v3/src -L/tmp/build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/tmp/build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -B/usr/local/x86_64-pc-linux-gnu/bin/ -B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem /usr/local/x86_64-pc-linux-gnu/include -isystem /usr/local/x86_64-pc-linux-gnu/sys-include -o conftest -g -O2 -D_GNU_SOURCE -fno-exceptions -Wl,-t conftest.cpp >&5 There's no -lstdc++ there, and xgcc won't add it implicitly. The problem is that you're using x86_64-1a-linux-gnu-g++ as the compiler for these tests, and g++ automatically adds -lstdc++.