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

[Proposal] Integrate cbindgen right into rust and rustc? #1047

Open
rubyFeedback opened this issue Jan 18, 2025 · 1 comment
Open

[Proposal] Integrate cbindgen right into rust and rustc? #1047

rubyFeedback opened this issue Jan 18, 2025 · 1 comment

Comments

@rubyFeedback
Copy link

rubyFeedback commented Jan 18, 2025

Not sure if there is any support for this, but recently I had to compile gjs (https://www.linuxfromscratch.org/blfs/view/svn/gnome/gjs.html) and
needed firefox mozjs for that, which in turn needs cbindgen.

I was installing rust via rustup, but then it took me a while to realise that cbindgen
is needed, aka this project here.

Would it not be more convenient for just about everyone involved if cbindgen could
become official part of the rust/rustc toolchain? I think the more that is integrated,
when needed for compiling something, the better from a user's and downstream
dev perspective. At the least I would have preferred to have had cbindgen as part
of rust/rustc + rustup. It would have been easier rather than end up being frustrated
with rust not really working (because I was not aware of needing cbindgen as well),
whereas if cbindgen would be part of rust/rustc, we downstream people could
bypass one additional hurdle. Keep in mind is that we don't quite have as much
experience with regard to rust yet, but rust is also needed for other parts now
(e. g. librsvg to name but one).

@bavalpey
Copy link

Would it not be more convenient for just about everyone involved if cbindgen could become official part of the rust/rustc toolchain?

What's the advantage of this? cbindgen is just tooling, and we have the [build_dependencies] section of cargo.toml to specify this is needed. The rust ecosystem is also built quite well around making tooling easy to find and use. and rust has a great deal of support for tooling.

I think the more that is integrated,
when needed for compiling something, the better from a user's and downstream
dev perspective.

I actually think that this is worse from a user's perspective. And from a dev's. If it's integrated, then all of its configuration options are now part of rustc.
I think encapsulation is a very powerful paradigm to adhere to. It keeps different things separate.

I think if you were having issues, that's probably the fault of the codebase not providing proper installation instructions, or potentially even setting it up wrong. Cbindgen can be invoked from the library's build script so that users don't need to do anything manually, not even download it.

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

No branches or pull requests

2 participants