[clang] [clang] Support --sysroot= for ${arch}-windows-msvc targets (PR #96417)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 17:55:29 PDT 2026


trcrsired wrote:

> I think the spirit of this MR is useful, allowing `clang --sysroot` on any platform to target `{arch}-pc-windows-msvc`.
> 
> However, I agree with @zmodem when he says this:
> 
> > This is about using clang with MSVC/Win SDK turned into a Unix-style sysroot
> 
> @trcrsired, I don't think it was said that 'cross-compilation is a narrow scenario', instead it was 'making the Windows SDK and MSVC STL into a Unix-like sysroot' is a narrow scenario, which is broadly true.
> 
> Shoehorning the Windows SDK and MSVC STL into a Unix-like layout is, in my opinion, too much to ask of the user. We _can_ support this scenario, I won't say no either, but I believe the proper way is to get Clang to accept the layout as-is from the [Build Tools installer](https://aka.ms/vs/stable/vs_BuildTools.exe) (for example). Surely `clang-cl` already has all this machinery, and it is a matter of wiring up the discovered paths to clang++, with case-insensitive handling on case-sensitive filesystems.
> 
> The most obvious, first-party way to set up an MSVC ABI + MSVC STL cross-compile environment on Unix-like environments would be to use the above installer on Windows itself or maybe WINE and install it to a case-insensitive FS, mount that filesystem on the Unix-like host, and then write `clang --sysroot=...`. If you are running `clang` on your Android phone, this would entail copy-pasting the Windows SDK and MSVC STL into an SD card, loading it up, and then writing `clang --sysroot=/sdcard/VC/...` or something similar.
> 
> I'm not sure this functionality is present in the current PR, which is what I discussed in the first place. There is a lot of demand for this setup, I agree, but asking the user to do this extra work is not very ergonomic (and now that the links to the external GitHub page and scripts are gone, is less discoverable as well).

clang --sysroot is POSIX SYSROOT even LLVM itself does it. If that is what you want (case insensitive and other bs), it is YOU who need to do the job. Why ask me to do the job i do not even need? It does not make any sense. You are exploiting my free labor without paying me. How are you so ignorant? People like you who do not even do cross compiling, and here to troll to ruin my PR. Why? I have explained why case insensitive is a bad idea and you are literally imagine a world with SD card which is not even the world we live in any more.

Compiler is a tool, it should serve the people first, not some ideology bs.

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


More information about the cfe-commits mailing list