mirror of
https://github.com/ziglang/zig.git
synced 2024-11-21 11:32:24 +00:00
Page:
Setting up an ARM64 Windows Dev Kit to be a CI Runner
Pages
Building Zig From Source
Building Zig on Windows
Community Projects
Community
Contributing
Development with nix
FAQ
Glossary
Home
How to build LLVM, libclang, and liblld from source
How to read the standard library source code
Install Zig from a Package Manager
LLVM Upgrade Process
Language Proposals
Self Hosted Compiler Upgrade Guide
Setting up a new x86_64 Linux CI server
Setting up an ARM64 Windows Dev Kit to be a CI Runner
Third Party Tracking Issues (what is important to other people?)
Troubleshooting Build Issues
Updating libc
Using Cast Result Type Inference
Why Zig When There is Already CPP, D, and Rust?
_Build
zig cc compatibility with clang
3
Setting up an ARM64 Windows Dev Kit to be a CI Runner
Andrew Kelley edited this page 2024-03-31 17:28:42 -07:00
Table of Contents
Install CMake and Git by opening PowerShell in Administrator Mode and running these commands:
winget install --id Git.Git -e --source winget
winget install --id Kitware.CMake -e --source winget
Cross-compile Ninja for aarch64-windows:
git clone https://github.com/ninja-build/ninja
cd ninja
git checkout v1.11.1
Apply this patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70fc5e9..8b90dad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,15 +5,7 @@ include(CheckIPOSupported)
project(ninja)
-# --- optional link-time optimization
-check_ipo_supported(RESULT lto_supported OUTPUT error)
-
-if(lto_supported)
- message(STATUS "IPO / LTO enabled")
- set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
-else()
- message(STATUS "IPO / LTO not supported: <${error}>")
-endif()
+set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE FALSE)
# --- compiler flags
if(MSVC)
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/dist -DCMAKE_AR="$HOME/local/llvm15-release/bin/llvm-ar" -DCMAKE_CXX_COMPILER_AR="$HOME/local/llvm15-release/bin/llvm-ar" -DCMAKE_RANLIB="$HOME/local/llvm15-release/bin/llvm-ranlib" -DCMAKE_CXX_COMPILER_RANLIB="$HOME/local/llvm15-release/bin/llvm-ranlib" -DCMAKE_C_COMPILER_AR="$HOME/local/llvm15-release/bin/llvm-ar" -DCMAKE_C_COMPILER_RANLIB="$HOME/local/llvm15-release/bin/llvm-ranlib" -DCMAKE_CROSSCOMPILING=True -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER="$HOME/local/llvm15-release/bin/llvm-rc"
make install
This produces dist/bin/ninja.exe
which you can send to your Windows machine with WebWormhole.
You must then put ninja.exe into one of the directories in the system-wide Path
environment variable (or add a new directory to that environment variable if necessary). This is how CMake detects the existence of Ninja.
Troubleshooting
Situation: aarch64-windows CI runners stop responding.
Probable cause:
- A Windows Update caused the box to restart.
- The Actions Runner service did not get automatically started on boot like it was supposed to.
- GitHub puts the runner into some kind of zombie state where it is not deleted but also can't be started.
Steps to fix it:
- Plug in a monitor and keyboard and see the screen that says "Let's finish setting up your PC."
- There is no button that says "never do this", you have to click "finish later". This is to make sure you understand that Microsoft doesn't give a shit about what you want. This is Microsoft's computer, not yours.
- Log in and do the windows update manually, because it still didn't even complete successfully on its own.
- The system time is incorrect somehow. Go to Windows Time & Language control panel, toggle "Set time automatically" to OFF, then back to ON. System time becomes correct again.
- Run powershell as an administrator.
- Now you think that you can just restart the service. Think again. If you do, it will say "Failed to create a session because the registration has been deleted from the server. Please re-configure".
- However, if you follow those instructions, it says "Cannot configure the runner because it is already configured. To reconfigure the runner, run 'config.cmd remove' first".
- Ignore the unsolicited advertisement to install Copilot.
- Run .\config.cmd remove and it asks for a runner remove token
- Go to github and click Remove Runner, copy the token, and complete the remove command.
- Go to github and click Add Runner and then use that token to run the .\config.cmd again. Go through the configuration again.
- Repeat this process for the 2nd self-hosted runner instance on the same machine