By default, AppleClang adds /usr/local/include to the application search folders for include files (as opposed to the system include dirs). This causes problems with the expected include order because application search folders always have priority over system includes. Specifically it causes problems with the conan package manager as library includes are added with -isystem
This behaviour differs from LLVM mainline clang and GCC, where /usr/local/include is a system include (added with -internal-isystem).
Steps to reproduce -
run
echo 'int main() { return 0; }' | clang -xc -v -
the output is as follows
Apple clang version 17.0.0 (clang-1700.0.13.5)
Target: arm64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" ... -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
-I/usr/local/include
-internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include ...
Selecting any option will automatically load the page