Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Build Options

The [build] section controls Phase 5: compiling the transpiled Rust code into a release binary, WASM module, or cross-compiled target.

Settings

[build]
release = true
wasm = false
cargo_flags = []
KeyTypeDefaultDescription
releasebooltrueBuild with --release optimizations
targetstring(none)Rust target triple for cross-compilation
wasmboolfalseBuild a WebAssembly module instead of a native binary
cargo_flagsarray[]Additional flags passed to cargo build

Release Profile

When release is true (the default), the build uses Cargo’s release profile. Set it to false during development for faster compile times and debug symbols.

LTO and Strip

Pass Cargo profile flags through cargo_flags to enable link-time optimization or strip symbols:

[build]
release = true
cargo_flags = ["--config", "profile.release.lto=true", "--config", "profile.release.strip=true"]

WASM Target Configuration

Set wasm = true to target wasm32-unknown-unknown. Batuta uses wasm-pack if available, falling back to raw cargo build --target wasm32-unknown-unknown. The wasm feature flag is enabled automatically, gating out native-only code paths.

[build]
wasm = true
release = true

Cross-Compilation Targets

Set the target field to any Rust target triple.

[build]
target = "aarch64-unknown-linux-gnu"

Common targets:

TriplePlatform
x86_64-unknown-linux-gnuLinux x86-64 (glibc)
x86_64-unknown-linux-muslLinux x86-64 (static musl)
aarch64-unknown-linux-gnuLinux ARM64
aarch64-apple-darwinmacOS Apple Silicon
wasm32-unknown-unknownWebAssembly (prefer wasm = true)

Ensure the corresponding toolchain is installed before cross-compiling:

rustup target add aarch64-unknown-linux-gnu

Navigate: Table of Contents