Skip to content

Conversation

martinboehme
Copy link
Collaborator

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.

@martinboehme martinboehme force-pushed the resource_dir branch 2 times, most recently from 7feb685 to 0115547 Compare September 4, 2025 18:44
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.
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.

1 participant