Skip to content
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

first-class support for musl platforms #111

Merged
merged 10 commits into from
Jan 23, 2024

Conversation

flavorjones
Copy link
Collaborator

@flavorjones flavorjones commented Dec 19, 2023

Approach taken in this PR:

Closes #75 (or will, once this is complete)

@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch 3 times, most recently from 821e571 to 9a7cf4f Compare December 20, 2023 20:10
@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch 2 times, most recently from ba8d577 to 6bfd212 Compare January 2, 2024 22:33
@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch from 6bfd212 to 9a609e1 Compare January 15, 2024 19:06
@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch 2 times, most recently from 0b25bbe to 08b8e80 Compare January 16, 2024 16:35
Test gems built with the `-linux-gnu` suffix only on ruby 3.1 and
later, which are the ones that ship with rubygems 3.2.33 or later (the
version that first recognizes the `-gnu` suffix).

Also make sure we tag the `-linux-gnu` docker images as `-linux` for
backwards compatibility, and make sure we test that workflow.
@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch from 08b8e80 to 49ecf3d Compare January 16, 2024 16:58
@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch 12 times, most recently from 9cb47a2 to 42ab09a Compare January 17, 2024 23:17
ci: extract x86_64-linux-gnu testing into two matrixed jobs, one for
testing against setup-ruby, another for testing against official ruby
docker images.

ci: add a matrix of x86_64-linux-musl test

rcd_test.gemspec: remove dependency on `git` so we can run in basic
containers

rake-compiler-dock.gemspec: handle missing `git` so we can run in
basic containers
ci: extract testing matrices for x86-linux gnu and musl
@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch 2 times, most recently from eae7b3d to 5dd8998 Compare January 18, 2024 02:36
note that we have to patch rake-compiler to build ruby 2.7 on 32-byte
arm because of coroutine issues that weren't fixed until 3.0.

ci: extract testing matrices for arm-linux gnu and musl
@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch 2 times, most recently from b2ba362 to 828b465 Compare January 18, 2024 15:37
ci: extract testing matrices for aarch64-linux gnu and musl
@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch 7 times, most recently from c037bf6 to 0e19cc4 Compare January 18, 2024 20:42
because we're now updating rubygems on older images, we're able to
have a full test matrix.
@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch from 0e19cc4 to 36b9577 Compare January 19, 2024 13:43
@flavorjones flavorjones marked this pull request as ready for review January 19, 2024 14:25
@flavorjones
Copy link
Collaborator Author

@larskanis This is a relatively small but significant change, so I'd love your 👀 on it. Changes to the Dockerfile template are minimal, essentially adding this file for musl platforms:

build/mk_musl_cross.sh

And the CI is made more thorough.

@flavorjones flavorjones changed the title fix: alpine symbol not found first-class support for musl platforms Jan 19, 2024
@flavorjones flavorjones force-pushed the flavorjones-202312-musl-support branch from 36b9577 to cfe4573 Compare January 19, 2024 15:41
@flavorjones
Copy link
Collaborator Author

Planning to merge this tomorrow (2024-01-23) so I can start testing downstream using the snapshot images.

@flavorjones flavorjones merged commit 6854cb3 into main Jan 23, 2024
166 checks passed
@flavorjones flavorjones deleted the flavorjones-202312-musl-support branch January 23, 2024 15:49
@larskanis
Copy link
Member

Looks all good! 👍

Your documentation looks like you've seriously checked, that Rubygems is working with linux-gnu vs. linux and that the download of the correct version from rubygems.org works as expected. This is my only concern.

I'd like to try the musl support with ffi.gem, which didn't work there so far. So I'm looking forward to try out a prerelease.

Sorry for having very little time for OSS development. It's hard to work together with me...

kou pushed a commit to rake-compiler/rake-compiler that referenced this pull request Jan 30, 2024
…x libc (#236)

### Problem I'm trying to solve

Rubygems does not correctly recognize `-musl` or `-gnu` platform
suffixes until v3.3.22.

### Solution

If rake-compiler is building a linux native gem that specifies a libc in
its platform object, then add ">= 3.3.22" to the
required_rubygems_version requirement.


https://github.com/rubygems/rubygems/blob/master/CHANGELOG.md#3322--2022-09-07

### Context

While working on musl support in the precompilation toolchain:

- rake-compiler/rake-compiler-dock#111
- flavorjones/ruby-c-extensions-explained#27
- sparklemotion/sqlite3-ruby#442
- sparklemotion/nokogiri#3111

I noticed that Ruby 3.0 is still shipping with Rubygems 3.2.33, which
does not recognize these gem platforms.

Specifying the rubygems requirement changes the error experienced by
users during gem installation from:

> ERROR:  While executing gem ... (Gem::Exception)
> Unable to find spec for #<Gem::NameTuple rcee_precompiled,
0.6.test.2024.0128.1724, aarch64-linux>

to:

> ERROR: Error installing
rcee_precompiled-0.6.test.2024.0128.1735-x86_64-linux-musl.gem:
> rcee_precompiled-0.6.test.2024.0128.1735-x86_64-linux-musl requires
RubyGems version >= 3.3.22.
> The current RubyGems version is 3.2.33. Try 'gem update --system' to
update RubyGems itself.
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.

consider supporting *-linux-musl as a target platform
2 participants