Skip to content

build: derive NODE_ARCH from target_cpu in the GN build - #65491

Open
codebytere wants to merge 1 commit into
nodejs:mainfrom
codebytere:build/gn-node-arch-target-cpu
Open

build: derive NODE_ARCH from target_cpu in the GN build#65491
codebytere wants to merge 1 commit into
nodejs:mainfrom
codebytere:build/gn-node-arch-target-cpu

Conversation

@codebytere

@codebytere codebytere commented Aug 22, 2026

Copy link
Copy Markdown
Member

unofficial.gni special-cases ia32 on current_cpu == "x86" while every other architecture uses target_cpu. When node is also compiled in a host toolchain of a cross build (e.g. node_mksnapshot running in V8's snapshot toolchain, which is x86-hosted for 32-bit arm targets), current_cpu is the host's, so NODE_ARCH becomes "ia32" for an arm-targeted build and process.arch deserializes as 'ia32' on the device. This keys the special case off target_cpu like the rest of the block. GN build only; the gyp build is untouched. Seen in Electron's arm builds: electron/electron#52959.

Refs: electron/electron#52959


Disclosure: the code and this description were written by Claude Code, directed and reviewed by @codebytere.

unofficial.gni special-cased ia32 on current_cpu while every other
architecture used target_cpu. When node is also compiled in a host
toolchain of a cross build (for example node_mksnapshot running in
V8's snapshot toolchain, which is x86-hosted for 32-bit arm targets),
current_cpu is the host's, so NODE_ARCH became "ia32" for an
arm-targeted build and process.arch deserialized as 'ia32' on the
device. Key the special case off target_cpu like the rest.

Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com>
@codebytere
codebytere requested a review from jasnell August 22, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant