Skip to content

feat: support headers provided by the CC toolchain in translate_c#557

Merged
aherrmann merged 2 commits intoaherrmann:mainfrom
cerisier:cerisier/translate-c-cc-toolchain
Oct 16, 2025
Merged

feat: support headers provided by the CC toolchain in translate_c#557
aherrmann merged 2 commits intoaherrmann:mainfrom
cerisier:cerisier/translate-c-cc-toolchain

Conversation

@cerisier
Copy link
Contributor

Sometimes, cc toolchains provide additional include directories that are valid to be included implicitly.

Copy link
Owner

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
Same question as last time, see #517 (comment):
We're setting -lc above, AFAIK that means that the Zig compiler will include it's builtin libc headers. If we now also including the Bazel C toolchain's libc headers, doesn't this cause a mishmash of potentially different libcs?

@cerisier
Copy link
Contributor Author

cerisier commented Oct 16, 2025

It's a tricky one.

The answer is that further -isystem will take priority over what is set by zig when using -lc if the CC toolchain provides similar headers.

But a cc toolchain doesn't not necessarily provide libc headers.

And I would argue that if there is one from a cc toolchain, we should use it since it means we are using it in our c/cxx files anyway.

WDYT ?

Copy link
Owner

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, and it is scoped to the translate-c step. Makes sense.

@aherrmann aherrmann merged commit 135c934 into aherrmann:main Oct 16, 2025
17 checks passed
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.

2 participants