Building Windows/ARM64 binaries with Cygwin clang?
Jeremy Drake
cygwin@jdrake.com
Tue Sep 9 17:25:11 GMT 2025
On Tue, 9 Sep 2025, Mark Liam Brown via Cygwin wrote:
> Greetings!
>
> Can Cygwin 3.7 clang generate Windows/ARM64 binaries somehow?
>
> My attempts so far are a failure:
> clang -target aarch64-pc-windows-gnu -std=gnu17 -Wall -g grapetest1.c
> -lntdll -o grapetest1.x86_64.exe
> grapetest1.c:34:10: fatal error: 'windows.h' file not found
> 34 | #include <windows.h>
> | ^~~~~~~~~~~
> 1 error generated.
>
Yes, but you need a sysroot. I have tested the scripts at
https://github.com/mstorsjo/llvm-mingw you can use
"LLVM_VERSION=llvmorg-20.1.8 ./build-all.sh --host-clang /opt/llvm-mingw"
(or wherever you want things installed) and it will make sysroots and
cross toolchain links for i686/x86_64/armv7/aarch64 in there. You may
need to set the llvm version via environment variable
"LLVM_VERSION=llvmorg-20.1.8", I think it defaults to 21.1.0 now.
You will need llvm, clang and lld, plus normal host development tools
(make, cmake, ninja, etc).
More information about the Cygwin
mailing list