Skip to content

Cross-compilation bug when compiling for ARM64 on a non-ARM64 host with Windows #52664

Description

@mahdisharifithedev

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 

Activity

  1. added
    buildIssues and PRs related to Node.js builds or CI infrastructure.
    on Apr 24, 2024
  2. added
    windowsIssues and PRs related to the Windows platform.
    on Apr 24, 2024
  3. richardlau commented on Apr 24, 2024

    @richardlau
    Member

    cc @nodejs/platform-windows-arm

  4. StefanStojanovic commented on Apr 26, 2024

    @StefanStojanovic
    Contributor

    I've investigated this and can confirm the behavior. The issue is that the project used for generating the DLL gen_node_def is not compiled for the host architecture but for the target one. That is why there is no gen_node_def_host.exe. gen_node_def.exe does 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.

  5. joyeecheung commented on Feb 2, 2026

    @joyeecheung
    Member

    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.

  6. github-actions commented on Jul 20, 2026

    @github-actions
    Contributor

    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.

  7. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to Node.js builds or CI infrastructure.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions