[flang-commits] [flang] [clang] [flang][driver] Add support for -isysroot in the frontend (PR #77365)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Tue Jan 16 10:41:50 PST 2024


luporl wrote:

> > As for the `isysroot.f90` test, I guess it would need to be removed, unless there is some way to run it only when `DEFAULT_SYSROOT` is not set.
> 
> You could also use `DEFAULT_SYSROOT` to define a LIT "feature" and check for that (via e.g. `REQUIRES`) in the test file. That shouldn't be too difficult.
>

Ok, I'll take at look at that.
 
> > But it doesn't seem worth the trouble, as`exec.f90` ends up testing `-isysroot`, when `DEFAULT_SYSROOT` is not specified at config time.
> 
> Wouldn't the behaviour of `exec.f90` change depending on whether the user sets `DEFAULT_SYSROOT`?
> 

The behavior "shouldn't" change, but the sysroot used when linking `exec.f90` may change depending on whether the user sets `DEFAULT_SYSROOT`.

> > My preference is to add support for `--sysroot` on Flang and remove `isysroot.f90`. @kkwli, @banach-space, what are your thoughts on this?
> 
> Can you remind me the benefits of using `-isysroot` over `-sysroot` to begin with? I think that switching to `-sysroot` is fine, but I also want to make sure we're not missing anything.

It seems to me that Apple prefers to use `-isysroot` to select the SDK: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html#//apple_ref/doc/uid/10000163i-CH1-SW1

Also, when grepping through CMake generated files (for llvm), I saw that they use `-isysroot` when compiling sources with the clang binary built from source.

Apart from that, the other difference that I'm aware is that on non-Darwin targets `-isysroot` only sets the sysroot for the includes, while `-sysroot` also affects the libraries. 

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


More information about the flang-commits mailing list