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

  1. steps/01-verify-xcode-clt.md — Apple's command-line toolchain.
  2. steps/02-install-cmake-and-ninja.md — build-system generator and executor.
  3. steps/03-install-homebrew-llvm.md — upstream LLVM with full SDK.
  4. 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

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.