[llvm] Remember LLVM_ENABLE_LIBCXX setting in installed configuration (PR #134990)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 9 03:56:18 PDT 2025
https://github.com/Meinersbur created https://github.com/llvm/llvm-project/pull/134990
The buidbot [flang-aarch64-libcxx](https://lab.llvm.org/buildbot/#/builders/89) is currently failing with an ABI issue. The suspected reason is that LLVMSupport.a is built using libc++, but the unittests are using the default C++ standard library, libstdc++ in this case. This predefined `llvm_gtest` target uses the LLVMSupport from `find_package(LLVM)`, which finds the libc++-built LLVMSupport.
To fix, store the `LLVM_ENABLE_LIBCXX` setting in the LLVMConfig.cmake such that everything that links to LLVM libraries use the same standard library. In this case discussed in https://github.com/llvm/llvm-zorg/pull/387 it was the flang-rt unittests, but other runtimes with GTest unittests should have the same issue (e.g. offload), and any external project that uses `find_package(LLVM)`. This patch fixed the problem for me locally.
`llvm_gtest` defined here: https://github.com/llvm/llvm-project/blob/74f69c49fed894ba26b6174783e4c650d50344c5/third-party/unittest/CMakeLists.txt#L51
>From 65828b2fc1cf534542a1ccfc06008cd2b2de6f47 Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Wed, 9 Apr 2025 12:18:41 +0200
Subject: [PATCH] Remember LLVM_ENABLE_LIBCXX setting
---
llvm/cmake/modules/LLVMConfig.cmake.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in
index 5ccc66b8039bf..1c34073f6b910 100644
--- a/llvm/cmake/modules/LLVMConfig.cmake.in
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in
@@ -55,6 +55,8 @@ endif()
set(LLVM_ENABLE_RTTI @LLVM_ENABLE_RTTI@)
+set(LLVM_ENABLE_LIBCXX @LLVM_ENABLE_LIBCXX@)
+
set(LLVM_ENABLE_LIBEDIT @HAVE_LIBEDIT@)
if(LLVM_ENABLE_LIBEDIT)
find_package(LibEdit)
More information about the llvm-commits
mailing list