Skip to main content

Building Ligetron

Clone the Repository

git clone https://github.com/ligeroinc/ligero-prover.git
cd ligero-prover

Building the SDK

Important: The SDK must be built before building Native or Web versions of Ligetron.

The SDK is available in both C++ and Rust variants. You can build either or both depending on your needs.

C++ SDK

cd sdk/cpp
mkdir build && cd build

# Activate Emscripten environment first
source /path/to/emsdk/emsdk_env.sh

# Configure and build
emcmake cmake ..
make -j

This builds:

  • libligetron.a: Static library for linking with your applications
  • Example applications in examples/

To build custom C++ applications with the SDK:

em++ -O2 -I<path to SDK>/cpp/include -L<path to SDK>/cpp/build my_custom_code.cpp -o my_custom_code.wasm -lligetron

Rust SDK

First, ensure you have the WebAssembly target installed:

rustup target add wasm32-wasip1

The Rust SDK is structured as a Cargo workspace where sdk/rust/src/ contains the ligetron library, and sdk/rust/examples/ contains example applications that use it.

Build the SDK with examples:

cd sdk/rust
cargo build --examples --target wasm32-wasip1 --release

This automatically builds:

  • The ligetron library (from src/lib.rs) → target/wasm32-wasip1/release/libligetron.{a,rlib}
  • All example applications (which import the library with use ligetron::*) → target/wasm32-wasip1/release/examples/*.wasm

Alternatively, to build only the library without examples:

cargo build --target wasm32-wasip1 --release

To build custom Rust applications with the SDK, add it as a dependency in your Cargo.toml:

[dependencies]
ligetron = { path = "path/to/sdk/rust" }

Building Native

Build the native prover and verifier with GPU acceleration:

# From project root
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j

This creates:

  • webgpu_prover: Native prover executable
  • webgpu_verifier: Native verifier executable

Building for Web

Prerequisites for Web Builds

Before building for web, you must first build all WebAssembly dependencies (GMP, Boost, OpenSSL, wabt). This process takes 30-60 minutes but only needs to be done once.

See Building WebAssembly Dependencies for complete instructions.

Web Build Conflicts

If you encounter header conflicts between Dawn and Emscripten's WebGPU headers during web builds, ensure your CPATH environment variable doesn't include /usr/local/include. See WebGPU Header Conflicts in the troubleshooting guide for details.

Build for browser-based execution:

mkdir -p build-web && cd build-web

# Activate Emscripten environment
source /path/to/emsdk/emsdk_env.sh

# Unset CPATH to avoid conflicts with Dawn headers
unset CPATH

# Configure with WebAssembly dependencies
emcmake cmake -DCMAKE_BUILD_TYPE=Web \
-DCMAKE_PREFIX_PATH=$WASM_LIBS ..

# Build
make -j