Building Dependencies
This guide covers all dependencies required to build Ligetron. Each dependency includes:
- A brief description of what it is
- Why it's needed for Ligetron
- Which build targets require it (Native, Web, or Both)
- Platform-specific installation instructions
- Native: Server-side applications, CLI tools, high-performance proving
- Web: Browser-based applications, client-side proving
- SDK: Required for building custom applications in either C++ or Rust
Throughout this guide, you'll see commands like make -j. The -j flag enables parallel compilation:
make -juses all available CPU coresmake -jNuses N parallel jobs
Recommended: Use 1-2 fewer cores than your CPU has for optimal performance without freezing your system. For example, on a 12-core machine, use make -j10. This provides good parallelism while leaving headroom for other system tasks.
Core Build Tools
CMake
What it is: Cross-platform build system generator that creates native build files (Makefiles, Ninja files, etc.)
Why needed: Required to configure and generate build files for all Ligetron components
Build targets: Native, Web, SDK
Minimum version: 3.24
- macOS
- Ubuntu
brew install cmake
Verify installation:
cmake --version
If your system has an older CMake version, upgrade it:
# Remove old CMake
sudo apt remove --purge cmake
sudo apt autoremove
# Install dependencies
sudo apt install -y software-properties-common lsb-release wget gpg
# Add Kitware's repository
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] \
https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
# Install latest CMake
sudo apt update
sudo apt install cmake
# Verify installation
cmake --version
Git
What it is: Distributed version control system
Why needed: Required to clone Ligetron and its dependencies
Build targets: Native, Web, SDK
- macOS
- Ubuntu
brew install git
sudo apt-get install git -y
Platform-Specific Requirements (Ubuntu Only)
Before building any dependencies, Ubuntu users must install GCC 13 and graphics libraries. macOS users can skip this section.
Ubuntu: GCC 13 and Graphics Libraries
GCC 13
Ligetron requires GCC 13 or newer for C++20 features:
# Add the Ubuntu Toolchain PPA
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
# Update package lists
sudo apt update
# Install GCC 13
sudo apt install g++-13 -y
# Set GCC 13 as default
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 20
sudo update-alternatives --set g++ "/usr/bin/g++-13"
# Verify
g++ --version
Graphics Libraries
For GPU acceleration with Dawn:
X11 Development Libraries (required for GLFW used by Dawn):
sudo apt install -y libx11-dev libxrandr-dev libxinerama-dev \
libxcursor-dev libxi-dev libx11-xcb-dev \
xorg-dev
If you encounter Wayland/XKB errors during Dawn compilation, you may also need:
sudo apt install -y libwayland-dev libxkbcommon-dev wayland-protocols
Vulkan:
sudo apt install libvulkan1 vulkan-tools -y
OpenGL:
sudo apt install mesa-common-dev libgl1-mesa-dev -y
NVIDIA Drivers (if applicable):
If you have an NVIDIA GPU:
sudo apt purge nvidia*
sudo apt install nvidia-driver-535 nvidia-dkms-535 nvidia-utils-535 -y
sudo reboot
Mathematical Libraries
GMP (GNU Multiple Precision Arithmetic Library)
What it is: Library for arbitrary precision arithmetic
Why needed: Used for BN254 finite field arithmetic in zero-knowledge proofs. Provides high-performance operations on very large numbers.
Build targets: Both Native and Web (Note: Web builds require a WebAssembly-compiled version, typically provided in the project's wasm_depends directory)
- macOS
- Ubuntu
brew install gmp
This installs the native version used for Native builds.
sudo apt-get install libgmp-dev -y
This installs the native version used for Native builds.
For web builds, you'll need a WebAssembly-compiled version of GMP. System-installed GMP cannot be used for web builds. See the Building WebAssembly Dependencies section below for instructions.
C++ Libraries
Boost
What it is: Collection of peer-reviewed portable C++ source libraries
Why needed: Ligetron uses several Boost components:
boost::serialization- For serializing proof databoost::iostreams- For gzip compression of proofs (added in v1.1.0)boost::program_options- For command-line argument parsing- Other utilities for logging and exceptions
Build targets: Both Native and Web (Note: Web builds require WebAssembly-compiled versions)
- macOS
- Ubuntu
brew install boost
This installs the native version. Components installed include all necessary libraries.
sudo apt-get install libboost-all-dev -y
This installs all Boost libraries including iostreams, serialization, and program_options.
For web builds, the system-installed Boost libraries cannot be used. You must build WebAssembly-compiled versions of the following components:
libboost_serialization.a- For serializing proof datalibboost_iostreams.a- For gzip compression of proofs (required since v1.1.0)
See the Building WebAssembly Dependencies section below for complete build instructions.
OpenSSL
What it is: Cryptography and SSL/TLS toolkit
Why needed: Provides cryptographic primitives used in zero-knowledge proofs
Build targets: Both Native and Web
- macOS
- Ubuntu
OpenSSL is typically pre-installed on macOS. If needed:
brew install openssl
sudo apt-get install libssl-dev -y
WebAssembly Tools
WebAssembly Binary Toolkit (wabt)
What it is: Suite of tools for working with WebAssembly, including wat2wasm, wasm2wat, and wasm-objdump
Why needed: Used by Ligetron's interpreter to parse and manipulate WebAssembly binaries
Build targets: Both Native and Web
- macOS
- Ubuntu
# Clone wabt
git clone https://github.com/WebAssembly/wabt.git
cd wabt
git submodule update --init
# Build
mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=clang++ ..
make -j
sudo make install
# Clone wabt
git clone https://github.com/WebAssembly/wabt.git
cd wabt
git submodule update --init
# Build
mkdir build && cd build
cmake -DCMAKE_CXX_COMPILER=g++-13 ..
make -j
sudo make install
Emscripten
What it is: Complete compiler toolchain for compiling C and C++ to WebAssembly
Why needed: Required to:
- Build the C++ SDK for WebAssembly
- Build Ligetron for web/browser deployment
- Compile custom applications to WebAssembly
Build targets: Web and SDK only
- macOS
- Ubuntu
# Clone emsdk
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
# Install and activate latest SDK
./emsdk install latest
./emsdk activate latest
# Activate environment (add this to your shell profile for persistence)
source ./emsdk_env.sh
Note: You'll need to run source /path/to/emsdk/emsdk_env.sh in each new terminal session before building WebAssembly targets.
# Clone emsdk
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
# Install and activate latest SDK
./emsdk install latest
./emsdk activate latest
# Activate environment (add this to your shell profile for persistence)
source ./emsdk_env.sh
Note: You'll need to run source /path/to/emsdk/emsdk_env.sh in each new terminal session before building WebAssembly targets.
Add source /path/to/emsdk/emsdk_env.sh to your ~/.bashrc or ~/.zshrc to automatically activate Emscripten in new terminal sessions.
GPU & Graphics Libraries (Native Only)
WebGPU (Dawn)
What it is: Google's open-source implementation of the WebGPU API, providing GPU acceleration
Why needed: Enables hardware-accelerated finite field operations and cryptographic computations for faster proof generation
Build targets: Native only (browsers provide their own WebGPU implementation)
Specific version required: cec4482eccee45696a7c0019e750c77f101ced04
- macOS
- Ubuntu
# Clone Dawn
git clone https://dawn.googlesource.com/dawn
cd dawn/
# Checkout specific version
git checkout cec4482eccee45696a7c0019e750c77f101ced04
# Build and install
mkdir release && cd release
cmake -DDAWN_FETCH_DEPENDENCIES=ON \
-DDAWN_BUILD_MONOLITHIC_LIBRARY=STATIC \
-DDAWN_ENABLE_INSTALL=ON \
-DCMAKE_BUILD_TYPE=Release ..
make -j
sudo make install
For more details, see the official Dawn quickstart guide.
Ensure you have installed the Platform-Specific Requirements at the beginning of this guide (GCC 13 and graphics libraries).
# Clone Dawn
git clone https://dawn.googlesource.com/dawn
cd dawn/
# Checkout specific version
git checkout cec4482eccee45696a7c0019e750c77f101ced04
# Build and install
mkdir release && cd release
cmake -DDAWN_FETCH_DEPENDENCIES=ON \
-DDAWN_BUILD_MONOLITHIC_LIBRARY=STATIC \
-DDAWN_ENABLE_INSTALL=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-Wno-error=changes-meaning -Wno-changes-meaning" \
..
make -j
sudo make install
The -Wno-error=changes-meaning and -Wno-changes-meaning flags are required to suppress GCC 13 warnings about C++20 name lookup changes that would otherwise cause the Dawn build to fail. These flags are safe and only suppress warnings, not errors.
For more details, see the official Dawn quickstart guide.
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.
Rust Toolchain (SDK Only)
Rust with wasm32-wasip1 Target
What it is: The Rust programming language compiler and toolchain
Why needed: Required only if you want to build the Rust SDK or write custom applications in Rust
Build targets: SDK (Rust variant)
- macOS
- Ubuntu
Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Add the WebAssembly target:
rustup target add wasm32-wasip1
Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Add the WebAssembly target:
rustup target add wasm32-wasip1
Use wasm32-wasip1 (not wasm32-unknown-unknown). WASI P1 provides the necessary system interface for Ligetron's SDK.
Building WebAssembly Dependencies for Web Builds
If you only need native builds (server-side proving, CLI tools), you can skip this entire section and proceed directly to Building Ligetron. This section is only required for web/browser deployments.
Web builds cannot use system-installed libraries from Homebrew or apt. All C/C++ libraries must be compiled specifically for the wasm32 target using Emscripten. This section shows you how to build the required WebAssembly versions.
Overview
For web builds, you need to create a directory to store WebAssembly-compiled libraries. We recommend creating a wasm_libs directory:
mkdir -p ~/ligetron-deps/wasm_libs
export WASM_LIBS=~/ligetron-deps/wasm_libs
The following libraries need to be built for WebAssembly:
- GMP (libgmp.a, libgmpxx.a) - Arbitrary precision arithmetic
- Boost (serialization, iostreams, log, exception) - C++ utilities
- OpenSSL (libssl.a, libcrypto.a) - Cryptography
- wabt (libwabt.a) - WebAssembly toolkit
Building GMP for WebAssembly
- macOS
- Ubuntu
# Download and extract GMP
wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz
tar xf gmp-6.3.0.tar.xz
cd gmp-6.3.0
# Activate Emscripten
source /path/to/emsdk/emsdk_env.sh
# Configure for WebAssembly
# Note: CC_FOR_BUILD must be set to native compiler for build tools
export CC_FOR_BUILD=clang
emconfigure ./configure \
--prefix=$WASM_LIBS \
--disable-shared \
--enable-static \
--enable-cxx \
--host=wasm32 \
--build=x86_64-apple-darwin
# Build and install
emmake make -j
emmake make install
# Verify libraries were created
ls -lh $WASM_LIBS/lib/libgmp*.a
# Download and extract GMP
wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz
tar xf gmp-6.3.0.tar.xz
cd gmp-6.3.0
# Activate Emscripten
source /path/to/emsdk/emsdk_env.sh
# Configure for WebAssembly
# Note: CC_FOR_BUILD must be set to native compiler for build tools
export CC_FOR_BUILD=gcc
emconfigure ./configure \
--prefix=$WASM_LIBS \
--disable-shared \
--enable-static \
--enable-cxx \
--host=wasm32 \
--build=x86_64-linux-gnu
# Build and install
emmake make -j
emmake make install
# Verify libraries were created
ls -lh $WASM_LIBS/lib/libgmp*.a
Building Boost for WebAssembly
Boost requires special configuration to compile for WebAssembly. The following instructions use Boost 1.88.0, which is compatible with modern Emscripten versions.
Ligetron requires these Boost components for WebAssembly:
libboost_serialization.a- For serializing proof datalibboost_iostreams.a- For gzip compression (required since v1.1.0)
- macOS
- Ubuntu
# Download and extract Boost 1.88.0
wget https://archives.boost.io/release/1.88.0/source/boost_1_88_0.tar.gz
tar xzf boost_1_88_0.tar.gz
cd boost_1_88_0
# Activate Emscripten and set compiler variables
source /path/to/emsdk/emsdk_env.sh
export CC=emcc
export CXX=em++
export AR=emar
export RANLIB=emranlib
# Bootstrap with only the libraries we need
./bootstrap.sh --prefix=$WASM_LIBS --with-libraries=serialization,iostreams
# Build and install for WebAssembly
./b2 install \
--prefix=$WASM_LIBS \
--layout=system \
toolset=emscripten \
variant=release \
exception-handling=on \
exception-handling-method=js \
define=BOOST_LOG_USE_STD_REGEX=1 \
cxxflags="-std=c++20 -O3 -DNDEBUG -mbulk-memory -sUSE_PTHREADS=1 -sUSE_ZLIB=1" \
linkflags="-sUSE_ZLIB=1 -sUSE_PTHREADS=1 -O3" \
link=static \
threading=multi \
-j10
# Verify libraries were created
ls -lh $WASM_LIBS/lib/libboost_*.a
# Download and extract Boost 1.88.0
wget https://archives.boost.io/release/1.88.0/source/boost_1_88_0.tar.gz
tar xzf boost_1_88_0.tar.gz
cd boost_1_88_0
# Activate Emscripten and set compiler variables
source /path/to/emsdk/emsdk_env.sh
export CC=emcc
export CXX=em++
export AR=emar
export RANLIB=emranlib
# Bootstrap with only the libraries we need
./bootstrap.sh --prefix=$WASM_LIBS --with-libraries=serialization,iostreams
# Build and install for WebAssembly
./b2 install \
--prefix=$WASM_LIBS \
--layout=system \
toolset=emscripten \
variant=release \
exception-handling=on \
exception-handling-method=js \
define=BOOST_LOG_USE_STD_REGEX=1 \
cxxflags="-std=c++20 -O3 -DNDEBUG -mbulk-memory -sUSE_PTHREADS=1 -sUSE_ZLIB=1" \
linkflags="-sUSE_ZLIB=1 -sUSE_PTHREADS=1 -O3" \
link=static \
threading=multi \
-j
# Verify libraries were created
ls -lh $WASM_LIBS/lib/libboost_*.a
Key build flags explained:
toolset=emscripten- Use Emscripten compiler instead of native compilerexception-handling-method=js- Use JavaScript-based exception handling for WebAssembly-mbulk-memory- Enable WebAssembly bulk memory operations for better performance-sUSE_PTHREADS=1- Enable pthread support (required for multi-threading)-sUSE_ZLIB=1- Enable zlib support (required for iostreams compression)link=static- Build static libraries (.afiles)threading=multi- Enable multi-threading support
Building Boost for WebAssembly takes 10-20 minutes depending on your CPU. The -j flag controls parallel jobs - adjust based on your CPU cores (see optimizing build times for recommendations).
Building OpenSSL for WebAssembly
- macOS
- Ubuntu
# Download and extract OpenSSL
wget https://www.openssl.org/source/openssl-3.1.4.tar.gz
tar xzf openssl-3.1.4.tar.gz
cd openssl-3.1.4
# Activate Emscripten
source /path/to/emsdk/emsdk_env.sh
# Configure for WebAssembly
CC=emcc AR=emar RANLIB=emranlib ./Configure \
no-asm \
no-threads \
no-engine \
no-shared \
--prefix=$WASM_LIBS \
linux-generic32
# Build and install
make -j
make install_sw
# Verify libraries were created
ls -lh $WASM_LIBS/lib/libssl.a $WASM_LIBS/lib/libcrypto.a
# Download and extract OpenSSL
wget https://www.openssl.org/source/openssl-3.1.4.tar.gz
tar xzf openssl-3.1.4.tar.gz
cd openssl-3.1.4
# Activate Emscripten
source /path/to/emsdk/emsdk_env.sh
# Configure for WebAssembly
CC=emcc AR=emar RANLIB=emranlib ./Configure \
no-asm \
no-threads \
no-engine \
no-shared \
--prefix=$WASM_LIBS \
linux-generic32
# Build and install
make -j
make install_sw
# Verify libraries were created
ls -lh $WASM_LIBS/lib/libssl.a $WASM_LIBS/lib/libcrypto.a
Building wabt for WebAssembly
wabt needs to be built as a static library for linking with web builds:
- macOS
- Ubuntu
# Clone wabt (if not already done)
git clone https://github.com/WebAssembly/wabt.git
cd wabt
git submodule update --init
# Activate Emscripten
source /path/to/emsdk/emsdk_env.sh
# Build for WebAssembly
mkdir build-wasm && cd build-wasm
emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTS=OFF \
-DBUILD_TOOLS=OFF \
-DCMAKE_INSTALL_PREFIX=$WASM_LIBS \
..
emmake make -j
emmake make install
# Verify library was created
ls -lh $WASM_LIBS/lib/libwabt.a
# Clone wabt (if not already done)
git clone https://github.com/WebAssembly/wabt.git
cd wabt
git submodule update --init
# Activate Emscripten
source /path/to/emsdk/emsdk_env.sh
# Build for WebAssembly
mkdir build-wasm && cd build-wasm
emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTS=OFF \
-DBUILD_TOOLS=OFF \
-DCMAKE_INSTALL_PREFIX=$WASM_LIBS \
..
emmake make -j
emmake make install
# Verify library was created
ls -lh $WASM_LIBS/lib/libwabt.a
Next Steps
Once you have all WebAssembly dependencies built, proceed to Building for Web to build Ligetron for browser-based execution.
Quick Reference Table
| Dependency | Native | Web | SDK | Purpose |
|---|---|---|---|---|
| CMake | ✅ | ✅ | ✅ | Build system |
| Git | ✅ | ✅ | ✅ | Version control |
| GMP | ✅ | ✅* | ✅* | Arbitrary precision arithmetic |
| Boost | ✅ | ✅* | ✅* | C++ utilities and compression |
| OpenSSL | ✅ | ✅* | ✅* | Cryptography |
| wabt | ✅ | ✅ | ✅ | WebAssembly toolkit |
| Emscripten | ❌ | ✅ | ✅ | WebAssembly compiler |
| Dawn | ✅ | ❌ | ❌ | GPU acceleration |
| Rust + wasm32-wasip1 | ❌ | ❌ | ✅** | Rust SDK |
* For web builds, requires WebAssembly-compiled versions (see Building WebAssembly Dependencies)
** Only needed for Rust SDK variant