Skip to content

Conversation

@chrisnovakovic
Copy link
Contributor

Header directories collected from direct dependencies are placed in the header search path using -isystem, which allows them to be preempted by the compiler toolchain injecting its own -I options into the argument list. This causes build failures if the compiler toolchain's injected directories contain a header with the same file name as one provided by a dependency but a different API; in the worst case, it can cause compilation to silently succeed but trigger unexpected run-time behaviour.

Add header directories for dependencies to the search path via -I, but make sure they appear in the argument list after the options added by compiler_flags so they can be overridden if necessary.

Fixes #96.

Header directories collected from direct dependencies are placed in the
header search path using `-isystem`, which allows them to be preempted
by the compiler toolchain injecting its own `-I` options into the
argument list. This causes build failures if the compiler toolchain's
injected directories contain a header with the same file name as one
provided by a dependency but a different API; in the worst case, it can
cause compilation to silently succeed but trigger unexpected run-time
behaviour.

Add header directories for dependencies to the search path via `-I`, but
make sure they appear in the argument list after the options added by
`compiler_flags` so they can be overridden if necessary.

Fixes please-build#96.
@chrisnovakovic chrisnovakovic merged commit 7aad898 into please-build:master Nov 28, 2025
28 checks passed
@chrisnovakovic chrisnovakovic deleted the prioritise-repo-headers branch November 28, 2025 16:08
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.

Unpredictable compilation of targets with transitive dependencies that expose headers

2 participants