llvmPackages.compiler-rt: fix compiler-rt bootstrap on Darwin

The first build of compiler-rt in the LLVM bootstrap is build without
libc++ being available, which causes support for the `-g` flag to be
detected incorrectly on Darwin. Overriding the check by specifying that
it’s usable allows the first build of compiler-rt to succeed.
This commit is contained in:
Randy Eckenrode
2024-10-10 16:23:01 -04:00
parent 2fd9a1abeb
commit e6a4c83d20
@@ -136,6 +136,11 @@ stdenv.mkDerivation ({
"-DCOMPILER_RT_OS_DIR=baremetal"
] ++ lib.optionals (stdenv.hostPlatform.isDarwin) (lib.optionals (lib.versionAtLeast release_version "16") [
"-DCMAKE_LIPO=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}lipo"
] ++ lib.optionals (!haveLibcxx) [
# Darwin fails to detect that the compiler supports the `-g` flag when there is no libc++ during the
# compiler-rt bootstrap, which prevents compiler-rt from building. The `-g` flag is required by the
# Darwin support, so force it to be enabled during the first stage of the compiler-rt bootstrap.
"-DCOMPILER_RT_HAS_G_FLAG=ON"
] ++ [
"-DDARWIN_macosx_CACHED_SYSROOT=${apple-sdk'.sdkroot}"
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=${lib.versions.majorMinor (lib.getVersion apple-sdk)}"