-
Notifications
You must be signed in to change notification settings - Fork 745
Publishing self-contained static executable (with bundled libclang.a) #2767
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
Comments
Another possible (complementary) strategy is to use the pre-built binaries provided by LLVM contributors for various hardware + OS combinations. They contain way more than we need, but extracting the (self-contained) libclang.so from them is not terribly difficult. So it should be possible to have a scheduled CI job that periodically scans the LLVM releases, extracts the libclang, and attaches it to the bindgen github release. Of course, given that people are easily scared by binaries for reasons I have never fully understood (unless you claim that you or anyone else actually understands everything that the LLVM source code does, there is no meaningful security difference between building LLVM from source and using a pre-built binary from my perspective), the use of binaries should be optional. |
@HadrienG2 I like this idea a lot. For rb-sys, libclang is by far the biggest headache in the toolchain and the thing wastes the most collective developer hours. Where I work, it's caused the biggest impediment to Rust adoption out of everything in the ecosystem. For such a seemingly small thing, the implications are big. IMO, using pre-built binaries from LLVM should be the default with the goal of removing as much toil as possible. |
Maybe Rustup can distribute |
One of the biggest pain points about using bindgen is installing libclang. It's a massive dependency to manage, and adds pain to the development and deployment of Rust apps. It would be nice if you could just run
bindgen-cli-installer.sh
and be done with it, whether you're compiling in CI or on a laptop.The downside is that the generated executable is pretty massive (85M on arm64-darwin, compared to 5.4M now).
There's already support for statically linking
libclang.a
, so I think this is mostly a matter of automating the release process. I have a hacky proof-of-concept here for reference.I'd be happy to work on making this happen if others would find it useful.
The text was updated successfully, but these errors were encountered: