carlocab wrote:

> Would a modification to this PR to effectively do this at LLVM install time 
> be agreeable?
> ```bash
> echo "--sysroot=$(xcrun --show-sdk-path)" > ${LLVM_INSTALL_DIR}/bin/clang.cfg
> ```

Using a config file instead of `DEFAULT_SYSROOT` is directionally better, but I 
have some concerns:

1. The LLVM build system has never auto-generated `.cfg` files into the install 
directory. The existing `.cfg` generation in the cross-compilation caches 
(`CrossWinToARMLinux.cmake`, `cross-linux-toolchain.cmake`) writes only into 
the build directory and never installs them. Config files have always been 
intended as something users and packagers create, not something the build 
system emits.

2. `cmake --install` would silently overwrite any user-created `clang.cfg` in 
the install prefix. There's no mechanism to detect or preserve an existing file 
during installation.

3. `clang.cfg` only applies to C-mode invocations, not `clang++`. A 
triple-based config file (e.g., `arm64-apple-macos.cfg`) would be more 
appropriate since the sysroot is target-specific, but that adds complexity.

4. The SDK path is still captured at build/install time and can go stale after 
an Xcode update, just as with `DEFAULT_SYSROOT`.

If you'd like to pursue the config file direction, I think it would warrant an 
RFC on Discourse first, since it would establish a new pattern for the project.

https://github.com/llvm/llvm-project/pull/185986
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to