From 7fde47e1f381736fe412fdeb08334fc8ba40dcc9 Mon Sep 17 00:00:00 2001 From: Itms Date: Sat, 9 Aug 2025 08:51:55 +0200 Subject: [PATCH] Fix linker invocation on macOS Sequoia --- libraries/source/spidermonkey/build.sh | 2 +- .../spidermonkey/patches/FixMacOSBuild.diff | 20 +++++++++++++++++-- .../source/spidermonkey/patches/patch.sh | 1 + 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libraries/source/spidermonkey/build.sh b/libraries/source/spidermonkey/build.sh index cc6a2624b0..7c71a7bc90 100755 --- a/libraries/source/spidermonkey/build.sh +++ b/libraries/source/spidermonkey/build.sh @@ -9,7 +9,7 @@ cd "$(dirname "$0")" PV=128.13.0 FOLDER="mozjs-${PV}" # If same-version changes are needed, increment this. -LIB_VERSION="${PV}+wfg1" +LIB_VERSION="${PV}+wfg2" LIB_NAME="mozjs128" build_archive() diff --git a/libraries/source/spidermonkey/patches/FixMacOSBuild.diff b/libraries/source/spidermonkey/patches/FixMacOSBuild.diff index a2be435c32..c974deab52 100644 --- a/libraries/source/spidermonkey/patches/FixMacOSBuild.diff +++ b/libraries/source/spidermonkey/patches/FixMacOSBuild.diff @@ -1,5 +1,4 @@ diff --git a/build/moz.configure/pkg.configure b/build/moz.configure/pkg.configure -index 418331b87..65a20b17b 100644 --- a/build/moz.configure/pkg.configure +++ b/build/moz.configure/pkg.configure @@ -12,7 +12,7 @@ def pkg_config(prefixes): @@ -12,7 +11,6 @@ index 418331b87..65a20b17b 100644 pkg_config = check_prog( diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure -index 264027e57..e1b3cfabd 100644 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -100,7 +100,7 @@ with only_when(host_is_osx | target_is_osx): @@ -33,3 +31,21 @@ index 264027e57..e1b3cfabd 100644 cmd_base = c_compiler.wrapper + [c_compiler.compiler] + c_compiler.flags def try_linker(linker): +@@ -1906,7 +1906,16 @@ def select_linker_tmpl(host_or_target): + kind = "ld64" + + elif retcode != 0: +- return None ++ # macOS 15 fallback: try `-Wl,-v` if --version failed ++ if target.kernel == "Darwin": ++ fallback_cmd = cmd_base + linker_flag + ["-Wl,-v"] ++ retcode2, stdout2, stderr2 = get_cmd_output(*fallback_cmd, env=env) ++ if retcode2 == 0 and "@(#)PROGRAM:ld" in stderr2: ++ kind = "ld64" ++ else: ++ return None ++ else: ++ return None + + elif "mold" in stdout: + kind = "mold" diff --git a/libraries/source/spidermonkey/patches/patch.sh b/libraries/source/spidermonkey/patches/patch.sh index fe527a8c31..201a8a800a 100755 --- a/libraries/source/spidermonkey/patches/patch.sh +++ b/libraries/source/spidermonkey/patches/patch.sh @@ -36,6 +36,7 @@ fi # - Allow use of pkg-config to use the same zlib for SM and pyrogenesis (https://bugzilla.mozilla.org/show_bug.cgi?id=1783570) # - Force allowing build with older macOS SDK # - Fix invocation of recent compiler (https://bugzilla.mozilla.org/show_bug.cgi?id=1844694) +# - Fix linker selection on macOS 15 (https://bugzilla.mozilla.org/show_bug.cgi?id=1964280) if [ "${OS}" = "Darwin" ]; then patch -p1 <"${PATCHES}"/FixMacOSBuild.diff fi