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

Publishing self-contained static executable (with bundled libclang.a) #2767

Open
ianks opened this issue Feb 23, 2024 · 1 comment
Open

Publishing self-contained static executable (with bundled libclang.a) #2767

ianks opened this issue Feb 23, 2024 · 1 comment

Comments

@ianks
Copy link

ianks commented Feb 23, 2024

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.

@HadrienG2
Copy link

HadrienG2 commented Apr 6, 2024

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.

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