cp-01 — Environment Setup & Toolchain
Install and verify the C++/LLVM toolchain. Mandatory first lab — every other lab depends on these tools and the concepts taught here.
Read First
CONCEPTS.md— the 8-part framework: toolchains, target triples, Apple Clang vs upstream LLVM, Mach-O vs ELF, sysroots, CMake.docs/analysis.md— design tradeoffs and what to choose when.references.md— official docs and further reading.
Then Walk The Steps
steps/01-verify-xcode-clt.md— Apple's command-line toolchain.steps/02-install-cmake-and-ninja.md— build-system generator and executor.steps/03-install-homebrew-llvm.md— upstream LLVM with full SDK.steps/04-verify-end-to-end.md— single script that confirms everything.
Quick Verify (TL;DR)
If you're already comfortable with everything in CONCEPTS.md and just want to confirm your setup:
./scripts/verify.sh
If green, move to ../cp-02-arithmetic-evaluator/. If anything's red, open the relevant step.
Lab-Specific Docs
docs/execution.md— every install command in one place.docs/observation.md— how to inspect Mach-O binaries, find LLVM include paths, understandclang -voutput.docs/verification.md— the exact checksverify.shperforms, with expected outputs.docs/broader-ideas.md— cross-compilation, Docker for Linux validation, LLVM-from-source.
Outcomes
You leave this lab with:
- A working C++17/20 toolchain via Apple Clang.
- A working LLVM 18+ installation via Homebrew, plus
llvm-config,opt,llc,lli,mlir-opt. - CMake 3.20+ and Ninja installed.
- Environment variables (
LLVM_HOME,LLVM_DIR,MLIR_DIR) configured. - The mental model for what a toolchain is and the difference between a compiler driver, frontend, optimizer, backend, assembler, and linker.