When using libbsd-overlay with buildroot, we get this error:
(search for "isystem", scroll down a bit)
It seems the problem is that pkg-config will prefix all paths with the sysroot but doesn't do that for -isystem. Therefore, the host headers are used instead of the target ones.
Dunno how to fix that exactly.
I think this needs to be fixed in pkg-config itself. Because it already understands -isystem and -idirafter, but it does not prefix them with the sysroot path when specified.
As a "temporary" workarounds you could switch to use pkgconf which seems to have already fixed this issue last month. Because the only workarounds that occur to me when using pkg-config for now are to fix its output in configure.ac scripts and similar which might bee too invasive. Or perhaps hardcode the sysroot path in the libbsd-overlay.pc file? (ugh)
Hmm, hadn't thought of that case. pkg-config prepends the sysroot for -I or -L flags. I think it could be extended to cover -isystem pretty easily.
Created attachment 126755 [details] [review]
check: Add more flags to the special-flags test
Make sure that all the flag types are covered so that the ordering
between them is being tested.
Created attachment 126756 [details] [review]
check: Include special-flags in sysroot test
Make sure that the sysroot behavior works right when we have non-I/L
flags to consider.
Created attachment 126757 [details] [review]
Respect sysroot for -isystem and -idirafter
Treat -isystem and -idirafter as -I Cflags since they control the
compiler search path. Adjust the sysroot handling so that the arguments
to these options have the sysroot prefixed. However, leave them out of the
system Cflags handling since these directives are explicitly trying to
adjust the compiler's system header search behavior.
The special-flags test case output needs adjustment since all the flags
are now considered -I flags and come out in the order specified in the
This fixes it in my testing. The 3rd patch is the important one. The others are just for prepping the test suite. Can you test it out?
I went ahead and pushed the patches since I think they do the right
thing. Please reopen if this doesn't work for you.
Attachment 126755 [details] pushed as a737256 - check: Add more flags to the special-flags test
Attachment 126756 [details] pushed as 7707d2f - check: Include special-flags in sysroot test
Attachment 126757 [details] pushed as d5d8074 - Respect sysroot for -isystem and -idirafter
*** Bug 99516 has been marked as a duplicate of this bug. ***