Cross-Compilation
Build binaries for multiple platforms from a single machine
Anodizer supports three cross-compilation strategies, configurable via the cross field.
Strategies
| Strategy | Tool | Best for |
|---|---|---|
auto | Auto-detects best option | Default — tries zigbuild, then cross, then native cargo |
zigbuild | cargo-zigbuild | Fast, minimal setup, works for most targets |
cross | cross | Targets requiring system libraries (e.g., OpenSSL) |
cargo | Native cargo build | Same-platform targets only |
Config
defaults:
cross: auto # auto | zigbuild | cross | cargo
Per-crate override:
crates:
- name: myapp
cross: zigbuild # override default for this crateHow auto-detection works
When cross: auto (the default):
- If the target matches the host triple → use native
cargo build - If
cargo-zigbuildis installed → use it - If
crossis installed → use it - Fall back to native
cargo build(may fail for cross-platform targets)
Run anodizer healthcheck to see which tools are available.
Installing cross-compilation tools
# cargo-zigbuild (recommended for most cases)
cargo install cargo-zigbuild
# cross (for targets needing system libraries)
cargo install crossParallelism
Control the number of parallel build jobs with --parallelism / -p:
anodizer release -p 4 # max 4 parallel builds
anodizer release -p 1 # sequential builds
Defaults to the number of logical CPUs.
Single-target builds
For local testing, build only for your host platform:
anodizer release --single-target