ckerr

#54016: build: fix native addon cross-compilation

Merged
Created: Sep 16, 2026, 5:56:22 PM
Merged: Sep 16, 2026, 8:47:19 PM
5 comments
Target: main

Description of Change

Linux ARM64 cross-builds fail while rebuilding the object-wrap test addon: the linker reports that the target libc++ archives are incompatible with elf64-x86-64.

The addon toolchain introduced in #53390 selects Chromium clang and the target build's libc++ libraries but supplies no cross-compilation target or sysroot. npm_config_arch=arm64 configures node-gyp, not clang, so the compiler and linker still default to x64 on an x64 worker.

Pass the requested target triple and Electron sysroot to C/C++ compilation and linking, preserving caller flags and reporting missing cross sysroots explicitly.

Related to #53390.

CC @deepak1556 @MarshallOfSound as reviewers/stakeholders of 53390.
CC @mlaurencin as downstream stakeholder

Validation

  • Focused Node checks against the actual helper cover the original missing-target behavior, four cross targets, caller flags, native equivalence without overrides, environment-variable casing, compiler fallbacks, optional libc++abi, and missing-sysroot errors.
  • Chromium clang -### confirms target and sysroot forwarding for ARM64, ARM, ia32, and x64 compilation and linking. This is print-only validation, not a successful cross-build.
  • Scoped JavaScript lint, formatting, whitespace checks, and pre-commit hooks pass.
  • The affected helper is identical on current 42-x-y, 43-x-y, 44-x-y, and 45-x-y; the patch applies cleanly to all four, matching #53390's backport coverage.
  • Full ARM64 compile/link and runtime tests were not run: the local checkout lacks the ARM64 sysroot and target build artifacts.

Checklist

Release Notes

Notes: none

Backports

42-x-y
Merged
PR Number
#54020
Merged At
Sep 16, 2026, 10:11:02 PM
Released In
Not yet
Release Date
Not yet
43-x-y
Merged
PR Number
#54019
Merged At
Sep 16, 2026, 10:11:05 PM
Released In
Not yet
Release Date
Not yet
44-x-y
Merged
PR Number
#54018
Merged At
Sep 16, 2026, 10:11:07 PM
Released In
Not yet
Release Date
Not yet
45-x-y
Merged
PR Number
#54017
Merged At
Sep 16, 2026, 10:11:11 PM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron