Skip to main content

Cross-Compilation

Build binaries for multiple platforms from a single machine

Anodizer supports three cross-compilation strategies, configurable via the cross field.

Strategies

StrategyToolBest for
autoAuto-detects best optionDefault — tries zigbuild, then cross, then native cargo
zigbuildcargo-zigbuildFast, minimal setup, works for most targets
crosscrossTargets requiring system libraries (e.g., OpenSSL)
cargoNative cargo buildSame-platform targets only

Config

defaults:
  cross: auto    # auto | zigbuild | cross | cargo

Per-crate override:

crates:
  - name: myapp
    cross: zigbuild    # override default for this crate

How auto-detection works

When cross: auto (the default):

  1. If the target matches the host triple → use native cargo build
  2. If cargo-zigbuild is installed → use it
  3. If cross is installed → use it
  4. 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 cross

Parallelism

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