Install Quon
Quon is a Rust workspace with native LLVM/MLIR and Z3 dependencies. Use Devbox
for the contributor setup: it pins LLVM/MLIR 22, libz3, Python, Node, and
just, while Rust itself is selected by rust-toolchain.toml.
Recommended setup: Devbox
Section titled “Recommended setup: Devbox”git clone https://github.com/arniber21/quon.gitcd quoncurl -fsSL https://get.jetify.com/devbox | bash # if neededdevbox shell # or: direnv allowjust doctorcargo build -p quoncdevbox.json sets MLIR_SYS_220_PREFIX from llvm-config --prefix via the
local nix/llvm-mlir flake, so Melior sees a single LLVM/MLIR prefix.
Two ways to run just recipes
Section titled “Two ways to run just recipes”Quon orchestrates every build, test, and lint through just recipes (see the
root Justfile, ADR-0012). The recipes are the source of truth; CI invokes
them through devbox run --. You can invoke them two equivalent ways:
-
Inside
devbox shell— the locked LLVM/MLIR 22 + Z3 +justenvironment is already onPATH, so run recipes directly:Terminal window devbox shelljust doctorjust test-ci -
One-shot from the host shell — without entering Devbox, prefix each recipe with
devbox run --. Devbox spins up the locked environment for that single command and tears it down afterwards:Terminal window devbox run -- just doctordevbox run -- just test-ci
First-run toolchain readiness
Section titled “First-run toolchain readiness”Before the first build, run the readiness matrix. It checks the required rows
(MLIR_SYS_220_PREFIX, z3) and the optional rows (.venv + Qiskit, lit,
FileCheck, quonc) and prints OK / MISSING for each:
Inside devbox shell |
One-shot from host shell |
|---|---|
just doctor |
devbox run -- just doctor |
just doctor exits non-zero only when a required row is MISSING; pass
--strict to also fail on optional MISSING rows. Every MISSING row names
its recovery action in its detail column (for example set via devbox shell or export, or just setup-python).
just is unavailable on the host
Section titled “just is unavailable on the host”A bare just ci-samples (or any just ...) on the host shell fails with
command not found: just because just lives inside Devbox, not on the host.
That is expected — recover with either of the two paths above:
devbox shell # stay in the locked environment, then run: just <recipe>devbox run -- just doctor # one-shot: Devbox runs the recipe and exitsDo not install just on the host to silence the error — the Devbox-pinned
just is the supported version. If devbox itself is missing, install it
first: curl -fsSL https://get.jetify.com/devbox | bash.
Main local workflows
Section titled “Main local workflows”Inside devbox shell |
One-shot from host shell | Purpose |
|---|---|---|
just doctor |
devbox run -- just doctor |
Check required tools |
just test-fast |
devbox run -- just test-fast |
Fast Rust-focused path |
just test-ci |
devbox run -- just test-ci |
Local CI-parity path |
Optional: Qiskit Aer verification
Section titled “Optional: Qiskit Aer verification”The compiler CLIs do not require Python at runtime. The Aer verification seam does:
just setup-python # inside devbox shelldevbox run -- just setup-python # one-shot from the host shellsource .venv/bin/activatepython -c "from qiskit_aer import AerSimulator; print(AerSimulator())"With that environment active, the quickstart can compile Quon source and sample the emitted OpenQASM 3 with Qiskit Aer.
Manual source setup
Section titled “Manual source setup”Prefer Devbox for day-to-day work. If you manage the native dependencies
yourself, install LLVM/MLIR 22 and libz3, then set MLIR_SYS_220_PREFIX to the
LLVM installation root.
xcode-select --installbrew install llvm@22 z3 pythonexport MLIR_SYS_220_PREFIX="$(brew --prefix llvm@22)"export PATH="$MLIR_SYS_220_PREFIX/bin:$PATH"cargo build -p quoncAdd the exports to ~/.zshrc or your shell profile for later sessions.
Ubuntu and Debian
Section titled “Ubuntu and Debian”sudo apt updatesudo apt install -y \ build-essential curl wget gnupg lsb-release software-properties-common \ libz3-dev python3 python3-pip python3-venvUse the official apt.llvm.org installer, then install the LLVM 22 development packages:
wget -q https://apt.llvm.org/llvm.shchmod +x llvm.shsudo ./llvm.sh 22sudo apt install -y \ libmlir-22-dev mlir-22-tools llvm-22-dev llvm-22-tools libpolly-22-devrm llvm.shexport MLIR_SYS_220_PREFIX=/usr/lib/llvm-22export PATH="$MLIR_SYS_220_PREFIX/bin:$PATH"cargo build -p quoncllvm-config --version should report version 22.
Release packaging path
Section titled “Release packaging path”The repository contains release machinery for self-contained CLI artifacts:
scripts/install.shfor curl-style installs from GitHub Releases.scripts/package-deb.shfor Debian packages.scripts/generate-homebrew-formula.shfor Homebrew formula generation.scripts/release.shfor static release assembly..github/workflows/release.ymlfor tagged release builds.
That packaging path is part of Quon’s production-tooling direction: the release
flow is designed around prebuilt quonc, quonfmt, quon_lsp, and
quonlint binaries, while contributors keep the reproducible Devbox source
build.
Troubleshooting
Section titled “Troubleshooting”command not found: just
Section titled “command not found: just”just is not installed on the host by design — it lives inside the Devbox
environment. Enter the environment and run recipes directly, or prefix a
one-shot command with devbox run --:
devbox shell # then: just <recipe>devbox run -- just doctor # one-shot from the host shellSee First-run toolchain readiness for the
readiness matrix, and run just doctor (or devbox run -- just doctor) to
diagnose any other missing tool.
Cargo cannot find llvm-config
Section titled “Cargo cannot find llvm-config”Check that the shell has loaded the Devbox or manual LLVM environment:
echo "$MLIR_SYS_220_PREFIX"command -v llvm-configllvm-config --versionThe prefix must be the LLVM 22 installation root, not its bin directory.
Python cannot import Qiskit Aer
Section titled “Python cannot import Qiskit Aer”Activate the virtual environment and install the checked-in requirements:
source .venv/bin/activatepython -m pip install -r python/requirements.txtThen continue to the quickstart.