steven_wu added a comment.

In D136315#4069849 <https://reviews.llvm.org/D136315#4069849>, @calebzulawski 
wrote:

> In my situation, at least, I am the vendor of the toolchain and my 
> configuration file contains `--sysroot=<CFGDIR>/../path/to/sysroot` with a 
> known relative path to where the sysroot is distributed.  Apple is unique in 
> this situation, since I am not distributing the sysroot, so there is no 
> equivalent to using the `<CFGDIR>` variable.  There is no way to invoke 
> `xcrun` or set `SDKROOT` from config files, only pass flags.
>
> It is true that the build system could do it, but I think it's reasonable for 
> the driver to make a guess when not provided.  I don't think it's all that 
> different than detection of libstdc++ from GCC installs.

I definitely feel like if to fix your problem, a reverse option like 
`-infer-sdkroot-from-xcrun` might be better/safer but it doesn't help the 
general case where people doesn't know `/usr/bin/clang` is different from a 
regular clang that a regular clang needs to pass -isysroot.

@arphaman Any suggestions?



================
Comment at: clang/test/Driver/darwin-sdk-detect.c:1
+// REQUIRES: system-darwin
+
----------------
calebzulawski wrote:
> steven_wu wrote:
> > 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.
> True, maybe we can just remove the iOS test if you think that's sufficient.  
> Otherwise, is there any way to make the have the test check that either the 
> `-isysroot` flag is present with that pattern, or not present at all?  I'm 
> not too familiar with llvm-lit, I just browsed a few other examples before 
> writing this.
I don't think you can write a FileCheck with that. The best way to do this test 
might be in `clang/test/Driver/lit.local.cfg` write checks to make sure:
* Darwin platform
* `xcrun` exists
* xcrun can resolve all the platforms you want to test

Then add a new feature which you can `REQUIRES` in this test case.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136315

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to