Cross-compilation bug when compiling for ARM64 on a non-ARM64 host with WindowsΒ #52664
Copy link
Copy link
Closed
Labels
buildIssues and PRs related to Node.js builds or CI infrastructure.Issues and PRs related to Node.js builds or CI infrastructure.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Description
Version
v21.7.3
Platform
Microsoft Windows NT 10.0.20348.0 x64
What steps will reproduce the bug?
Cross-compiling for Windows ARM64 on a Windows x86_64 machine.
What is the expected behavior? Why is that the expected behavior?
Should compile.
What do you see instead?
Here's the log:
--snip--
NodeWorker.cpp
NodeTracing.cpp
NodeRuntime.cpp
Creating library out\Release\libnode.lib and object out\Release\libnode.exp
libnode.vcxproj -> out\Release\\libnode.dll
generate_node_def_action
'"out\Release\gen_node_def_host.exe"' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'out\Release\\libnode.dll' exited with code 1. [D:\a\github\node\generate_node_def.vcxproj]
Additional information
Compiling as a shared library with:
.\vcbuild.bat arm64 dll Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
buildIssues and PRs related to Node.js builds or CI infrastructure.Issues and PRs related to Node.js builds or CI infrastructure.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Activity
richardlau commentedon Apr 24, 2024
cc @nodejs/platform-windows-arm
StefanStojanovic commentedon Apr 26, 2024
I've investigated this and can confirm the behavior. The issue is that the project used for generating the DLL
gen_node_defis not compiled for the host architecture but for the target one. That is why there is nogen_node_def_host.exe.gen_node_def.exedoes exist but cannot be executed on an x64 machine since it is built for ARM64.By the looks of things, this never worked but is caught just now.
joyeecheung commentedon Feb 2, 2026
FWIW I ran into something similar too but my situation is a bit funnier - I accidentally built with the x64 host toolchain on ARM64 Windows (because the Python installer currently installs x64 Python on ARM64 Windows until Python's ARM64 Windows support is stable), while I could run the x64 gen_node_def_host.exe on ARM64 with emulation, it couldn't load the ARM64 DLL either. After I fix the Python issue to stop the unnecessary cross compiling ARM64 gen_node_def.exe does work though. So my understanding is that no only the build files are broken, the tool itself might also need fix up for cross-compilation too.
github-actions commentedon Jul 20, 2026
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
build,tools: fix shared library cross-compile
build,tools: fix shared library cross-compile
build,tools: fix shared library cross-compile
build,tools: fix shared library cross-compile
build,tools: fix shared library cross-compile
build,tools: fix shared library cross-compile
build,tools: fix shared library cross-compile