Skip to content

[Runtimes] -nostdlib++ and -nostdinc++ in CMAKE_REQUIRED_FLAGS breaks systems introspection #139771

Open
@Meinersbur

Description

@Meinersbur

The flags -nostdlib++ and -nostdinc++ are added to CMAKE_REQUIRED_FLAGS whenever supported by the compiler:

set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdinc++")

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.:

Metadata

Metadata

Labels

cmakeBuild system in general and CMake in particular

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions