From f8a28f990a8ec421cbda2a4f55ec587f27d5d2b4 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 25 May 2023 01:49:06 +0000 Subject: [PATCH] Bug 1834678 - Change the llvm-config trick for cross-compilation. r=gfx-reviewers,gw Contrary to ld64, lld doesn't ignore libraries it's given on the command line, and -lLLVM-14 ends up as a link error when using lld. So instead of relying on the flags llvm-config outputs to be kind of ignored, we replace them at the source by wrapping llvm-config itself. Differential Revision: https://phabricator.services.mozilla.com/D178900 --- gfx/wr/ci-scripts/etc/wr-darwin.meson | 12 +----------- .../scripts/misc/wr-macos-cross-build-setup.sh | 5 ++++- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/gfx/wr/ci-scripts/etc/wr-darwin.meson b/gfx/wr/ci-scripts/etc/wr-darwin.meson index 54499822254f..e6efc7deb13f 100644 --- a/gfx/wr/ci-scripts/etc/wr-darwin.meson +++ b/gfx/wr/ci-scripts/etc/wr-darwin.meson @@ -1,15 +1,5 @@ [binaries] -llvm-config = '/builds/worker/fetches/clang/bin/llvm-config' - -[properties] -# When linking `libOSMesa.dylib` Meson uses options provided by `llvm-config`. -# The binary for `llvm-config` in Firefox CI comes from a native Linux clang, -# which gives the link options for the Linux libLLVM-11.so in the Linux clang. -# However, we want to link against a native macOS clang's libLLVM.dylib, which -# we have available in a separate directory. -# Meson will still have -lLLVM-11 on the command line, but the linker will -# only warn that it has the wrong format (because it's not for macOS). -cpp_link_args = ['-L/builds/worker/fetches/clang-mac/clang/lib', '-lLLVM'] +llvm-config = '/builds/worker/fetches/clang-mac/clang/bin/llvm-config' [host_machine] system = 'darwin' diff --git a/taskcluster/scripts/misc/wr-macos-cross-build-setup.sh b/taskcluster/scripts/misc/wr-macos-cross-build-setup.sh index 4edba33e5e14..faca8d2142ea 100755 --- a/taskcluster/scripts/misc/wr-macos-cross-build-setup.sh +++ b/taskcluster/scripts/misc/wr-macos-cross-build-setup.sh @@ -29,7 +29,10 @@ END_PKGCONFIG_WRAPPER chmod +x "${TARGET_TRIPLE}-pkg-config" popd -export PATH="${MOZ_FETCHES_DIR}/rustc/bin:${MOZ_FETCHES_DIR}/cctools/bin:${MOZ_FETCHES_DIR}/clang/bin:${MOZ_FETCHES_DIR}/wrench-deps/meson:${PATH}" +[ -d "${MOZ_FETCHES_DIR}/clang-mac/clang" ] && cat > ${MOZ_FETCHES_DIR}/clang-mac/clang/bin/llvm-config <