-
Notifications
You must be signed in to change notification settings - Fork 18
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
Use Thermite to build extension #6
base: master
Are you sure you want to change the base?
Conversation
This commit adds Thermite to build and compile the gem extension. Using Thermite, users of the gem do not need to have a working Rust compiler in order to install the gem. Instead, Thermite will check for a compiled library matching the user's environment on GitHub Releases and download that instead. If there is no matching compiled library available, then Thermite falls back to compiling the extension locally. This makes this gem more accessible as users do not need to understand how to install and manage Rust in order to use the gem.
Hello, Thanks for the interesting proposal. I know Thermite but I didn't know it was able to use pre-compiled binaries. That's interesting. The project has a CI: https://github.com/wasmerio/ruby-ext-wasm/blob/master/.circleci/config.yml. I plan to move to Azure so that we have Windows support too. Let's start with CircleCI as it is now. What do you need to continue your PR? |
@@ -0,0 +1,5 @@ | |||
require "thermite/tasks" |
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.
There is already a Rakefile
file at the root of this project. It is used by the gemspec
file. I reckon we can merge the two Rakefile
files.
Related news rubygems/rubygems#2726! |
That's very exciting. I may hold off on this depending on how the Rubygems integration goes. Hopefully they will offer a way to use precompiled libraries, as I don't think the Rust compiler is as common as GCC. Another trouble I ran into while testing this is that Rutie requires Ruby to be compiled with |
I don't know whether we should wait on Rubygems. There is no deadline, and it will probably take months before being released. Do you have time, or motivation, to continue this PR?
That's true. I guess it's the case for every Ruby extension written in Rust though. |
I believe some of the other Rust extension crates statically link to Ruby so they don't require the presence of the shared library on the user's system. It looks like Rutie is trying to solve a few remaining issues to enable static builds. |
I would still like to continue this PR. I will take a look at the CircleCI configuration and do some more research. |
Hello, I think it's time to try it out again :-). We have a new CI pipeline based on Github Actions. The project has been rewritten from scratch. Everything looks good! I see that https://github.com/malept/thermite didn't receive any commits since 2018. Do you believe the project is still maintained? |
I don't think it is anymore. I'm not sure what the current best practice is for maintaining/distributing Rust-based Ruby extensions. |
Hello maintainers!
I am very interested in trying out this gem for some projects. One major obstacle to this is that installing the gem currently requires a working installation of
cargo
. This means I can't use this gem on a remote server where I may not be able to installcargo
.In this PR, I propose to add Thermite to manage building, compiling, and installing the gem's extension code.
Info about Thermite
Thermite's biggest advantage is that it provides a way to automatically check for and download precompiled libraries when a user tries to install the gem. When a user runs
gem install wasmer
, Thermite will check for a precompiled library on GitHub Releases that matches the version ofwasmer
requested, the user's platform, and the user's architecture. If a precompiled library exists, that is downloaded and unpacked; if one does not exist, then regularcargo build --release
is used.For an example of a Rust-based Ruby extension using Thermite, check out rusty_blank.
Need a CI platform
The advantage of Thermite is that it can download precompiled libraries, but that means this project will need some way to generate those libraries. I do not see any common CI config files in the project, so I think a first step would be to choose a CI provider.
I would personally recommend Azure Pipelines because Pipelines gives access to Linux, macOS, and Windows build nodes, all in one platform. This would mean that the project could run tests on all 3 platforms and also compile libraries on all 3 platforms.
Maybe this PR should wait until a CI platform is chosen. I can revisit this PR to update the CI scripts to add the necessary steps to publish releases after.