Skip to content

Use rake-compiler and rb-sys for build#1

Closed
ianks wants to merge 3 commits intoankane:masterfrom
ianks:rb-sys
Closed

Use rake-compiler and rb-sys for build#1
ianks wants to merge 3 commits intoankane:masterfrom
ianks:rb-sys

Conversation

@ianks
Copy link
Copy Markdown

@ianks ianks commented Jun 22, 2022

This PR changes the build system to use rb-sys and rake-compiler to build the gem. With this change, it will be possible to publish native binaries of the gem so that consumers will not have to maintain a rust toolchain for deployment.

The actual publishing of the gem is not handled by this PR, but the cross-build Github action will build a bunch of *.gem files which can pushed to Rubygems.

❤️

@ankane
Copy link
Copy Markdown
Owner

ankane commented Jun 22, 2022

Hey @ianks, thanks for the PR, and all the work you're doing to make it easier to use Rust with Ruby. Will try this out when I have some time. Is it possible to make rake-compiler a development dependency (instead of runtime)?

@kojix2
Copy link
Copy Markdown

kojix2 commented Sep 8, 2022

I hope this wonderful gem will be easy to install.

ankane added a commit that referenced this pull request Nov 16, 2022
@ankane
Copy link
Copy Markdown
Owner

ankane commented Nov 16, 2022

Hey @ianks, sorry for the delay. Switched to rb_sys + rake-compiler and the directory structure from ruby/rubygems#5613 in the commit above (wanted to do this separately from precompiling). Will hopefully try out the cross-gem-action soon.

Thanks again for all the work on rb_sys and driving this!

@ankane ankane closed this in 6ea8ec4 Dec 1, 2022
@ankane
Copy link
Copy Markdown
Owner

ankane commented Dec 1, 2022

Hey @ianks,

Added precompiling for a few platforms in the commit above (it currently fails on aarch64-linux since OpenSSL isn't available). It'd be nice if rb_sys provided a way to cross-compile locally as well (if it doesn't already, like rake-compiler-dock).

Thanks again for all the work you've done on Ruby + Rust!

@ankane
Copy link
Copy Markdown
Owner

ankane commented Dec 11, 2022

Just released 0.2.0 with precompiled versions for Mac and x86-64 Linux.

@ianks
Copy link
Copy Markdown
Author

ianks commented Dec 11, 2022

🔥 🔥 🔥

Added precompiling for a few platforms in the commit above (it currently fails on aarch64-linux since OpenSSL isn't available). It'd be nice if rb_sys provided a way to cross-compile locally as well (if it doesn't already, like rake-compiler-dock).

Just literally published a fix for that today in v0.9.47. Hopefully that fixed it!

. It'd be nice if rb_sys provided a way to cross-compile locally as well (if it doesn't already, like rake-compiler-dock).

Ah yes, it is actually just rake-compiler-dock under the hood so it should work fine. Admittedly, I don't do it often because currently arm64 builds for rcd aren't published. And since I'm on an M1, they are slowwwwww. You can see how it's done here.

@ianks ianks deleted the rb-sys branch December 12, 2022 02:10
@ankane
Copy link
Copy Markdown
Owner

ankane commented Dec 12, 2022

Thanks @ianks!

Tried v0.9.47, but think it may solve a different issue (the aarch64-linux failure is due to a missing header required by openssl-sys - need to spend more time on it).

@ianks
Copy link
Copy Markdown
Author

ianks commented Dec 12, 2022

Oof yeah that’s a bit of a doozy. Providing a cross platform version of OpenSSL should be possible in the setup of cross gem action, but ideally the dep on openssl-sys could be removed entirely in favor of rustls. I think this may be coming from the http feature of the tokenizers crate? Not sure though.

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.

3 participants