https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90834

--- Comment #13 from Iain Sandoe <iains at gcc dot gnu.org> ---
The /usr/local/include thing needs to be handled carefully

"bare" clang (at least up to 9.x) behaves as per GCC, and prepends a given
--sysroot= to the usr/local paths too.

This is correct; imagine that you want to do a cross-compile to a different
Darwin version, so you do ...

... gcc --sysroot=/path/to/darwinXX/SDK -mmacosx-version-min=XX foo.c ... 

you *do not* want that compile line to look in /usr/local/include - since that
directory might have nothing to do with darwinXX (imagine different APIs).

So, if we wanted to do something "automatic" it would have to be predicated on:
1) That there was no --with-sysroot= given at configure time
2) That this is not a cross-compiler
3) That there is no --sysroot= on the invocation line
4) That target = host at invocation time

====

While one could do something at configure time to choose between "/" and
"Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" based on build=host=target
and what the build system has installed, that's guaranteed to fail if the built
compiler is moved to a system with different configuration.

So, we keep coming back to needing something at invocation time - and that
something needs to be efficient (i.e. not a process launch)

Reply via email to