rust-cross
Rust cross-compilation skill. Use when building Rust binaries for a different target architecture or OS, using cross or cargo-zigbuild for hermetic cross-compilation, configuring .cargo/config.toml for cross targets, or targeting embedded and bare-metal systems. Activates on queries about Rust cross
By mohitmishra786 · 401 installs
npx skills add mohitmishra786/low-level-dev-skills --skill rust-cross
Source repository · Upstream listing
Rust Cross Compilation
Purpose
Guide agents through Rust cross compilation: adding rustup targets, using cross for hermetic Docker based cross builds, cargo zigbuild for zero setup cross compilation, .cargo/config.toml configuration, and embedded bare metal targets.
Triggers
"How do I cross compile Rust for ARM/aarch64?"
"How do I build a Rust binary for a different OS?"
"How do I use the cross tool for Rust cross compilation?"
"How do I build Rust for embedded (no std) targets?"
"How do I use cargo zigbuild?"
"My cross compiled Rust binary won't run on the target"
Workflow
1. Add a rustup target
2. Common target triples
Target Use case
x86 64 unknown linux gnu Linux x86 64 (glibc)
x86 64 unknown linux musl Linux x86 64 (musl, static)
aarch64 unknown linux gnu ARM64 Linux (Raspberry Pi 4, AWS Graviton)
aarch64 unknown linux musl ARM64 Linux static
x86 64 pc windows gnu Windows x86 64 (MinGW)
x86 64 pc windows msvc Windows x86 64 (MSVC)
x86 64 apple darwin macOS x86 64
aarch64 apple darwin macOS Apple Silicon
wasm32 unknown unknown WASM (browser)
wasm32 wasi WASM with WASI
thumbv7m none eabi Cortex M3 bare metal
thumbv7em none eabihf Cortex M4/M7 with FPU
riscv32imac unknown none elf RISC V 32 bit bare metal
3. cross tool (Docker based, easiest)
cross uses pre built Docker images with the correct cross toolchain:
4. cargo zigbuild (zero setup, uses zig cc)
zig cc ships a complete C cross toolchain — no system cross compiler needed:
cargo zigbuild advantages over cross :
No Docker required
Faster (no container startup)
Works for most targets out of the box
Supports precise glibc version targeting
5. .cargo/config.toml for cross targets
6. Static binaries with musl
7. Embedded bare metal ( [no std])
For target triple reference and embedded setup details, see [references/](references/).
Related skills
Use skills/rust/rustc basics for compiler and profile configuration
Use skills/compilers/cross gcc for the underlying cross compiler setup
Use skills/zig/zig cross for Zig's native cross compilation approach
Use skills/build systems/cmake when Rust is part of a CMake cross build