Skip to content

build: separate host and target Rust artifacts in cross builds - #66823

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
inoway46:build-rust-cross-targets
Nov 9, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
inoway46:build-rust-cross-targets

Conversation

@inoway46

@inoway46 inoway46 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Bundled Temporal cross builds use a single Rust archive path for both host and target tools, so neither toolset links a matching archive.

This passes explicit Rust target triples to Cargo and builds each toolset into its own output directory:

  • target: CARGO_BUILD_TARGET (or the existing macOS x64 default)
  • host: the rustc -vV host triple, or its i686 counterpart for 32-bit host tools (CC_host="gcc -m32")

If the triples cannot be determined, Temporal support is disabled with a warning, or configure fails when --v8-enable-temporal-support is passed.

Verified with AArch64, RISC-V, and ARMv7 Make cross builds: the original failure reproduces before this change, and both archives link and run after it.

Fixes: #66897
Refs: #66803

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/build
  • @nodejs/gyp
  • @nodejs/inspector
  • @nodejs/security-wg
  • @nodejs/tsc
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Oct 18, 2026
@inoway46

This comment was marked as outdated.

@inoway46

This comment was marked as outdated.

@inoway46
inoway46 force-pushed the build-rust-cross-targets branch from 19c9345 to 5ff420e Compare October 21, 2026 12:01
@inoway46
inoway46 marked this pull request as ready for review October 21, 2026 12:34
@inoway46

This comment was marked as resolved.

@inoway46
inoway46 force-pushed the build-rust-cross-targets branch from 5ff420e to 6555d9d Compare October 22, 2026 02:13
@inoway46
inoway46 marked this pull request as draft November 1, 2026 09:08
@inoway46
inoway46 force-pushed the build-rust-cross-targets branch 3 times, most recently from 815dcae to 7378d07 Compare November 2, 2026 09:43
@inoway46
inoway46 marked this pull request as ready for review November 2, 2026 10:12
@inoway46
inoway46 force-pushed the build-rust-cross-targets branch 2 times, most recently from 6478586 to 07ea604 Compare November 6, 2026 06:54
Capture the Rust target and host triples during configure for bundled
Temporal cross builds. Use explicit Cargo targets and separate output
directories so host and target archives do not share a build rule.

If the triples cannot be determined, disable Temporal with a warning
unless it was explicitly enabled.

Fixes: nodejs#66897
Refs: nodejs#66803
Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
@legendecas

Copy link
Copy Markdown
Member

Triggering CI to verify cross compile: https://ci.nodejs.org/job/node-test-pull-request/78929/

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@legendecas legendecas added build Issues and PRs related to Node.js builds or CI infrastructure. author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. labels Nov 9, 2026
@nodejs-github-bot
nodejs-github-bot merged commit eb3ae47 into nodejs:main Nov 9, 2026
69 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in eb3ae47

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 9, 2026
aduh95 pushed a commit that referenced this pull request Nov 11, 2026
Capture the Rust target and host triples during configure for bundled
Temporal cross builds. Use explicit Cargo targets and separate output
directories so host and target archives do not share a build rule.

If the triples cannot be determined, disable Temporal with a warning
unless it was explicitly enabled.

Fixes: #66897
Refs: #66803
Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: #66823
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
aduh95 pushed a commit that referenced this pull request Nov 12, 2026
Capture the Rust target and host triples during configure for bundled
Temporal cross builds. Use explicit Cargo targets and separate output
directories so host and target archives do not share a build rule.

If the triples cannot be determined, disable Temporal with a warning
unless it was explicitly enabled.

Fixes: #66897
Refs: #66803
Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: #66823
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
aduh95 pushed a commit that referenced this pull request Nov 12, 2026
Capture the Rust target and host triples during configure for bundled
Temporal cross builds. Use explicit Cargo targets and separate output
directories so host and target archives do not share a build rule.

If the triples cannot be determined, disable Temporal with a warning
unless it was explicitly enabled.

Fixes: #66897
Refs: #66803
Assisted-by: Codex
Signed-off-by: inoway46 <inoueyuya416@gmail.com>
PR-URL: #66823
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
wszgrcy added a commit to wszgrcy/GodotJS-Dependencies that referenced this pull request Nov 18, 2026
The macOS x86_64 bundle failed its own link check: ld ignored every Rust object with
"found architecture 'arm64', required architecture 'x86_64'", so Temporal's symbols
were missing. The build was fine - x86_64-apple-darwin objects were built, and the
node link used them. Packaging copied the wrong file.

A cross build keeps two copies of some archives. Node's per-toolset Rust change
(nodejs/node#66823, which we apply) builds the Temporal crate once per toolset into
gen/cargo/host/... and gen/cargo/target/..., and host-toolset output in general sits
under gen.host / obj.host. copy_fat searched by name and took the first hit, which on
that layout is the arm64 crate - it went into macos.x86_64.release and the failure
surfaced in a later step that had nothing to do with packaging.

package_node.sh now:
  locate_archive  lists every file with that name, puts the ones that look like
                  host-toolset output last, and where the machine can tell (lipo,
                  so macOS) picks the copy that actually holds the architecture
                  being packaged. The candidate list and the winner are printed,
                  because a CI log is the only place this can be read afterwards.
  arch_state      reads lipo's answer for the architecture part only, so a path
                  containing "macos.x86_64.release" cannot make an arm64 archive
                  look correct. Unknown arch names, missing lipo, and archives lipo
                  cannot read are all left alone rather than guessed at.
  check_arch      the copied file still has to hold that architecture; if it does
                  not, packaging stops and says which copy was taken.
  The per-archive log line now names the source path instead of the bare name.

Release asset names are one shape now. The build directory is macos.arm64.release
but windows_x86_64_release, so the files came out as node_..._macos.arm64.tar.zst
next to node_..._windows_x86_64.tar.zst; dots become underscores, so every asset is
node_<version>_<platform>_<arch>.tar.zst in both workflow files.

Verified: 20 checks in a stand-in tree (crate taken from the target toolset, gen.host
loses to obj, a name that exists only in gen.host is still found, a missing name
still fails, the log lists candidates and names the winner without leaking into the
path, lipo answers read as expected for thin/fat/unreadable archives, the path
mentioning x86_64 does not excuse arm64 objects, and with a lipo stand-in the
architecture overrules the file-name guess in both directions). Linux packaging of
the real tree is byte-identical to the bundle made before this change, including
manifest and all 37 archives, and the log now shows the source path of each. Both
workflow files parse as YAML, every step passes bash -n, and build_all's packaging
step run as extracted turns macos.arm64.release and linux_x86_64_release into
node_26.13.1_macos_arm64.tar.zst and node_26.13.1_linux_x86_64.tar.zst.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. build Issues and PRs related to Node.js builds or CI infrastructure. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build: Temporal cross builds do not separate host and target Rust archives

3 participants