GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Adding cross-compilation support for Windows on Arm · Issue #32582 · nodejs/node

Adding cross-compilation support for Windows on Arm #32582

New issue
Copy link
New issue
Copy link
Closed
Closed
Adding cross-compilation support for Windows on Arm#32582
Copy link
Labels
armIssues and PRs related to the ARM architecture.buildIssues and PRs related to Node.js builds or CI infrastructure.windowsIssues and PRs related to the Windows platform.

Description

@richard-townsend-arm
richard-townsend-arm
opened on Mar 31, 2020
Issue body actions

Is your feature request related to a problem? Please describe.
Follow on #25998 (Support ARM64 Windows Desktop).

The current solution to build for Windows on Arm is to build on the device itself due to host-only tools (e.g. mksnapshot) in the build process. Catch is that because Microsoft have not (yet) released a native toolchain for Windows on Arm, building Node.js is hard because you have to use an x86 toolchain running under emulation, which is slow and bumps up against 32-bit memory limitations. As a result, the Windows on Arm build has bit-rotted and doesn't currently build out of the box.

Describe the solution you'd like
To make Windows on Arm easier to support, I'd like to add cross-compilation support to node-gyp and teach Node.js' build system how to cross-compile for Arm. GYP already makes the distinction between host and target, so the idea is to generate two versions of some projects:
image

Each host target is renamed to produce a _host.exe. Each action is then re-written to call the _host.exe version, so e.g. actions which involve mksnapshot.exe are fixed up to call mksnapshot_host.exe instead. These host-only targets need to be built for x64, so we introduce a host-only node_host.sln which is built first. Then, node.sln (which contains both host and target projects) is built for ARM64. I'd also like to backport some recent V8 changes which fix support for MSVC (Microsoft's compiler) on Arm systems.

Describe alternatives you've considered
Some possible alternatives are:

  • Continue trying to build on-device connecting devices to Node.js' build infrastructure.
  • Continue trying to build on-device using a pre-built, native Clang toolchain.

The second option is quite viable, but risks introducing ABI issues for native modules and would still require changes to node-gyp.

CC @jkunkee, @refack, if you're happy with the general outline of this approach, I'll clean up my patches, get them through internal review and open some PRs.

Reacted by Dennis Ameling
Reacted by Phạm Won

Activity

  1. richardlau commented on Mar 31, 2020

    @richardlau
    richardlau
    on Mar 31, 2020
    Member
    More actions

    cc @joaocgreis

  2. bnoordhuis commented on Apr 1, 2020

    @bnoordhuis
    bnoordhuis
    on Apr 1, 2020
    Member
    More actions

    How do you plan to actually run mksnapshot? You're calling it host-only but it's not: it needs to run on the target to create the snapshot.

    V8's native GN build has some support for cross-compiling but it does so by running mksnapshot in an emulator (qemu-user, which only works on linux.)

  3. richard-townsend-arm commented on Apr 1, 2020

    @richard-townsend-arm
    richard-townsend-arm
    on Apr 1, 2020
    ContributorAuthor
    More actions

    Not sure how recently the situation changed, but V8's native mksnapshot does support cross-compilation for Arm targets. QEMU is currently used AFAICT only for MIPS-based platforms.

  4. jkunkee commented on Apr 1, 2020

    @jkunkee
    jkunkee
    on Apr 1, 2020
    Contributor
    More actions

    Yes, mksnapshot does support running on one platform to generate a snapshot for another platform. The limitation here is GYP's inability to support generating projects targeting the build host instead of the build target.

  5. joaocgreis commented on Apr 6, 2020

    @joaocgreis
    joaocgreis
    on Apr 6, 2020
    Member
    More actions

    @richard-townsend-arm happy to see this moving forward!

    We already cross-compile for Linux ARM from Linux x86. The main changes for doing that are using a compiler with support for the target (https://github.com/rvagg/rpi-newer-crosstools.git) and setting the CC and CXX variables: https://github.com/nodejs/build/blob/050fb9733697acb3dd5bb53891c2818e2c335bab/ansible/roles/cross-compiler/files/cc-selector.sh#L55-L58 . It would be good if the process for Windows was similar to that, but we'll take what we can get.

  6. bzoz
    added a commit that references this issue on Jun 9, 2020

    win,msi: add arm64 config for windows msi

    35871c3
  7. codebytere
    added a commit that references this issue on Jun 18, 2020

    win,msi: add arm64 config for windows msi

    3520a13
  8. codebytere
    added a commit that references this issue on Jun 30, 2020

    win,msi: add arm64 config for windows msi

    1da3baa
  9. codebytere
    added 2 commits that reference this issue on Jul 10, 2020

    win,msi: add arm64 config for windows msi

    4388dad

    win,msi: add arm64 config for windows msi

    7ee0b30
  10. joaocgreis
    added a commit that references this issue on Aug 19, 2020

    build,win: use x64 Node when building for ARM64

    03293aa
  11. BethGriggs
    added 2 commits that reference this issue on Aug 20, 2020

    build,win: use x64 Node when building for ARM64

    6720624

    build,win: use x64 Node when building for ARM64

    6048421
  12. gengjiawen commented on Oct 8, 2020

    @gengjiawen
    gengjiawen
    on Oct 8, 2020
    Member
    More actions

    Not sure how recently the situation changed, but V8's native mksnapshot does support cross-compilation for Arm targets. QEMU is currently used AFAICT only for MIPS-based platforms.

    The tricky thing is that qemu doesn't run windows. This also make testing the build hard.

  13. targos
    added
    armIssues and PRs related to the ARM architecture.
    windowsIssues and PRs related to the Windows platform.
    buildIssues and PRs related to Node.js builds or CI infrastructure.
    on Dec 27, 2020
  14. StefanStojanovic commented on Jul 25, 2024

    @StefanStojanovic
    StefanStojanovic
    on Jul 25, 2024
    Contributor
    More actions

    Cross-compilation to Windows on ARM was enabled some time ago and Windows ARM64 binaries are now a part of the official Node.js release. Closing the issue.

  15. StefanStojanovic
    closed this as completedon Jul 25, 2024
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

    armIssues and PRs related to the ARM architecture.buildIssues and PRs related to Node.js builds or CI infrastructure.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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.