rb-sysThe primary goal of rb-sys is to make building native Ruby extensions in Rust easier than it would be in C. If
it's not easy, it's a bug.
rake-compilerrb-sys?rb-sys gem 💎 to learn more about the rb-sys gem for compiling extensionsrb-sys crate)Below are some examples of how to use rb-sys to build native Rust extensions. Use these as a starting point for your
building your own gem.
lz4_flex gem uses rb-sys and magnus to package the rust wasmtimewasmtime-rb gem uses rb-sys and magnus to package the rust wasmtime
library as a Ruby gem.oxi-test gem is the canonical example of how to use rb-sys. It is a minimal, fully tested with
GitHub actions, and cross-compiles native gem binaries. This should be your first stop for learning how to use
rb-sys.rb_sys gem and using it with an extconf.rb file.magnus repo has some solid examples.ext
directory.yrb gem shows how to integrate rb-sys and magnus into an existing gem.rb-sys will handle most of the dependencies for you, but you will need to have libclang installed on your system.
On MacOS, you can install it with brew install llvm.
On Linux, you can install it with apt-get install libclang-dev.
We support cross compilation to the following platforms (this information is also available in the ./data
directory for automation purposes):
| Platform | Supported | Docker Image |
|---|---|---|
| x86_64-linux | ✅ | rbsys/x86_64-linux:0.9.108 |
| x86_64-linux-musl | ✅ | rbsys/x86_64-linux-musl:0.9.108 |
| aarch64-linux | ✅ | rbsys/aarch64-linux:0.9.108 |
| aarch64-linux-musl | ✅ | rbsys/aarch64-linux-musl:0.9.108 |
| arm-linux | ✅ | rbsys/arm-linux:0.9.108 |
| arm64-darwin | ✅ | rbsys/arm64-darwin:0.9.108 |
| x64-mingw32 | ✅ | rbsys/x64-mingw32:0.9.108 |
| x64-mingw-ucrt | ✅ | rbsys/x64-mingw-ucrt:0.9.108 |
| mswin | ✅ | not available on Docker |
| truffleruby | ✅ | not available on Docker |
We make a concerted effort to help out new users. If you have questions, please join our Slack and post your
question in the #general channel. Alternatively, you can open an issue and we'll try to help you out.
See the CONTRIBUTING.md file for information about setting up a development environment.
Bug reports and pull requests are welcome on GitHub at https://github.com/oxidize-rb/rb-sys.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Content type
Image
Digest
sha256:82f7a9da0…
Size
54.4 MB
Last updated
over 1 year ago
docker pull rbsys/x86-linux:cache-0.9.108