[clang] [clang] Match -isysroot behaviour with system compiler on Darwin (PR #80524)

Dmitry Polukhin via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 8 02:02:42 PST 2024


dmpolukhin wrote:

> So the intent of the current ordering was to allow creating a toolchain by placing the libc++ headers alongside Clang, as is typically done (and exceptionally not done on Apple platforms). On Apple platforms, you basically always specify a sysroot, either explicitly or implicitly (via env vars). You have to, since the SDK is where you find everything you need to compile even the most basic program (like our libc headers).

@ldionne thank you for explaining the reasoning behind the decision. Unfortunately, it makes the life of a non-system compilers and clang-tools much more complicated on Apple platforms. They usually don’t have system headers shipped with them so they rely on one provided in SDK. My interest in this issue started from clang-tidy that was not able to find cxxabi.h in the path specified with -isysroot due to the new order introduced in https://reviews.llvm.org/D89001. But it seems my use case will be broken anyway if SDK stops providing libc++ headers. Is it the eventual future? If it is the case, checking -sysroot first will be only a temporary solution. I still think that it makes sense for the time being but also we need to think about a long term solution for non-system compilers and clang-tools. Perhaps it should be configured at build time if you are building the system default compiler or additional tools shipped separately.

https://github.com/llvm/llvm-project/pull/80524


More information about the cfe-commits mailing list