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

Update bindgen rules to build clang from source. #1998

Merged
merged 3 commits into from
Jun 13, 2023

Conversation

UebelAndre
Copy link
Collaborator

This change updates the default rust_bindgen rules to build libclang and clang from source using the Bazel rules sourced in the llvm-project repository for use in RustBindgen actions. The version of Clang that Bindgen uses by default is updated 14.0.6 which was what I was able to get building.

Some breaking changes include:

  • Users must now load one extra bzl file if they don't already have have llvm-project defined in their WORKSPACE.
load("@rules_rust//bindgen:transitive_repositories.bzl", "rust_bindgen_transitive_dependencies")

rust_bindgen_transitive_dependencies()
  • rust_bindgen_repositories is deleted as a means of forcing users to take a look at the updated dependencies.

closes #919

@UebelAndre UebelAndre enabled auto-merge (squash) June 13, 2023 11:42
@UebelAndre UebelAndre merged commit 3e2ee94 into bazelbuild:main Jun 13, 2023
@UebelAndre UebelAndre deleted the bindgen branch June 13, 2023 11:52
@8573
Copy link

8573 commented Jun 13, 2023

Is there an option not to build Clang from source, for users who don't need that?

@UebelAndre
Copy link
Collaborator Author

You should still be able to register your own toolchains

@UebelAndre
Copy link
Collaborator Author

Is there an issue you’re running into building clang from source?

@aaronmondal
Copy link

@UebelAndre Cool change! I want to integrate bindgen-similar functionality between rules_ll and rules_rust via the cxx crate and with this change I can test interop with our bzlmod variant for LLVM.

For reference, LLVM/bzlmod in rules_ll looks like this: https://github.com/eomii/rules_ll/blob/bdd243466d7c5e8be8a9d7f7fcb179b2a1ae084b/MODULE.bazel#L25-L50.

The upstream patch is at https://reviews.llvm.org/D137008. I'll double-check that things are compatible with the usage in rules_rust when I find time to revise that patch.

Silcet pushed a commit to Silcet/rules_rust that referenced this pull request Jul 10, 2023
* Update bindgen rules to build clang from source.

* Regenerate documentation
Silcet pushed a commit to Silcet/rules_rust that referenced this pull request Jul 10, 2023
* Update bindgen rules to build clang from source.

* Regenerate documentation
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.

Bindgen rules are not supported on all platforms
4 participants