zig-cross

Cross-compile Zig and C code to arbitrary target triples and architectures.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/awfixers-stuff/opencode-config --skill zig-cross-awfixers-stuff
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: zig-cross
Source: https://github.com/awfixers-stuff/opencode-config/tree/main/skills/zig-cross
Command: npx skills add https://github.com/awfixers-stuff/opencode-config --skill zig-cross-awfixers-stuff

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Enable developers to produce binaries for different architectures and operating systems from a single development environment without requiring system cross-toolchains, reducing build friction for embedded, WASM, Windows, macOS, and ARM targets.

Core Features & Use Cases

  • Native Zig cross-compilation: Use Zig's built-in cross support to build for many target triples without Docker or external toolchains.
  • zig cc for C code: Cross-compile C sources and link with musl or glibc statically or dynamically using zig cc as a drop-in cross-compiler.
  • Embedded and WASM workflows: Support for freestanding targets with linker scripts for Cortex-M and other MCUs, plus wasm32-freestanding and wasm32-wasi outputs.
  • Real-world example: Build a release-optimized aarch64 Linux executable from a Linux x86_64 host, produce a Windows .exe from Linux, or create a Cortex-M4 bare-metal firmware image with a custom linker script.

Quick Start

Ask the skill to cross-compile your Zig project to a specific target triple, for example build my Zig project for aarch64-linux-gnu with ReleaseFast optimization.

Frequently Asked Questions about zig-cross

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cross-compile a Zig project for a different target architecture?

You can cross-compile C code using zig cc as a drop-in cross-compiler, linking statically or dynamically with musl or glibc. This allows you to build C sources for various target triples from a single development environment.

Can I use Zig to build bare-metal embedded firmware for Cortex-M microcontrollers?

Zig supports freestanding targets for embedded bare-metal workflows, allowing you to create Cortex-M firmware images. You can use custom linker scripts to build your embedded projects directly without an external cross-toolchain.

Does Zig cross-compilation work for WebAssembly and WASI targets?

Zig cross-compilation supports WebAssembly workflows, outputting both wasm32-freestanding and wasm32-wasi binaries. This enables you to compile Zig programs for WASI environments directly from your host system.

Do I need a system cross-toolchain or Docker to cross-compile with Zig?

No system cross-toolchain or Docker is required for most Zig cross-compilation tasks, reducing build friction. You only need platform SDKs like macOS when targeting specific proprietary operating systems.