diff --git a/build/runner/src/bundle/binary.rs b/build/runner/src/bundle/binary.rs index 5d3d6cc94..f16728069 100644 --- a/build/runner/src/bundle/binary.rs +++ b/build/runner/src/bundle/binary.rs @@ -3,7 +3,9 @@ use std::process::Command; +use anki_process::CommandExt; use camino::Utf8Path; +use camino::Utf8PathBuf; use super::artifacts::macos_deployment_target; use crate::run::run_command; @@ -37,5 +39,14 @@ pub fn build_bundle_binary() { ) .env("MACOSX_DEPLOYMENT_TARGET", macos_deployment_target()) .env("CARGO_BUILD_TARGET", env!("TARGET")); + if env!("TARGET") == "x86_64-apple-darwin" { + let xcode_path = Command::run_with_output(["xcode-select", "-p"]).unwrap(); + let ld_classic = Utf8PathBuf::from(xcode_path.stdout.trim()) + .join("Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-classic"); + if ld_classic.exists() { + // work around XCode 15's default linker not supporting macOS 10.15-12. + command.env("RUSTFLAGS", &format!("-Clink-arg=-fuse-ld={ld_classic}")); + } + } run_command(&mut command); }