From 3b96433cdf89e8ef444c6669254b386229dbddd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 15 Aug 2022 00:23:16 +0300 Subject: [PATCH] build-compiler-rt: Make sure that compiler-rt doesn't pick up an external llvm-config We normally don't install all tools (including llvm-config), or we might have stripped them out, but the system distro might have installed a copy of llvm-config (for a different unrelated installation of llvm). Some compiler-rt runtimes (such as xray and orc) use this for finding the main llvm headers. When building compiler-rt, we really don't want it to pick up any random version of llvm headers found on the system, but keep using the matching headers from the monorepo instead. Adding the include directory of a system provided set of llvm headers is especially fatal if that directory isn't a subdirectory containing only llvm headers, but contains other system headers too. In particular, on msys2, the include directory (pointed at by "llvm-config --includedir", and also set by including LLVMConfig.cmake which is pointed at by "llvm-config --cmakedir") is the main system include directory. Including this can also get headers for a system install of libc++ headers (for the clang64 msys2 distro) - and using libc++ headers with a second set of libc++ headers in the include path is fatal (due to include_next not finding the plain C header but finding a second libc++ header). Just try to make sure that we don't pick up any unintended headers. --- build-compiler-rt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build-compiler-rt.sh b/build-compiler-rt.sh index b05ac73..c726909 100755 --- a/build-compiler-rt.sh +++ b/build-compiler-rt.sh @@ -95,6 +95,7 @@ for arch in $ARCHS; do -DCMAKE_C_COMPILER_TARGET=$arch-windows-gnu \ -DCOMPILER_RT_DEFAULT_TARGET_ONLY=TRUE \ -DCOMPILER_RT_USE_BUILTINS_LIBRARY=TRUE \ + -DLLVM_CONFIG_PATH="" \ -DSANITIZER_CXX_ABI=libc++ \ $SRC_DIR $BUILDCMD ${CORES+-j$CORES}