This repository contains scripts for building an aarch64-w64-mingw32
target Windows on Arm64
GNU toolchain cross-compiler for x86_64-pc-linux-gnu
or aarch64-pc-linux-gnu
hosts.
It is a work in progress, with ongoing efforts to upstream the necessary changes to
the corresponding repositories. The resulting toolchain produces binaries that can be executed
on Windows on Arm64 and are built on Linux. The scripts are actively tested on the default
Ubuntu 22.04 GitHub Actions runners and Ubuntu 22.04 in WSL.
This toolchain is not yet ready for real-world use. Problems and missing parts are listed in the issues. Please, report all issues, even if the issue is, e.g., GCC-specific, here.
The main build script
installs its dependencies automatically when the RUN_BOOTSTRAP=1
environment variable is defined,
which is the default. To see what will be installed refer to
.github/scripts/install-dependencies.sh
.
To build the cross-compiler and install it into a ~/cross-aarch64-w64-mingw32-msvcrt
folder,
follow these steps:
-
Clone the repository:
git clone https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build.git
-
Navigate to the root repository folder:
cd mingw-woarm64-build
-
Run the build script:
./build.sh
To install the toolchain into a different folder you can use the TOOLCHAIN_PATH
environment
variable:
TOOLCHAIN_PATH=/opt/aarch64-w64-mingw32 ./build.sh
To skip the dependencies bootstrapping process and fetching source code repositories for consecutive builds you can use other environment variables:
RUN_BOOTSTRAP=0 UPDATE_SOURCES=0 ./build.sh
The build script does multiple things:
- Installs the dependency Ubuntu packages.
- Clones several dependency source code repositories:
- modified binutils from Windows-on-ARM-Experiments/binutils-woarm64,
- modified GCC from Windows-on-ARM-Experiments/gcc-woarm64,
- modified MinGW from Windows-on-ARM-Experiments/mingw-woarm64.
- Bootstraps the binutils and GCC sources with
gmp
,mpfr
,isl
, etc. dependencies. - Builds and installs binutils, stage 1 GCC, MinGW runtimes, GCC with libgcc, and then the entire MinGW.
After building the toolchain, to build a simple C source code file run:
export PATH="~/cross-aarch64-w64-mingw32-msvcrt/bin:$PATH"
aarch64-w64-mingw32-gcc hello.c -o hello.exe
You can also build a set of basic AArch64-specific tests using:
.github/scripts/tests/build.sh
This step requires a working CMake executable in your environment and will place the resulting binaries
into the tests/build/bin
folder.
We are testing the toolchain binaries with the GCC test suite and against four example projects builds (OpenSSL, FFmpeg, OpenBLAS, libjpeg-turbo) and their testing suites.
As of 2024/08/09 we are reaching the following level of quality with the GCC testing targeting armv8-a without optional extensions such as SVE:
Metric | Count |
---|---|
Expected passes | 573324 |
Unexpected failures | 12118 |
Unexpected successes | 172 |
Expected failures | 4528 |
Unresolved testcases | 7363 |
Unsupported tests | 10774 |
DejaGnu errors | 0 |
Total | 608279 |
Reliability rate | 96% |