Uh oh!
There was an error while loading. Please reload this page.
build: add rust target for macOS cross compiles - #63015
Conversation
Tried a test build, but that failed due to the issue being addressed by #63006. I'll either need that to land and rebase this, or create another branch with that plus this to test. |
richardlau
commented
Apr 28, 2026
Trying with another branch with this PR and #63006: |
161a312 to
ff3dcccComparerichardlau
commented
Apr 28, 2026
Didn't work. |
richardlau
commented
Apr 28, 2026
|
richardlau
commented
Apr 29, 2026
So this suggests we need to add the x64 macOS rust target to the VMs similar to the arm64 Windows targets for the Windows machines in nodejs/build#4285. Further test builds have also errored with and that appears to be because if a target is set it changes the directory that the compiled library is written to, which was accounted for in #61806. However this PR isn't adapting the Windows solution because the way the pkg is currently compiled, under Rosetta the |
Uh oh!
There was an error while loading. Please reload this page.
When we build the macOS pkg, we build Node.js twice (on arm64): - Once for arm64 (native) - Once for x64, using a combination of Rosetta 2 and compiler flags before combining both into a universal binary. For the x64 case, pass target flag to `rustc` so that the binary is built for the correct target architecture. Signed-off-by: Richard Lau <richard.lau@ibm.com>
nodejs-github-bot
commented
Apr 29, 2026
nodejs-github-bot
commented
Apr 30, 2026
sxa
commented
Apr 30, 2026
Latest build from this branch with the addition of the x64 rust target succeeded at https://ci-release.nodejs.org/job/iojs+release/nodes=macos15-release-pkg/11740 and I've verified that temporal works in both architectures on the universal binary within the package :-) |
richardlau
commented
Apr 30, 2026
Marking this ready for review. |
sxa
left a comment
There was a problem hiding this comment.
LGTM although Memo to self; I'd like to look in the future at whether we could use STATIC_LIB_PREFIX/SUFFIX instead of hard coding it in here as that could simplify the logic (Maybe @StefanStojanovic knows?)
richardlau
commented
Apr 30, 2026
There is almost certainly room to streamline the logic across all platforms, but I've been just focussing on getting something to work with the minimal number of changes (to try to avoid breaking something else). As you say, we can revisit later on. |
Fast-track has been requested by @RafaelGSS. Please 👍 to approve. |
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Apr 30, 2026
Landed in 66054cc |
When we build the macOS pkg, we build Node.js twice (on arm64): - Once for arm64 (native) - Once for x64, using a combination of Rosetta 2 and compiler flags before combining both into a universal binary. For the x64 case, pass target flag to `rustc` so that the binary is built for the correct target architecture. Signed-off-by: Richard Lau <richard.lau@ibm.com> PR-URL: #63015 Reviewed-By: Stewart X Addison <sxa@redhat.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
When we build the macOS pkg, we build Node.js twice (on arm64):
before combining both into a universal binary.
For the x64 case, pass target flag to
rustcso that the binary is built for the correct target architecture.This is a "blind" attempt to address pkg build failures in the Node.js release CI -- I'm not a macOS user, nor do I have access to a macOS environment outside of the Node.js CI, so opening as a draft to test out.
It's quite possible that even if this is the "correct" fix, we'll need x64 rustc libraries installed on the release macOS VMs (CI run will indicate).