Skip to content

build: fix native addon cross-compilation - #54016

Merged
MarshallOfSound merged 1 commit into
mainfrom
fix/native-addon-cross-compilation
Sep 17, 2026
Merged

MarshallOfSound merged 1 commit into
mainfrom
fix/native-addon-cross-compilation

Conversation

@ckerr

@ckerr ckerr commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

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 fix: backport Node.js cleanup hook fixes for node::ObjectWrap addons #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

Linux ARM64 addon rebuilds use host clang with target libc++ libraries.
Pass the target triple and sysroot to both compiler and linker.
Related: #53390

Assisted-By: GitHub Copilot
@ckerr ckerr added target/42-x-y PR should also be added to the "42-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Sep 16, 2026
@MarshallOfSound
MarshallOfSound merged commit c7222c5 into main Sep 17, 2026
113 checks passed
@release-clerk

release-clerk Bot commented Sep 17, 2026

Copy link
Copy Markdown

No Release Notes

@trop

trop Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #54017

@trop

trop Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #54018

@trop

trop Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "43-x-y", please check out #54019

@trop trop Bot added in-flight/44-x-y in-flight/43-x-y and removed target/45-x-y PR should also be added to the "45-x-y" branch. labels Sep 17, 2026
@trop

trop Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "42-x-y", please check out #54020

@trop trop Bot added in-flight/42-x-y merged/42-x-y PR was merged to the "42-x-y" branch. and removed target/44-x-y PR should also be added to the "44-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. in-flight/42-x-y in-flight/43-x-y labels Sep 17, 2026
@trop trop Bot added merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. and removed in-flight/44-x-y in-flight/45-x-y labels Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. semver/none

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants