-
Notifications
You must be signed in to change notification settings - Fork 30
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 supporting *-linux-musl
as a target platform
#75
Comments
For additional context, here is the Dockerfile we use for |
Hey folks, as @ianks already wrote, the Dockerfile I provided is mostly a straightforward port of the RCD image, minus the For full disclosure, I once tried to build a basic image where I add the musl tool chain myself, but it took forever to build, and I was running into various issues, so the result is a shortcut. I was looking into https://musl.cc/, and there are indeed some pre-compiled binaries we could use, it is probably just some extra work to add them. As a side note, my primary motivation was to support builds for Alpine. |
Here's an interesting failure case for how we're currently handling musl (which is, basically, hoping and testing): sparklemotion/sqlite3-ruby#372 Some prior art I was able to find around generating musl binaries: |
@flavorjones Have you given a shot just directly using |
@ianks thanks a lot for suggesting image (it works in my case), BTW maybe you can suggest a good candidate for |
As of now, there is no supported |
What would be needed to make this happen? I'm currently looking into revamping rubygems' support for "platforms", and as a part of that we want to make shipping precompiled extensions as ubiquitous as possible, so I'd love to understand what blocks cross-compiling against musl here |
@segiddins This is very very interesting to me (I've given multiple conference talks (1, 2) on precompiled gems; and help maintain precompiled gems nokogiri, sqlite3, and ruby-magic, as well as this project; and created a project explaining precompilation with working examples and CI) ... and probably to @larskanis and others as well. How can we help support this effort? This issue is to discuss a (slowly) ongoing project to create a docker image suitable for cross-compiling for musl. This is pretty much just a time-and-effort question, since @eliias and @ianks have already done something specifically for rust extensions (see Ian's comment above). I explored using the rb-sys image with nokogiri but ran into some errors that I didn't have time to finish investigating. I'll try to carve out some time this weekend to rebuild context and document where support stands. |
Closing the loop, I did find time to explore this again over the weekend, and although I can precompile a working nokogiri gem for MUSL, it's not reliable and I think this is because rake-compiler doesn't know how to handle the difference between I've timed out for today, but I'm pretty confident I can figure this out with a bit more work. |
@segiddins This effort would be very much appreciated. If you want to chat or discuss ideas, please don’t hesitate to contact me. Very exciting. |
@flavorjones IIRC I added this line to make it work, pretty hacky but doing the job https://github.com/oxidize-rb/rb-sys/blob/main/docker/Dockerfile.x86_64-linux-musl#L127 |
Picking this back up again today due to the recent musl changes in alpine:3.19. |
3.19 introduced changes to musl that break sqlite3. See sparklemotion/sqlite3-ruby#434 and rake-compiler/rake-compiler-dock#75
See #111 for progress. I'm close to having |
Oh yeah! |
#111 is totally green and ready for review. |
v1.5.0.rc1 has been released with musl support. see https://github.com/rake-compiler/rake-compiler-dock/releases/tag/v1.5.0.rc1 for details |
(I'm going to test nokogiri and sqlite3 against the RC and if they're fine then I'll ship a final release this weekend) |
See: sparklemotion/sqlite3-ruby#434 which is apparently a problem in rake-compiler-dock, see: rake-compiler/rake-compiler-dock#75
Since Bundler 2.3.21 / Rubygems 3.3.21, it's possible to ship a gem for the specific
*-linux-musl
platform.For many gems, like Nokogiri, we've been able to figure out how to build binaries that work on both glibc and musl platforms, but other gems (like sass-ruby) had to stop precompiling because of incompatibilities; and it sounds like (based on a chat with @ianks) that the Rust toolchain handles musl systems very differently as well.
This is a placeholder to discuss if, and when, we should support
x86_64-linux-musl
andaarch64-linux-musl
as distinct target platforms.The text was updated successfully, but these errors were encountered: