Description
The flags -nostdlib++
and -nostdinc++
are added to CMAKE_REQUIRED_FLAGS whenever supported by the compiler:
llvm-project/runtimes/CMakeLists.txt
Line 161 in dcd5e47
llvm-project/runtimes/CMakeLists.txt
Line 157 in dcd5e47
For a normal bootstrapping build the compiler is Clang, so it will always be added. It inherits to all runtimes libraries.
While it may make sense for libc++ to not depend on itself or another C++ standard library, the assumption breaks for any other LLVM runtime library that use C++, which included any GTest-based unittests. Tracking its history, it seems to have first been added in d3ebe71, but just temporarily. The temporary part was dropped at some point. The flags should only be added in those libraries that need it.
Adding those flags globally for all runtimes causes problems in system introspection. e.g.: