Build & Run
The rx build and rx run commands compile your project with automatic fast linker detection, artifact caching, and cross-compilation support.
Basic usage
rx build # debug build
rx build --release # release build
rx run # build and run the binary
rx run -- --port 8080 # pass arguments to the binary
rx check # type-check only (no codegen)
Fast linker
rx auto-detects the fastest available linker on your system:
- mold – fastest, preferred when available
- lld – fast, widely available
- system – default fallback (cc/ld)
The detected linker is cached at ~/.rx/env.lock so detection only runs once. Override it in rx.toml:
[build]
linker = "mold" # or "lld", "system", "auto"
Cross-compilation
rx build --target aarch64-unknown-linux-gnu
rx build --target wasm32-unknown-unknown
rx build --target x86_64-pc-windows-msvc
rx passes the --target flag through to cargo. Ensure the target is installed:
rustup target add aarch64-unknown-linux-gnu
Note: cross-compiled builds always invoke cargo directly — the artifact cache never answers --target or --package builds.
Caching
When cache = true (opt-in, off by default — see PRODUCT.md), rx maintains a global content-addressed cache at ~/.rx/cache:
- Mtime check – if no source file has changed, skip everything
- Fingerprint – compute xxh3-128 hash of sources, Cargo.toml, Cargo.lock, profile, and RUSTFLAGS
- Cache hit – restore artifacts via reflink/hardlink into
target/ - Cache miss – build normally, then store artifacts for next time
Disable caching per-command or in config:
rx build --no-cache # skip cache for this build
[build]
cache = false
Incremental linking
When incremental_link = true (the default), rx enables:
- split-debuginfo – keeps debug info separate from the binary
--as-needed– only links referenced libraries
This significantly reduces link times for iterative debug builds.
RUSTFLAGS
Add extra RUSTFLAGS in rx.toml:
[build]
rustflags = ["-C", "target-cpu=native"]
These are appended to any existing RUSTFLAGS environment variable.
Parallel jobs
[build]
jobs = 0 # auto-detect (default)
jobs = 4 # use exactly 4 parallel jobs
Flags reference
| Flag | Description |
|---|---|
--release | Build in release mode |
--target <triple> | Cross-compile for a target |
--no-cache | Skip artifact cache |
--verbose | Show cache paths and timing |
--quiet | Suppress non-error output |
--profile <name> | Use a config profile |
Related commands
rx check– type-check without building (faster feedback loop)rx clean– remove build artifactsrx clean --gc– clean and garbage-collect the global cache