-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdinc++") |
llvm-project/runtimes/CMakeLists.txt
Line 157 in dcd5e47
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++") |
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.: