Opened 2 months ago
Last modified 5 weeks ago
#6905 new defect
mozjs-91.13.1 build error on macOS 14 / Xcode 15
Reported by: | Thomas Nyman | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 27 |
Component: | Build & Packages | Keywords: | |
Cc: | Patch: |
Description
mozjs-91.13.1 fails to build on macOS 14 in unrecognized linker option at check for linker due to changes to ld64
linker in Xcode 15.
Tested on:
- macOS 14.3.1 23D60 arm64
- Xcode 15.2 15C500b
- Python 3.10.13
./libraries/osx/build-osx-libs
fails with:
checking for linker... DEBUG: Executing: `/usr/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -std=gnu99 --target=arm64-apple-darwin -Wl,--version` ERROR: Failed to find a linker ERROR: Error building spidermonkey
This is caused by the -Wl,--version
being passed to clang via ./libraries/source/spidermonkey/mozjs-91.13.1/build/moz.configure/toolchain.configure
. Since ld64
does not support the --version
option the linker check fails in the above error.
This is dealt with in the Homebrew formula for spidermonkey@91 by replacing the -Wl,--configure
toolchain.configure
with -Wl,-ld_classic,--version
(https://github.com/Homebrew/homebrew-core/blob/f643a74038b50d8d5ee4d3bbdd2641cc0617a40f/Formula/s/spidermonkey%4091.rb#L43).
The same approach seems applicable here (see attached patch-mozjs-configure.diff
).
Attachments (1)
Change History (2)
by , 2 months ago
Attachment: | patch-mozjs-configure.diff added |
---|
comment:1 by , 5 weeks ago
Thank you for the report.
Bearing in mind that we ideally wish to support versions of macOS prior to Sonoma, would you know if the proposed patch also works with earlier versions of XCode and/or macOS?
As the formula for spidermonkey[@115]
also has this approach, it seems likely that this is something that affects our attempt to transition to ESR102
in phab:D5002.
The Release Notes for XCode 15 have the following nugget:
A new linker has been written to significantly speed up static linking. It’s the default for all macOS, iOS, tvOS and visionOS binaries and anyone using the “Mergeable Libraries” feature. The classic linker can still be explicitly requested using
-ld64
, and will be removed in a future release.
From which we can take that this will become a bigger issue in the future...
Upstream (mozilla) has apparently got round this by changing the automatic linker detection to use lld
instead of ld64
on macOS when clang >= 15
(bug report; merged changeset).
I wonder if someone could try backporting this and verifying that it works on our version of spidermonkey?
(Although it is curious that as this should have made it into sm108
, the Homebrew formula for sm115
shouldn't need a workaround...)
Patch to libraries/source/spidermonkey/patch.sh that fixes the flags passed to ld64 during the check for linker