From 4b34c42cbccade70bae985965a9b52e316c9f2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sun, 24 Oct 2021 14:11:06 +0300 Subject: [PATCH] build-libcxx: Set CMAKE_CXX_COMPILER_TARGET when building LLVM's default host detection doesn't always work (cmake doesn't detect and provide the target architecture, but it provides the bitness, thus LLVM's GetHostTriple.cmake guesses on the same architecture as running the build), thus pass it manually. This didn't use to matter, as the tests for whether --target= works used to fail, as the toolchain isn't complete at that point. But since 7af584ed87cc6eddb6adbc451c90fb8867469e06 in llvm-project (November 5th 2021), the libunwind cmake tests for --target do succeed (without noticing that linking actually will fail), and thus can end up using the incorrectly guessed compiler target. Thus, this fixes building the runtimes with current git main versions of llvm-project. --- build-libcxx.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build-libcxx.sh b/build-libcxx.sh index a3a6573..7f94b59 100755 --- a/build-libcxx.sh +++ b/build-libcxx.sh @@ -93,6 +93,7 @@ build_all() { -DCMAKE_INSTALL_PREFIX="$PREFIX/$arch-w64-mingw32" \ -DCMAKE_C_COMPILER=$arch-w64-mingw32-clang \ -DCMAKE_CXX_COMPILER=$arch-w64-mingw32-clang++ \ + -DCMAKE_CXX_COMPILER_TARGET=$arch-w64-windows-gnu \ -DCMAKE_CROSSCOMPILING=TRUE \ -DCMAKE_SYSTEM_NAME=Windows \ -DCMAKE_C_COMPILER_WORKS=TRUE \ @@ -123,6 +124,7 @@ build_all() { -DCMAKE_INSTALL_PREFIX="$PREFIX/$arch-w64-mingw32" \ -DCMAKE_C_COMPILER=$arch-w64-mingw32-clang \ -DCMAKE_CXX_COMPILER=$arch-w64-mingw32-clang++ \ + -DCMAKE_CXX_COMPILER_TARGET=$arch-w64-windows-gnu \ -DCMAKE_CROSSCOMPILING=TRUE \ -DCMAKE_SYSTEM_NAME=Windows \ -DCMAKE_C_COMPILER_WORKS=TRUE \ @@ -159,6 +161,7 @@ build_all() { -DCMAKE_INSTALL_PREFIX="$PREFIX/$arch-w64-mingw32" \ -DCMAKE_C_COMPILER=$arch-w64-mingw32-clang \ -DCMAKE_CXX_COMPILER=$arch-w64-mingw32-clang++ \ + -DCMAKE_CXX_COMPILER_TARGET=$arch-w64-windows-gnu \ -DCMAKE_CROSSCOMPILING=TRUE \ -DCMAKE_SYSTEM_NAME=Windows \ -DCMAKE_C_COMPILER_WORKS=TRUE \