Skip to content

Support windows-11-arm #750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2025
Merged

Support windows-11-arm #750

merged 1 commit into from
Apr 26, 2025

Conversation

ntkme
Copy link
Contributor

@ntkme ntkme commented Apr 18, 2025

GitHub Actions recently added new windows-11-arm runner for OSS: https://github.blog/changelog/2025-04-14-windows-arm64-hosted-runners-now-available-in-public-preview/

This PR and the following adds support for windows-11-arm:

@ntkme
Copy link
Contributor Author

ntkme commented Apr 18, 2025

The RubyInstaller-Devkit package consists of the LLVM based C and C++ compilers which run natively on ARM. This makes the package almost twice as big than the x64/x86 versions. In contrast the MSYS2 toolset, which provides Unix tools like make and bash, is not yet ported to ARM. It is delivered as x64 code, running on the Prism emulator of Windows-11. That’s why only the RubyInstaller version without Devkit will work on Windows-10.

setup-ruby does not use devkit from rubyinstaller so we will have to replicate a similar setup with https://github.com/ruby/setup-msys2-gcc.

@MSP-Greg @larskanis I can start working on a PR for that, but I'd like to hear your thoughts.

@ntkme ntkme force-pushed the windows-11-arm branch 2 times, most recently from 665568a to b3570f7 Compare April 18, 2025 18:36
@larskanis
Copy link
Contributor

Thanks to notify me about the new Windows on ARM64 runners!

setup-ruby does not use devkit from rubyinstaller so we will have to replicate a similar setup with https://github.com/ruby/setup-msys2-gcc.

This shouldn't be too difficult. Since the same MSYS2 x64 executables are used on arm64 as on x64, the msys2.7z file should be reusable. Only the clangarm64 environment needs to be packaged into a 7z file equal to the mingw64 and ucrt64 environments. I think packaging these clangarm64 files should even work on a x64 host. See https://www.msys2.org/wiki/arm64/

There is no need to select distinct packages regarding gcc on x64 and clang on arm64. The gcc packages are wrappers for the corresponding clang packages on arm64, so that the same package list can be installed per pacman. Only the different prefix mingw-w64-clang-aarch64 vs. mingw-w64-ucrt-x86_64 has to be respected. That's why the rubyinstaller package list didn't change with the introduction of WoA.

@ntkme
Copy link
Contributor Author

ntkme commented Apr 18, 2025

I think packaging these clangarm64 files should even work on a x64 host.

Not that easy. The way setup-msys2-gcc works today is that it uses the C:/msys64 preinstalled on the x64 windows runner, and only pack the "difference" to create a minimal package for these runner. However, the windows-11-arm runner does not have C:/msys64 preinstalled, so an "incremental" package simply won't work because all the base files are missing. We will have to provide two different packages, the existing "incremental" package for x64 and a new "complete" package for arm64. Currently testing that in my own fork.

@ntkme ntkme changed the title [DRAFT] Support windows-11-arm Support windows-11-arm Apr 19, 2025
@ntkme ntkme marked this pull request as ready for review April 19, 2025 06:24
@ntkme
Copy link
Contributor Author

ntkme commented Apr 21, 2025

This PR is ready for review. The tests are failing because other linked PRs are required. Also there is a chicken-and-egg problem with this PR and ruby/setup-msys2-gcc#21, which has a few ways to get worked around.

The ways I get it solved in my own forks is that:

  1. Use setup-ruby and setup-msys2-gcc changes as is to first generate the msys2 package for windows-11-arm. At this stage the clangarm64 gcc package will fail, but we will get a working msys2-windows-11-arm package.
  2. Use the setup-ruby change, but slightly modify it to skip the gcc setup only on windows-11-arm. - This allows us to build clangarm64 gcc package.
  3. Now we have a working state with both msys2-windows-11-arm and clangarm64 gcc.

@eregon
Copy link
Member

eregon commented Apr 24, 2025

However, the windows-11-arm runner does not have C:/msys64 preinstalled

And there is no plan to add it by GitHub?

Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, but of course we'll need to wait that the related PRs are ready and approved as well

@ntkme
Copy link
Contributor Author

ntkme commented Apr 24, 2025

And there is no plan to add it by GitHub?

It's documented here: https://github.com/actions/partner-runner-images/blob/main/images/arm-windows-11-image.md#omitted-software - I think this essentially means they don't plan to add it.

@eregon
Copy link
Member

eregon commented Apr 24, 2025

It seems worth asking (via issue/discussion) or searching issues, that list includes things that probably don't exist on windows-arm64, but MSYS2 does work there so not clear why it's not included to me.

@ntkme
Copy link
Contributor Author

ntkme commented Apr 24, 2025

It seems worth asking (via issue/discussion) or searching issues, that list includes things that probably don't exist on windows-arm64, but MSYS2 does work there so not clear why it's not included to me.

actions/partner-runner-images#88

Someone already asked, and it looks like they don't like the fact that msys2 for windows arm64 has hybird x64 emulation and arm64 native...

@ntkme ntkme force-pushed the windows-11-arm branch 2 times, most recently from ed9deb9 to e265e38 Compare April 24, 2025 20:16
@ntkme
Copy link
Contributor Author

ntkme commented Apr 24, 2025

I added a commit in this PR to address the circular dependency on this PR and ruby/setup-msys2-gcc#21.

The plan of action is:

  1. Merge this PR as is. Two tests will fail temporarily.
  2. Merge Support clangarm64 environment setup-msys2-gcc#21. Wait for build to complete.
  3. Revert the commit Temporarily disable installGCCTools on windows arm64 to solve chicken-and-egg issue. Test will pass.

@ntkme ntkme force-pushed the windows-11-arm branch 3 times, most recently from db3f7fa to 655c29d Compare April 25, 2025 10:27
@MSP-Greg
Copy link
Collaborator

MSP-Greg commented Apr 25, 2025

@ntkme

Today I added PR's to my forks of setup-ruby and setup-msys2-gcc, and generated the two 7z files needed for arm64.

So, they now exist in the ruby/setup-msys2-gcc release.

You should be able to remove the 'Temporarily disable installGCCTools' commit and CI should pass, as it did in my fork.

After this is accepted, we can switch the 'setup-msys2-gcc' PR back to using ruby/setup-ruby.

Thanks again,

Greg

@ntkme
Copy link
Contributor Author

ntkme commented Apr 25, 2025

You should be able to remove the 'Temporarily disable installGCCTools' commit and CI should pass, as it did in my fork.

Thanks, this greatly simplifies the operation here.

After this is accepted, we can switch the 'setup-msys2-gcc' PR back to using ruby/setup-ruby.

That PR is already using ruby/setup-ruby as I found out that I can do the workaround in this PR to disable the gcc setup... But now you have uploaded the achieve needed, no workaround is needed anymore, except for that this PR to be merged before the 'setup-msys2-gcc' PR.

Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all your work on this!

@eregon eregon merged commit dffc446 into ruby:master Apr 26, 2025
208 checks passed
@ntkme ntkme deleted the windows-11-arm branch April 26, 2025 15:56
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.

Request: Support Windows on Arm64
4 participants