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

Steven Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 20 11:12:06 PST 2023


steven_wu added a comment.

This is not an apple platform problem. This is a cross compile problem where you have a SDK that is installed for cross compile target. In those cases, you just can't hard code the path to isysroot, and figuring out the sysroot is generally considered a problem for the build system, not the problem for compiler. If you have a config file, you can definitely setup `SDKROOT` in your configuration system after running `xcrun`. A similar but identical problem is if you just install clang package but didn't install dev packages on a linux platform where you just can't find any headers. Same error, just different causes.

To be clear, I am not against adding features in clang to make user experience better, but I think this needs some polish to addresses problem mentioned above transparently.



================
Comment at: clang/test/Driver/darwin-sdk-detect.c:1
+// REQUIRES: system-darwin
+
----------------
This test won't work in all conditions. Like I said, you requires to have a Xcode/CommandLineTools installation to make `xcrun` work.

Maybe you can make the argument that you are compiling clang, so you must have one of those installed, but CommandLineTools definitely doesn't have iOS SDK for the second test.


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