zig-cross
Zig cross-compilation skill. Use when cross-compiling Zig programs to different targets, using Zig's built-in cross-compilation for embedded, WASM, Windows, ARM, or using zig cc to cross-compile C code without a system cross-toolchain. Activates on queries about Zig cross-compilation, zig target tri
By mohitmishra786 · 396 installs
npx skills add mohitmishra786/low-level-dev-skills --skill zig-cross
Source repository · Upstream listing
Zig Cross Compilation
Purpose
Guide agents through Zig's built in cross compilation: target triple selection, CPU feature targeting, zig cc for cross compiling C projects, embedded bare metal targets, and WASM output — all without requiring a system cross toolchain.
Triggers
"How do I cross compile a Zig program for ARM?"
"How do I build Zig for a different OS?"
"How do I use Zig to cross compile C code for another platform?"
"How do I build Zig for embedded/bare metal?"
"How do I target WebAssembly with Zig?"
"What Zig target triple do I use for Raspberry Pi?"
Workflow
1. Zig's native cross compilation
Zig has cross compilation built in — no cross toolchain, no Docker, no sysroot needed for pure Zig code:
2. Common target triples
Target triple Platform
x86 64 linux gnu Linux x86 64 (glibc)
x86 64 linux musl Linux x86 64 (musl, static)
aarch64 linux gnu ARM64 Linux (Pi 4, AWS Graviton)
aarch64 linux musl ARM64 Linux static
armv7 linux gnueabihf ARM 32 bit Linux (Pi 2/3)
x86 64 windows gnu Windows x86 64
aarch64 macos none macOS Apple Silicon
x86 64 macos none macOS Intel
wasm32 freestanding WASM (browser, no OS)
wasm32 wasi WASM with WASI
thumbv7m freestanding eabi Cortex M3 bare metal
thumbv7em freestanding eabihf Cortex M4/M7 with FPU
riscv32 freestanding RISC V 32 bit bare metal
3. CPU feature targeting
4. zig cc for C cross compilation
zig cc cross compiles C without a system cross toolchain:
5. Build system cross compilation
6. Embedded (bare metal) targets
7. WebAssembly
For target triple reference and embedded linker script setup, see [references/zig target triples.md](references/zig target triples.md).
Related skills
Use skills/zig/zig compiler for single file compilation flags
Use skills/zig/zig build system for multi target build.zig configuration
Use skills/compilers/cross gcc for system cross toolchain setup when needed
Use skills/rust/rust cross for Rust's cross compilation approach comparison