Skip to main content
Read this when you need to modify the runtime, build for a platform with no release, or get a symbol-bearing build for debugging. Most users should install the published package instead.

Prerequisites

  • A working BoxLite install (Python boxlite or Node @boxlite-ai/boxlite) and a machine with hardware virtualization — see Installation.

Hardware virtualization (required to run, not to build)

BoxLite starts microVMs, so running sandboxes requires hardware virtualization; but building the source alone does not require virtualization to be available.
Without virtualization the build can succeed, but running examples will fail to start a box. See Troubleshooting at the end.

Toolchain (installed automatically by make setup)

You do not need to install these dependencies one by one --- make setup calls the right script per platform (scripts/setup/setup-macos.sh or setup-ubuntu.sh, etc.) and installs everything. The table below only documents which components get installed and their minimum versions. The build also depends on git submodules (libkrun, libkrunfw, e2fsprogs, bubblewrap); see the steps below.

Quick Example: the fastest path to a local Python SDK

Run the following commands in order at the repository root, taking you from nothing to “a local wheel installed into .venv and importable”.
The final step should print the version you built (the latest published version when building from a release tag).
Build other SDKs: replace step 4 with make dev:node / make dev:go / make dev:c. When you need the CLI binary, use make cli (artifact at ./target/debug/boxlite).

Verify the local build runs (requires virtualization)

Save the snippet below as verify_build.py and run it with .venv/bin/python verify_build.py. It uses the freshly built local SDK to start a minimal sandbox and run one command.

Core make targets (Parameters and Returns)

Run all targets at the repository root: make <target>. For the full list, see make help.

Setup

Build (core runtime and CLI)

Local development (install SDK locally, debug mode)

Distribution (distributable artifacts, release)

Ordering dependencies (handled automatically): cli depends on runtime:debug, cli:release depends on runtime, and each dev:* triggers runtime:debug first when SETUP_DONE is not marked. Invoke the top-level target; make fills in the prerequisites automatically.

Cross-platform notes

  • macOS (Apple Silicon): make setup uses Homebrew to install protobuf, cmake, llvm, dtc, etc., and writes the musl cross-linker into ~/.cargo/config.toml (for cross-compiling the guest). The runtime uses Hypervisor.framework and does not require KVM.
  • Linux (Ubuntu/Debian): make setup uses apt-get to install build-essential, protobuf-compiler, musl-tools, llvm, libclang-dev, cmake, etc.; other distributions auto-select setup-manylinux.sh (yum) or setup-musllinux.sh (apk). Running requires /dev/kvm to be accessible.
  • Windows: follow the Linux flow inside WSL2; make sure WSL2 has KVM enabled and the user is in the kvm group.
  • macOS Intel: not supported; the build scripts exit with an error on unsupported platforms.

Troubleshooting

The following are common failure modes when building from source, and how to fix them.

make setup reports “Unsupported Linux distribution / Unsupported platform”

setup:build only recognizes the apt-get / yum / apk package managers and Darwin. Other platforms exit 1 directly (see make/setup.mk:24-30). Fix: build on a supported platform, or follow the corresponding scripts/setup/setup-*.sh to install the full toolchain manually, then skip make setup and run make dev:* directly.

Runtime build fails, cannot find libkrun / vendor sources

The cause is that submodules were not fetched. src/deps/*/vendor/ is provided by git submodules (libkrun, libkrunfw, e2fsprogs, bubblewrap; see .gitmodules). Fix:

protoc / protobuf compilation errors

Code generation for the gRPC/protobuf in src/shared requires protoc. If you skip make setup and build manually, this tool may be missing. Fix: install the protobuf compiler (macOS: brew install protobuf; Ubuntu/Debian: sudo apt-get install protobuf-compiler), or run make setup:build and let the script handle it.

Rust too old / edition 2024 errors

The repository’s Cargo.toml declares rust-version = "1.88" and uses edition 2024. Older Rust will report unsupported edition or features. Fix: rustup update stable (rust-toolchain.toml pins the channel to stable and requires the rustfmt/clippy components).

Go SDK: symbols not found after go build / cannot run

The Go SDK uses CGO, and the debug build needs a build tag. make dev:go uses go build -tags boxlite_dev; running go build directly is missing the symbols. Fix:

Build succeeds on macOS, but a box won’t start when running examples

Building does not require virtualization; running does. macOS uses Hypervisor.framework (no /dev/kvm required); Linux requires /dev/kvm to be accessible, and WSL2 requires the user to be in the kvm group. Without virtualization, startup failure usually raises a standard RuntimeError (the process stays alive and can be caught and retried). Fix: confirm the platform meets the prerequisites; use verify_build.py from the Quick Example to distinguish a “build problem” from a “virtualization/image pull problem”.

Image pull failure raises RuntimeError (not BoxliteError)

A missing command or an image pull failure raises a standard RuntimeError (Python) / bare Error (Node), not BoxliteError. See Error Handling.

Do not hand-write cargo / npm / maturin

The repository convention is to always use make targets --- the Makefile encapsulates the correct flags, cross-compilation config, environment, and ordering. Calling the low-level tools by hand often misses these. Fix: check make help first to find the corresponding target; only if there is none should you consider a low-level command.