From 486dcf32274ae6c3e0ea7916fd1e88a58742b7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 3 Nov 2022 11:19:53 +0200 Subject: [PATCH] build-compiler-rt: Avoid finding an unrelated LLVMConfig.cmake Since 23c665371a98c7a16765d12bf2db19b0626b7181 in llvm-project (Nov 2, 2022), compiler-rt uses CMake's find_package() for finding potentially installed LLVM files, instead of using llvm-config. If the surrounding distribution does have an unrelated install of LLVM packages, compiler-rt's CMake files would find this, and add include directories from it into the include paths used when building compiler-rt. The ORC runtimes include libc++ headers, and those error out on these unexpected include topologies (when libc++'s cstddef includes stddef.h and expects to get libc++'s stddef.h, but ends up getting a different stddef.h included). (Without this, it wouldn't have been noticed that the build ends up using a mismatched sysroot's headers.) This fixes building in msys2 in the clang64 environment, where the base toolchain packages end up including LLVM packages, including LLVMConfig.cmake. This fixes the same issue as 3b96433cdf89e8ef444c6669254b386229dbddd9 did, for the new form of compiler-rt cmake files. --- build-compiler-rt.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build-compiler-rt.sh b/build-compiler-rt.sh index bbcb4ec..1fff641 100755 --- a/build-compiler-rt.sh +++ b/build-compiler-rt.sh @@ -111,6 +111,9 @@ for arch in $ARCHS; do -DCOMPILER_RT_USE_BUILTINS_LIBRARY=TRUE \ -DCOMPILER_RT_BUILD_BUILTINS=$BUILD_BUILTINS \ -DLLVM_CONFIG_PATH="" \ + -DCMAKE_FIND_ROOT_PATH=$PREFIX/$arch-w64-mingw32 \ + -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ + -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \ -DSANITIZER_CXX_ABI=libc++ \ -DCMAKE_C_FLAGS_INIT="$CFGUARD_CFLAGS" \ -DCMAKE_CXX_FLAGS_INIT="$CFGUARD_CFLAGS" \