Axle v0.14.1

Build the compiler

For everyday use, install the pre-built axle binary — see Install the compiler. This page is for hacking on the compiler itself: building the workspace from source, running the full test suite, iterating on a patch.

The Axle compiler is a Rust workspace. To build from source you need the Rust toolchain the repository pins in rust-toolchain.toml (channel 1.94.1) and LLVM 21. rustup reads the pin and installs that toolchain automatically on first build.

Prerequisites

Linux (Ubuntu / Debian)

sudo apt-get install -y \
    llvm-21 llvm-21-dev \
    lld-21 liblld-21-dev clang-21 build-essential pkg-config
export LLVM_SYS_211_PREFIX=/usr/lib/llvm-21

macOS

brew install llvm@21
export LLVM_SYS_211_PREFIX=$(brew --prefix llvm@21)

Windows

Download the official clang+llvm-21.1.8-x86_64-pc-windows-msvc.tar.xz release and set LLVM_SYS_211_PREFIX to its extracted root. The LLVM 21 Windows libraries are built against the static CRT (/MT), so the build needs a +crt-static rustflag.

No libxml2 is needed, even though that release names one: the build supplies the empty libxml2s.lib llvm-config --system-libs asks for, and the compiler links LLD with LLVM’s no-libxml2 manifest merger. The full, reproducible Windows setup — including the .cargo/config.toml and the Windows SDK -L native= paths — is documented in SETUP-WINDOWS.md.

Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Installing rustup is enough: the repository’s rust-toolchain.toml selects 1.94.1, and rustup fetches it on the first build — no rustup default needed.

Build the workspace

git clone https://gitlab.com/axle-lang/axle.git
cd axle
cargo build --workspace --release

The axle driver lands at target/release/axle (or target\release\axle.exe on Windows). Drop it on your PATH or invoke it directly via the full path.

The shipped runtime archives are built differently. The compiler links four static libraries into every program (axle_stdlib, axle_runtime, axle_tls, axle_reactor), and cargo build --workspace --release does produce them — so a from-source build works. What it does not produce is the archives that ship: tools/build-libs.sh builds those on a pinned nightly with -Zbuild-std, stripping std’s panic reporter. The cargo-built archives keep panic messages, so a locally built binary links larger than a released one. Run tools/build-libs.sh before quoting a binary size.

Run the test suite

cargo test --workspace --release

The release-mode build takes a few minutes the first time (LLVM static link), then the incremental rebuilds are seconds. cargo-nextest is a faster drop-in if you prefer:

cargo install --locked cargo-nextest
cargo nextest run --workspace

Lint

cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings

Both run in CI on every MR; running them locally before pushing keeps your pipeline green.

What’s next

  • The CLI subcommands are the same whether you installed via apt or built from source — see Install → CLI subcommands.
  • The compiler’s internal architecture (the analyses it runs and the lowering it performs) is summarised user-side in Compiler internals.

See also

buildfrom-sourcellvmcontributing