[PATCH] D136315: [clang][Darwin] Try to guess the SDK root with xcrun when unspecified

Caleb Zulawski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 20 10:37:07 PST 2023


calebzulawski added a comment.

If `SDKROOT` is set or `-isysroot` is passed, `xcrun` won't be called so there is no regression for existing use cases like CMake.  Additionally, if `xcrun` isn't found, no error is emitted.  I also added the `--no-detect-xcode` flag based on similar feedback that it may not always be desirable.

Better diagnostics would certainly be helpful, but for my particular use case, a diagnostic wouldn't be sufficient.  I am creating a set of default configuration files for cross compilation, e.g. `aarch64-android-linux-clang++.cfg` contains `-isysroot` with a known fixed path.  This allows me to pass `clang++ --target=aarch64-android-linux` with no additional flags to cross compile.  I would like to do the same for Apple targets (not with the system compiler), but since the path is not fixed I cannot embed `-isysroot`.  If there is enough opposition to this being default behavior, I'd be open to it being opt-in with something like `--detect-xcode`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136315/new/

https://reviews.llvm.org/D136315



More information about the cfe-commits mailing list