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

Adding documentation for Rust/Cargo extensions #5648

Open
pawandubey opened this issue Jun 23, 2022 · 3 comments
Open

Adding documentation for Rust/Cargo extensions #5648

pawandubey opened this issue Jun 23, 2022 · 3 comments
Labels

Comments

@pawandubey
Copy link

Hello,

The support for building Rust extensions added in #5175 is great! But we are lacking documentation on the proper way to use it. https://guides.rubygems.org/gems-with-extensions/ only talks about C extensions as well.

After trying to publish a gem with a Rust extension built with rutie, it seems like the ruby library has to require the <gemname.so> file for the integration to work. However, it is not clear how to build that shared library while developing the gem locally. Cargo builds usually end up in the target directory, and it only builds the lib<gemname>.so object (which incidentally ends up at /path/to/ruby/extensions/<platform>/release. through the Cargo extension builder).

Moreover, it seems like it expects us to check in the Cargo.lock file, whereas Cargo by default adds to to .gitignore for lib projects.

Basically, I think we can benefit from docs on how to structure the project correctly to be installed and worked on locally. I haven't yet figured out a way to make both of those possible at the same time, so while I am willing to contribute docs, I would appreciate pointers!


I will abide by the code of conduct.

@deivid-rodriguez
Copy link
Member

I think @ianks will most likely have some answers here :)

@ianks
Copy link
Collaborator

ianks commented Jun 23, 2022

I recommend using the rb_sys for developing a gem locally. It handles all of that stuff, and more. As far as starting a new gem, #5613 will make getting started a lot easier.

I've started a bit on writing docs for it in this Cargo book. Although I consider Rust in Ruby to have feature parity with C at this point, the documentation is the biggest weakness at this point. I would be incredibly grateful for help on this!

If you are interested in helping, I would love to help you through this. Can you join the oxidize-rb Slack to discuss more? @pawandubey

@pawandubey
Copy link
Author

Thanks @deivid-rodriguez and @ianks! I will check out the links. Looks like things are already moving in the right direction, which is exciting! I will join the Slack and connect there. I am happy to leave this issue open for now, and close it once we have some documentation (even links to resources) rolled into the Rubygems guides, but no objection to closing it either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants