From 3ee908df27ae84674472211b9ee7c65a4a919c89 Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Sat, 3 Jun 2023 16:46:05 +0200 Subject: [PATCH] Meta: Always use the default host compiler for the toolchain on macOS GCC's build fails in `libisl`'s configure step if `CC` is set to Homebrew Clang with the message "Link Time Optimisation is not supported". This is likely due to the fact that it tries to use ranlib from Xcode, which is not compatible with the newer LLVM version's bitcode format. The toolchain build runs after `pick_host_compiler` is called, which selects Homebrew Clang if the installed Xcode version is too old. We need to unset `CC` and `CXX` for the toolchain build to sidestep the issue. --- Meta/serenity.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Meta/serenity.sh b/Meta/serenity.sh index 05b40742f6..5e12d01c5d 100755 --- a/Meta/serenity.sh +++ b/Meta/serenity.sh @@ -303,10 +303,16 @@ build_cmake() { build_toolchain() { echo "build_toolchain: $TOOLCHAIN_DIR" + if [ "$TOOLCHAIN_TYPE" = "Clang" ]; then ( cd "$SERENITY_SOURCE_DIR/Toolchain" && ./BuildClang.sh ) else - ( cd "$SERENITY_SOURCE_DIR/Toolchain" && ARCH="$TARGET" ./BuildGNU.sh ) + ( + # HACK: ISL's configure fails with "Link Time Optimisation is not supported" if CC is + # Homebrew Clang due to incompatibility with Xcode's ranlib. + [ "$(uname -s)" = "Darwin" ] && unset CC CXX + cd "$SERENITY_SOURCE_DIR/Toolchain" && ARCH="$TARGET" ./BuildGNU.sh + ) fi }