bindgen: Pass `-resource-dir` Clang flag to bindgen-cli. (#3591)

For some cc_toolchain configurations, this is required to find the
builtin
headers.

So far, the bindgen rules had assumed that the builtin headers can be
found through `cc_toolchain.built_in_include_directories`. This is,
however, not guaranteed to be the case; indeed,
`built_in_include_directories` is not really intended for finding
builtin headers but merely for filtering out diagnostics in builtin
headers.

Clang itself finds the resource directory relative to its own binary,
and then finds the builtin headers in the "include" subdirectory of the
resource directory. bindgen-cli may, however, be located in a different
directory than Clang, so we pass a `-resource-dir` flag on the command
line.
2 files changed
tree: 19da29efbed8b8f9d3dd3c46b1323c569ccfc30e
  1. .bazelci/
  2. .bcr/
  3. .github/
  4. cargo/
  5. crate_universe/
  6. docs/
  7. examples/
  8. extensions/
  9. ffi/
  10. nix/
  11. rust/
  12. test/
  13. tools/
  14. util/
  15. .bazelignore
  16. .bazelrc
  17. .clang-format
  18. .clippy.toml
  19. .envrc
  20. .gitattributes
  21. .gitignore
  22. .pre-commit-config.yaml
  23. .prettierrc.toml
  24. .rustfmt.toml
  25. .typos.toml
  26. ARCHITECTURE.md
  27. AUTHORS
  28. BUILD.bazel
  29. CODEOWNERS
  30. COMPATIBILITY.md
  31. CONTRIBUTING.md
  32. CONTRIBUTORS
  33. LICENSE.txt
  34. MODULE.bazel
  35. README.md
  36. version.bzl
  37. WORKSPACE.bazel
  38. WORKSPACE.bzlmod
README.md

Rust Rules

  • Postsubmit Build status

Overview

This repository provides rules for building Rust projects with Bazel.

Community

General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.

Documentation

Please refer to the full documentation.