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

Allow using multiplatform images #137

Merged
merged 2 commits into from
Dec 31, 2024
Merged

Allow using multiplatform images #137

merged 2 commits into from
Dec 31, 2024

Conversation

larskanis
Copy link
Member

@larskanis larskanis commented Dec 29, 2024

These are the changes necessary to build both linux/amd64 and linux/arm64 docker images. This way we can provide not only images running on x86_64 but also aarch64. They run much faster on ARM based Mac and ARM based Linux systems.

On the native platform (x86_64-linux or aarch64-linux) ruby configure script finds libz and libcrypt and makes use of it in libruby.
Disabling them per ac_cv_* variables unifies cross builds and we can remove platform specific injection of -lz and -lcrypt into mkmf.rb .

The docker image for the x64-mingw-ucrt compiler larskanis/mingw64-ucrt needs to be rebuilt on linux/arm64 platform, so that both arm64 and amd64 are provided. Currently the image for platform linux/amd64 is used on linux/arm64, which doesn't work.

The rebuild fails on docker arm64 emulation with segmentation fault, but works flawlessly on a real arm64 device.
When it is rebuilt, the deb package versions have changed versions, which is adjusted below. So it makes sense to rebuild and push larskanis/mingw64-ucrt just before this PR is merged.

I didn't test whether the image build on x86_64 with docker buildx arm64 emulation works. Maybe they crash similar to mingw64-ucrt. In any case it's very slow. However I can build the linux/arm64 images locally and push them manually.

Fixes #78

This way we can provide not only images running on x86_64 but also aarch64.
The docker platform names are "linux/amd64" and "linux/arm64".

On the native platform (x86_64-linux or aarch64-linux) ruby configure script finds libz and libcrypt and makes use of it in libruby.
Disabling them per ac_cv_* variables unifies cross builds and we can remove platform specific injection of -lz and -lcrypt into mkmf.rb .

Fixes #78
@flavorjones
Copy link
Collaborator

@larskanis I don't think this PR is enough to completely close #78 since we probably need to figure out a way to build and ship these reliably (maybe using Github Actions for reproducibility)?

@larskanis larskanis merged commit aa27315 into main Dec 31, 2024
24 checks passed
@larskanis larskanis deleted the multiplat branch December 31, 2024 18:11
@larskanis
Copy link
Member Author

Thank you Mike for your review! I merged it to get forward with the ARM64 support at least locally. I'll try to make the images available for both architectures. Reopened #78 for now.

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.

Publish images for the linux/arm64 Docker platform
2 participants