-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Consider gems under platform: :windows filter in Gemfile when running on Windows with ARM architecture
#8428
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
Consider gems under platform: :windows filter in Gemfile when running on Windows with ARM architecture
#8428
Conversation
9b72cb6 to
fb2a3c3
Compare
e896819 to
5d540ed
Compare
This comment was marked as spam.
This comment was marked as spam.
f6b85ee to
3ffa16a
Compare
I don't think any supported platform has these names, so the mapping should be unnecessary.
It's always going to be either the first or the second platform in the list so no need to keep an explicit list of all platforms.
I think they add unnecessary indirection and inconsistency to the specs.
For better debuggability.
We need to move platform monkeypatching to happen earlier because otherwise `Bundler::GemHelpers` will use the constants before they have actually been defined.
3ffa16a to
dd82a9a
Compare
Co-authored-by: Johnny Shields <johnny.shields@gmail.com>
dd82a9a to
96496e3
Compare
|
Hi David, this looks very good at first glance. Did you also see my other PR #8379? |
|
Look good to me. |
|
Thanks for having a look! I did read the description of #8379 and seems reasonable, but did not look into the implementation yet. I was hoping these changes would make getting that one ready easier. Do you mind rebasing that and adapting it to what I'm doing here? I can have a look next week if tests are still giving trouble. I will merge this one now. |
|
@deivid-rodriguez @ntkme @larskanis @MSP-Greg I just want to make sure we're all on the same page here. (Correct if wrong) it seems like after this change that:
I interpreted @ntkme's comment to mean that I think we need to ensure that:
If these conditions are all met today with test cases, then no issue :) |
| expect(generic(pl("x86-mingw32"))).to eq(pl("x86-mingw32")) | ||
| it "converts 32-bit mingw platform variants into universal-mingw" do | ||
| expect(generic(pl("i386-mingw32"))).to eq(pl("universal-mingw")) | ||
| expect(generic(pl("x86-mingw32"))).to eq(pl("universal-mingw")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Pending discussion above, I think 32-bit should not select
universal. - I also think we need a case that
x64-mingw-msvcrtdoes not selectuniversal-mingw, but does selectuniversal-mingw-msvcrt
|
I checked again and found that windows arm64 is super convoluted:
@deivid-rodriguez So this is somewhat messed up right now. Regarding ucrt being implicit, I think it’s not an issue unless someone manually build ruby >=3.1 with msvcrt because:
|
|
In other words:
|
|
RubyInstaller is only publishing native x64 and native aarch64. Currently, there is no ARM64EC or ARM64X RubyInstaller distribution, which means universal isn’t universal as of now - with the limited flavors of windows ruby distribution, ARM64EC DLL won’t not work anywhere, and ARM64X DLL only works on x64. For now what we need is just to have aarch64-mingw-ucrt treated as a supported platform, and native gem published with this exact platform can be installed. For example, sass-embedded gem has been publishing native aarch64-mingw-ucrt prebuilt since April 2024. |
|
@ntkme I agree the simplest for now is to just do separate builds of If we do go with
However, maybe all this is more trouble than it's worth, as just treating @larskanis ⬆️ |
Right, I was under the impression that arm64x works similar to how universal binary works on macOS. I was totally wrong about that. @deivid-rodriguez I think most of the changes in this PR still looks good, and perhaps we should just revert the |
|
From a RubyInstaller perspective neither
So IMHO #8378 is all that's needed. It adjusts In general I think |
|
Thank you for all your comments. I will review this as soon as possible and revert if necessary. |
|
Ok, so to clarify, this code does not change how RubyGems treats Windows platforms when choosing gem package variants for installation, it only changes the way To give an example, if But it will still select the most specific match for installation when available, so if a |
That's what this PR does. Except that if in the future any other mingw architecture becomes a thing, it will be automatically matched by |
platform: :windows filter in Gemfile when running on Windows under ARM architecture
platform: :windows filter in Gemfile when running on Windows under ARM architectureplatform: :windows filter in Gemfile when running on Windows with ARM architecture
|
@deivid-rodriguez thanks for the clarification, I took a second look and it should be good as-is. @larskanis and others please kindly test 🙇♂️ (And sorry for causing confusion here, the generic platform stuff tripped me up. Thank you everyone for the productive discussion on this thread, I learned quite a bit!) |
|
No, no need to apologize, the code base is pretty confusing in this area and we use the same terminology for completely different things at times. |
|
Thanks again. By the way, this PR basically achieves what I was intending to do in PR #8379. I added a few deprecations there which I can split out into a new PR. I was also thinking to make the generic platform as |
|
Yes, please do rework #8379 or split out the deprecations to a separate PR 👍. The idea of "universal-windows" sounds nice (it would fix this same issue for mswin on arm, right?), but it seems tricky to implement because currently |
|
…ws-support Support installing arm native gems on Windows (cherry picked from commit 969f320)
What was the end-user or developer problem that led to this PR?
Ruby now has arm64 support on Windows. However, the
:windowsvalue for theplatformoption in the Gemfile DSL doesn't select the gem when running on the new platform (aarch64-mingw-ucrt).What is your fix for the problem, implemented in this PR?
While reviewing the proposed fix in #8378, I noticed several issues in how Windows is currently handled, so I started introducing some improvements that I eventually extracted to this separate PR.
The main fix to support the new platform is 96496e3, which adds a new value to the list of Windows platforms that the
:windowsvalue matches, and changes the way the matching is done to useGem::Platform#===.Make sure the following tasks are checked