Release Build Research: Cross-Platform Rust CLI Distribution
1. Target Platforms
Platform
Target Triple
Rust Tier
Build Strategy
Notes
Windows x86_64
x86_64-pc-windows-msvc
Tier 1
Native MSVC or cross
Primary Windows target
Windows ARM64
aarch64-pc-windows-msvc
Tier 1
Native or cross
Surface Pro, Snapdragon laptops
macOS Intel
x86_64-apple-darwin
Tier 2
Native Xcode
Intel Macs (declining)
macOS Apple Silicon
aarch64-apple-darwin
Tier 1
Native Xcode
Primary Mac target
Linux x86_64 (glibc)
x86_64-unknown-linux-gnu
Tier 1
Native or cross
Primary Linux desktop
Linux ARM64 (glibc)
aarch64-unknown-linux-gnu
Tier 1
Native or cross
Raspberry Pi 4/5, AWS Graviton
Linux x86_64 (musl)
x86_64-unknown-linux-musl
Tier 2
cargo-zigbuild
Static binary, Alpine/containers
Linux ARM64 (musl)
aarch64-unknown-linux-musl
Tier 2
cargo-zigbuild
Static ARM64, containers
OpenBSD x86_64
x86_64-unknown-openbsd
Tier 3
Native build only
No cross-image available
OpenBSD is Tier 3 — Rust project does not build or test it automatically. rustup target add works but std may have bugs. No Docker cross-image from cross-rs. Must build natively or via zig (experimental).
2. Release Profile Optimization
Industry-standard [profile.release] for Rust CLI tools:
[profile.release]
opt-level = 3 # max speed (use "s" for size-constrained)
lto = "thin" # thin LTO — good speed/compile-time balance
codegen-units = 1 # max optimization (single codegen unit)
strip = "symbols" # strip all symbols for smaller binary
panic = "abort" # no unwinding — smaller binary, faster startup
mlua with vendored feature builds LuaJIT from C source. Critical for cross-compilation:
Works with all targets (C compiler needed via cc crate)
zig provides C cross-compiler — cargo-zigbuild handles this
cross Docker images include C toolchain
macOS: system clang works
Windows MSVC: needs cl.exe (CI provides this). Known limitation: cargo-zigbuild cross-compiling to *-windows-msvc from Linux/macOS may lack Windows import libraries (.lib files) for some Win32 APIs. Mitigations: (1) build Windows targets on native Windows CI runners, (2) fall back to *-windows-gnu targets for cross-builds (zig has better MinGW support), or (3) ship Windows CI-built artifacts only.
Android/Termux ARM64 linker note
P2d proved vendored LuaJIT can link on Android/Termux ARM64. The missing symbol
from the original failed static build was __clear_cache, provided by
compiler-rt builtins. Rust's linker path may need the Android compiler-rt
builtins library that clang normally adds automatically:
This keeps the preferred release path as mlua + luajit + vendored rather
than falling back to a non-JIT Lua runtime.
7. Key Dependency: syntastica
P16 verified syntastica with runtime-c2rust on Android/Termux. This avoids a
libtree-sitter C runtime and avoids syntect's Oniguruma dependency. Release
builds should measure grammar-set size, but the dependency is Android-safe and
fits the v1 syntax-highlighting requirement.
8. OpenBSD Strategy
Options for Tier 3 target:
cargo-zigbuild — zig ships cross-linker for OpenBSD (experimental, may work)
Native build — build on actual OpenBSD VM/machine (most reliable)
Best-effort — document as "community supported, no CI"
Recommendation: Start with option 3 (best-effort). Add native OpenBSD CI runner if user demand warrants it.