[llvm] [runtimes] Append `-nostd*++` flags only if necessary (PR #151930)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 7 04:39:41 PDT 2025
Meinersbur wrote:
I think it was added because originally, LLVM_ENABLE_RUNTIMES was invented for libc++(abi). It is C++, but obviously cannot link against libc++.so before libc++.so is built. For any library that is not libc++ but uses the C++ standard library (flang-rt, hwloc through openmp, maybe others), as long as there is a libc++/libstdc++ installed on the system and found by Clang, it can use that.
If we want those runtimes to link together with just-built libc++, we need a 4-stage bootstrapping build (clang -> compiler-rt builtins -> libc++ -> flang-rt/openmp). Or, at least this seems to be the current approach, make the configure step not depend on the existence of the C++ standard library, but for build-time, one can add a dependency to libc++ if built in the same runtimes build.
Also see #131010
Note that you can temporarily get rid of the flags using [`cmake_push_check_state(RESET)`]().
Also consider that you can add flags only for a specific language: `$<$<COMPILE_LANGUAGE:C>:-nostdlib++>`. Haven't tries whether this also works for `CMAKE_REQUIRED_FLAGS`.
https://github.com/llvm/llvm-project/pull/151930
More information about the llvm-commits
mailing list