Toolchain Setup

All labs target Linux-first with macOS as a supported secondary platform. Windows is not supported (no io_uring, no O_DIRECT semantics we rely on; use WSL2 instead).

Required Versions

ToolMinimumRecommendedWhy
Rust1.781.82+std::io::IoSlice, stabilized OnceLock, edition 2021 features used throughout
Go1.221.23+range-over-func iterators, improved slices/maps stdlib, generics maturity
C++C++20C++20 (Clang 16+ / GCC 13+)Concepts, <bit> for endian ops, std::span, designated initializers
CMake3.283.29+CMAKE_CXX_MODULES, modern target_link_libraries semantics
clang-format1718+Consistent C++ formatting across labs
Python3.113.12+Benchmark plotting & verification scripts (matplotlib, pandas)

Per-Language Setup

Rust

# rustup is the canonical installer.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default stable
rustup component add clippy rustfmt
cargo install cargo-nextest        # faster, parallel test runner
cargo install cargo-flamegraph     # used in db-22

Verify:

rustc --version    # rustc 1.78.0 or newer
cargo --version

Go

# macOS
brew install go
# Linux: download from https://go.dev/dl/ — distro packages are usually old.

# Useful tools
go install honnef.co/go/tools/cmd/staticcheck@latest
go install golang.org/x/perf/cmd/benchstat@latest

Verify:

go version    # go1.22 or newer

C++

# macOS
xcode-select --install
brew install cmake ninja llvm

# Linux (Debian/Ubuntu)
sudo apt-get install -y build-essential cmake ninja-build clang-17 clang-format-17 \
                        libsnappy-dev liburing-dev

Verify:

clang++ --version   # Clang 16 or newer
cmake --version     # 3.28 or newer

Optional but recommended:

  • liburing-dev — required only for db-21 (io_uring lab) on Linux.
  • libsnappy-dev — used in db-06 (SSTable block compression).
  • valgrind / lldb — for memory and crash debugging.

Per-Lab Build Commands

Every lab src/<lang>/ is self-contained and has these commands:

LanguageBuildTestRun
Rustcargo build --releasecargo nextest run (or cargo test)cargo run --release --bin <name>
Gogo build ./...go test ./...go run ./cmd/<name>
C++cmake -B build -G Ninja && cmake --build buildctest --test-dir build./build/<name>

docs/execution.md in each lab repeats the exact commands with the lab-specific binary names.

OS-Specific Notes

Linux

  • io_uring requires kernel ≥ 5.1 (≥ 5.6 for most useful features). Check with uname -r.
  • O_DIRECT works on most filesystems but is rejected by tmpfs — use a real disk path in tests.
  • For accurate latency benchmarks, disable CPU frequency scaling: sudo cpupower frequency-set -g performance.

macOS

  • No io_uringdb-21 falls back to kqueue + worker pool. The lab explains the difference.
  • O_DIRECT does not exist; use F_NOCACHE via fcntl (the lab provides the wrapper).
  • fsync(2) does not guarantee data hits stable storage on macOS — use fcntl(F_FULLFSYNC). Labs handle this.

Editor / IDE

Any editor works. VS Code with these extensions is what the reference implementations were written in:

  • rust-lang.rust-analyzer
  • golang.go
  • llvm-vs-code-extensions.vscode-clangd
  • ms-vscode.cmake-tools

Sanity Check Script

Run this once after setup to verify everything works:

cd db-01-storage-primitives
( cd src/rust && cargo build --release ) && \
( cd src/go && go build ./... ) && \
( cd src/cpp && cmake -B build -G Ninja && cmake --build build ) && \
echo "All three toolchains OK."