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
Backport non gnu libc linux support from RubyGems #4488
Backport non gnu libc linux support from RubyGems #4488
Conversation
So, this is WIP: previous work + messy I did it TDD/BDD by adding rubygems and bundler tests that make sense WRT the behaviour, and made them pass. There's still some strange behaviour that I hacked in/out, so I'm not entirely sure I did not create breakage at this stage on other platforms. I also saw some strange things I can't seem to wrap my head around: most likely I'm missing something but they could be legacy code, or bugs. I'll continue working on this as I figure things out. |
test/rubygems/test_gem_platform.rb
Outdated
|
||
# musl and explicit gnu should differ | ||
# refute(x86_linux_gnu === x86_linux_musl, 'linux-gnu =~ linux-musl') | ||
# refute(x86_linux_musl === x86_linux_gnu, 'linux-musl =~ linux-gnu') |
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.
It might be worth thinking about introducing linux-gnu
someday, for those good willed maintainers that know their binary is definitely not musl compatible but with no linux-musl
published (yet, or ever).
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.
I did introduce checks for this but I think we may be getting ahead of ourselves, I'm not fully sure whether we should include it with this patch or not.
test/rubygems/test_gem_platform.rb
Outdated
refute(x86_linux_musl === x86_linux, 'linux-musl =~ linux') | ||
|
||
# other libc are not glibc compatible | ||
# refute(x86_linux === x86_linux_uclibc, 'linux =~ linux-uclibc') |
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.
The case of these non-musl, non-gnu libc that are known not to be compatible at all with glibc binaries (so zero chance of linux
working) remains unsolved here. Anecdotal I know, but one day musl was anecdotal as well.
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.
I fixed this one too! Never seen these in the wild, but if they're not compatible it seems good to make sure we never match "standard" linux.
@lloeki I left a few comments, hopefully they can help 🙏. |
After trying to upgrade to mini_racer 0.4.0 and libv8-node this weekend, I found that this issue has broken my Heroku deployment:
At least, I'm assuming that this is the same issue? Is there any known workaround? |
Might be, it fetches linux-musl when (I assume) Heroku is glibc-based? I really have to find some time to get back on this and finish the PR (should happen soon) |
Thanks @lloeki. I'm not sure why it would be giving that specific error though, considering that there aren't any issues at build time. I also tried pushing the precompiled x86_64 gem to my github rubygems server (here) and got a very similar error:
|
Hah, joke's on me. No time for now but I'm not forgetting about this. |
I'm going to try to redo this based on the rubygems 3.0 + bundler 1.17 patch I produced, which seems to produce good results. Of course only the specs will tell if it fully works. |
@lloeki thanks for all the work so far on this! Is there anything I can do to help get this across the finish line? I'm certainly not familiar with the bundler source but I'm happy to help in any way I can. |
@lloeki Any hope for this to get merged? |
@virusman not as is. FYI I'm rethinking how it should work and what the expectations of the Do you have a need for a specific gem outside of |
Yeah I need this for mini_racer… The changes in rubygems and bundler broke it, and I can’t even deploy the current version of my app without downgrading rubygems and bundler because of that. No workarounds I’ve seen have worked for bundler. |
|
We're also encountering this issue with 4 other gems:
On Alpine with Ruby 3.1 (3.1-alpine at https://hub.docker.com/_/ruby) we are seeing the installation of a The only two options we have as gem maintainers are:
|
At first, the current ruby language is not supported alpine linux and musl officially. The ruby core team does not testing them with https://rubyci.org/ |
Thanks @hsbt for the clarification! It was confusing whether it is supported or not given that the Ruby docker images include one built on Alpine... I guess it's a good time to investigate. |
I understood alpine image was published by docker team. But the ruby core team didn't work together it. we have our official docker image only https://github.com/ruby/ruby-docker-images/pkgs/container/ruby . This means the native extension built by musl may not works well with the ruby language. I highly recommend to use debian based image or official docker image published by the ruby core team. |
70fe6f8
to
4b7723d
Compare
4b7723d
to
5d63c5f
Compare
Co-authored-by: Loic Nageleisen <loic.nageleisen@gmail.com>
5d63c5f
to
703373b
Compare
I merged the RubyGems part of this separately at #5852, and this PR now only backports the feature to Bundler so that this works consistently across RubyGems version. I only backported all the way back to RubyGems 3.1.0.pre.1 because trying to backport further required further changes and was a mess. |
Thank you @deivid-rodriguez for #5852 ! We look forward to seeing this merged too and getting to work with non-glibc platforms! |
Thank @lloeki, he did all the heavy lifting! :) |
You're welcome, there were so many users impacted by this I could don't let that one slide :) |
Of course a huge thank you to @lloeki ! Looking forward to publishing platform gems for musl... |
Backport non gnu libc linux support from RubyGems (cherry picked from commit 95114c8)
Thank you for merging! Now we're going to start working! |
Unfortunately, this PR created again a regression in musl platforms 😬. I'll try hard to fix it to hopefully avoid having to revert the feature. |
Recent updates of the Ruby Gem dependency management utility, 'bundler', introduced a breakage to the 'jekyll-theme-chirper' Ruby Gem starting from version v2.3.21: rubygems/rubygems#4488 ``` 2022-12-03T02:23:00.509Z [WARNING]: Could not find gem 'jekyll-theme-chirpy (~> 5.2, >= 5.2.1)' with platform 'x86_64-linux' in rubygems repository https://rubygems.org/ or installed locally. The source contains the following gems matching 'jekyll-theme-chirpy (~> 5.2, >= 5.2.1)': * jekyll-theme-chirpy-5.2.1 * jekyll-theme-chirpy-5.3.0 * jekyll-theme-chirpy-5.3.1 * jekyll-theme-chirpy-5.3.2 ``` The Ruby Gem dependency management utility, 'bundler', has the same functionality as its aliased variant 'bundle` (ref: rubygems/bundler@2894378). To simplify the AWS Amplify CI/CD pipeline this commit leverages the 'bundle' utility preinstalled in the 'Amazon Linux:2' build image (Docker container). The 'Amazon Linux:2' build image contains 'bundle' version 2.0.1. This version was released almost 4 years ago: rubygems/bundler@d7ad219. The latest version of 'bundler' currently available is 2.3.26, however
Recent updates of the Ruby Gem dependency management utility, 'bundler', introduced a breakage to the 'jekyll-theme-chirper' Ruby Gem starting from version v2.3.21: rubygems/rubygems#4488 ``` 2022-12-03T02:23:00.509Z [WARNING]: Could not find gem 'jekyll-theme-chirpy (~> 5.2, >= 5.2.1)' with platform 'x86_64-linux' in rubygems repository https://rubygems.org/ or installed locally. The source contains the following gems matching 'jekyll-theme-chirpy (~> 5.2, >= 5.2.1)': * jekyll-theme-chirpy-5.2.1 * jekyll-theme-chirpy-5.3.0 * jekyll-theme-chirpy-5.3.1 * jekyll-theme-chirpy-5.3.2 ``` This commit is intended to serve as a stop-gap solution until all existing blog content has been migrated to AWS Amplify.
Recent updates of the Ruby Gem dependency management utility, 'bundler', introduced a breakage to the 'jekyll-theme-chirpy' Ruby Gem starting from version v2.3.21: rubygems/rubygems#4488 ``` 2022-12-03T02:23:00.509Z [WARNING]: Could not find gem 'jekyll-theme-chirpy (~> 5.2, >= 5.2.1)' with platform 'x86_64-linux' in rubygems repository https://rubygems.org/ or installed locally. The source contains the following gems matching 'jekyll-theme-chirpy (~> 5.2, >= 5.2.1)': * jekyll-theme-chirpy-5.2.1 * jekyll-theme-chirpy-5.3.0 * jekyll-theme-chirpy-5.3.1 * jekyll-theme-chirpy-5.3.2 ``` This commit is intended to serve as a stop-gap solution until all existing blog content has been migrated to AWS Amplify.
What was the end-user or developer problem that led to this PR?
See #3174, #4082, #4425.
What is your fix for the problem, implemented in this PR?
Implement the non-ideal but pragmatic behaviour we agreed upon:
nil
version in gems is a wildcard (i.e alinux
gem it can be picked by Rubies onlinux
andlinux-musl
)linux-musl
variant, it should always be preferred on Alpine (i.e alinux-musl
Ruby)linux
Ruby it should never picklinux-musl
gemsMake sure the following tasks are checked