Automatically assemble Windows Sysroots directly from Microsoft sources
This requires an up-to-date Go toolchain, currently there are no precompiled binaries provided.
go install git.dolansoft.org/lorenz/winsysroot@latest
It also requires LLVM 15 or higher with lld-link, which you need to install for your platform.
First, generate a sysroot. If you're content with the defaults (x64 only with SDK 10.0.20348), just call
winsysroot --out-dir=somewere/my-sysroot
The full option list can be shown using --help
.
Note that this does NOT need a case-insensitive directory on Linux/MacOS. It doesn't break it, but it is also not required.
This sysroot can then be used either standalone or with the included wrapper scripts:
WINSYSROOT=somewere/my-sysroot wrappers/clang-cl-x64 /o examples/helloworld-x64.exe examples/helloworld.cc
If your clang-cl is not called clang-cl
, you can set the CLANG_CL
environment variable to what
it is in your environment.
Probably. I'm not a lawyer and this is not legal advice, but I'm not distributing any non-redistributable Microsoft content or circumventing any licensing schemes, you're downloading all content directly from Microsoft's servers (just a lot more efficiently). Note that you cannot legally distribute any sysroots generated from this tool without Microsoft's permission.