llvm-mingw is a
clang toolchain that builds Windows programs for aarch64,
armv7, i686 and x86_64. This gets
you release 20260826 of it, unpacked into a directory, without
downloading and expanding a release archive on every machine and every
CI runner.
Only the parts you do not already have are downloaded, so a second toolchain and the next release both cost much less than the first.
Fetching is done by desync, one binary, kept in this repository so there is nothing to install or build. Take the one for your machine:
# Linux, including WSL
curl -fsSLo desync https://github.com/V-Sekai/casync-llvm-mingw/raw/main/desync/linux_amd64/desync
chmod +x desync
# macOS, Apple silicon. For an Intel Mac use darwin_amd64.
curl -fsSLo desync https://github.com/V-Sekai/casync-llvm-mingw/raw/main/desync/darwin_arm64/desync
chmod +x desync
On Windows, in PowerShell:
curl.exe -fsSLo desync.exe https://github.com/V-Sekai/casync-llvm-mingw/raw/main/desync/windows_amd64/desync.exe
linux_arm64 and windows_arm64 are there
too. If you would rather build it,
go install github.com/folbricht/desync/cmd/desync@latest
gets you the same tool.
Take the toolchain for the machine that will run the compiler. The
Windows one unpacks and runs on Windows as it is. The Linux and macOS
ones carry symlinks that a Windows filesystem cannot hold, so if you
want one of those on a Windows machine, fetch it under WSL and into your
WSL home directory rather than /mnt/c.
Nothing needs to be cloned.
mkdir -p ~/.local/casync-store
# Linux, including WSL
./desync untar --no-same-owner --cache ~/.local/casync-store \
--store https://v-sekai.github.io/casync-llvm-mingw/store \
--index https://github.com/V-Sekai/casync-llvm-mingw/raw/main/llvm-mingw-20260826-ucrt-ubuntu-22.04-x86_64.caidx \
llvm-mingw
# macOS
./desync untar --no-same-owner --cache ~/.local/casync-store \
--store https://v-sekai.github.io/casync-llvm-mingw/store \
--index https://github.com/V-Sekai/casync-llvm-mingw/raw/main/llvm-mingw-20260826-ucrt-macos-universal.caidx \
llvm-mingw
On Windows, in PowerShell:
New-Item -ItemType Directory -Force $HOME\.local\casync-store
.\desync.exe untar --no-same-owner --cache $HOME\.local\casync-store --store https://v-sekai.github.io/casync-llvm-mingw/store --index https://github.com/V-Sekai/casync-llvm-mingw/raw/main/llvm-mingw-20260826-ucrt-x86_64.caidx llvm-mingw
Expect 600 to 750 MB in the llvm-mingw directory. It
takes a few seconds on Linux or macOS, and a minute or two on Windows,
which writes the 9317 files more slowly. Keep the --cache
directory: the next toolchain you fetch reuses what is already in
it.
export PATH="$PWD/llvm-mingw/bin:$PATH"
x86_64-w64-mingw32-clang --version
Then build for Windows from wherever you are:
echo 'int main(void){return 0;}' > hello.c
x86_64-w64-mingw32-clang hello.c -o hello.exe
Swap the triple for aarch64-, armv7- or
i686-w64-mingw32-clang to target the other architectures.
clang++, ld, ar and the rest are
in the same bin directory under the same prefixes. On
Windows the compilers are also there under their plain names, so
llvm-mingw\bin\clang.exe works.
| What you see | What it means |
|---|---|
desync: command not found |
Run it as ./desync, from the directory you downloaded
it into. |
The system cannot find the file specified, naming your
cache |
The --cache directory has to exist first. Run the
mkdir line above. |
operation not permitted on the Linux or macOS
toolchain |
You are on a Windows filesystem. Fetch those two under WSL, into your WSL home directory. |
| The download starts from nothing every time | Pass the same --cache directory on every run. |
Put the upstream tag in VERSION, replace
sources.sha256 with the checksums of that release’s assets,
and run ./build.sh on Linux. It fetches each asset, fails
if a checksum does not match, extracts it, and rebuilds the indexes.
./check_store.sh then verifies the result and
./extract.sh unpacks the toolchains from the checked-out
store, both of which CI runs on every pull request. All three scripts
pick the right desync/ binary for the machine they are
on.
Why the toolchains are kept this way, and how the chunk size was
chosen, are recorded in the decision
20260828-prebuilt-toolchains-as-casync-stores in manuals.