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
| Tool | Minimum | Recommended | Why |
|---|---|---|---|
| Rust | 1.78 | 1.82+ | std::io::IoSlice, stabilized OnceLock, edition 2021 features used throughout |
| Go | 1.22 | 1.23+ | range-over-func iterators, improved slices/maps stdlib, generics maturity |
| C++ | C++20 | C++20 (Clang 16+ / GCC 13+) | Concepts, <bit> for endian ops, std::span, designated initializers |
| CMake | 3.28 | 3.29+ | CMAKE_CXX_MODULES, modern target_link_libraries semantics |
| clang-format | 17 | 18+ | Consistent C++ formatting across labs |
| Python | 3.11 | 3.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 fordb-21(io_uringlab) on Linux.libsnappy-dev— used indb-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:
| Language | Build | Test | Run |
|---|---|---|---|
| Rust | cargo build --release | cargo nextest run (or cargo test) | cargo run --release --bin <name> |
| Go | go build ./... | go test ./... | go run ./cmd/<name> |
| C++ | cmake -B build -G Ninja && cmake --build build | ctest --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_uringrequires kernel ≥ 5.1 (≥ 5.6 for most useful features). Check withuname -r.O_DIRECTworks 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_uring—db-21falls back tokqueue+ worker pool. The lab explains the difference. O_DIRECTdoes not exist; useF_NOCACHEviafcntl(the lab provides the wrapper).fsync(2)does not guarantee data hits stable storage on macOS — usefcntl(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-analyzergolang.gollvm-vs-code-extensions.vscode-clangdms-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."