Skip to content

Building from Source

Building base/base from source means cloning the repository and compiling one or more workspace targets with Just or Cargo. Install all prerequisites before continuing.

Terminal window
git clone https://github.com/base/base.git
cd base

The most common build command produces a fully optimized release binary for every binary target in the workspace:

Terminal window
just build

Under the hood this runs cargo build --release. The compiled binaries are placed in target/release/.

For production deployments where you want every bit of throughput, use the maxperf profile. This enables all CPU-specific optimizations and links against jemalloc:

Terminal window
just build-maxperf

This build takes longer to compile but produces a binary tuned for the machine it was compiled on. Do not distribute maxperf binaries to machines with different CPU micro-architectures.

If you only need the node binary and want a faster compile:

Terminal window
just build-node

Or build it directly with Cargo:

Terminal window
cargo build --release --bin base-reth-node

The resulting binary is at target/release/base-reth-node.

Several crates in the workspace depend on compiled Solidity contracts for their test suites. Build them with:

Terminal window
just build-contracts

This changes into crates/shared/primitives/contracts, installs Soldeer dependencies, and runs forge build. You must have Foundry installed for this to work.

During development you may want an unoptimized build with debug symbols for every target in the workspace:

Terminal window
just build-all-targets

This compiles in debug mode, which is significantly faster to compile but produces slower binaries. Use this when you need to iterate quickly and do not care about runtime performance.

CommandProfileOutput
just buildreleasetarget/release/*
just build-maxperfmaxperf (release + LTO + jemalloc)target/release/*
just build-nodereleasetarget/release/base-reth-node
just build-all-targetsdebugtarget/debug/*
just build-contractsN/A (Foundry)Solidity artifacts in crates/shared/primitives/contracts/out/

Linker errors mentioning clang or llvm — Install libclang-dev (Debian/Ubuntu) or make sure Xcode Command Line Tools are installed (macOS).

Out of memory during linking — Release and maxperf builds with LTO can use a lot of RAM. Close other memory-heavy applications or add swap space. You can also reduce parallelism:

Terminal window
CARGO_BUILD_JOBS=2 just build

Stale Solidity artifacts — If contract tests fail after pulling new changes, re-run just build-contracts to recompile.

Once the build completes, continue to Running the Node or Docker Builds.