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.
This commit is contained in:
Daniel Bertalan 2023-06-03 16:46:05 +02:00 committed by Tim Flynn
parent 2714f99c1c
commit 3ee908df27
Notes: sideshowbarker 2024-07-17 07:09:53 +09:00

View file

@ -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
}