Step 4 — End-to-End Verification
Goal
Run a single verification script that exercises every tool we'll use across the curriculum and confirms versions meet the minimums. If this passes, you're ready for Lab cp-02.
What Gets Verified
| Tool | Required Version | Used In |
|---|---|---|
| Xcode CLT | any current | all phases |
Apple Clang (/usr/bin/clang++) | 14+ | phases 1–4 (optional) |
| Homebrew Clang++ | 18+ | phases 5+ |
llvm-config | matches Clang | phases 5+ |
llc, opt, lli | matches Clang | phases 5+ |
mlir-opt, mlir-translate | matches Clang | phase 7 |
| CMake | 3.20+ | all phases |
| Ninja | 1.10+ | phases 5+ (optional) |
| LLDB | any current | all phases |
| Git | any current | all phases |
Run
From this lab directory:
cd cp-01-environment-setup
./scripts/verify.sh
Expected output (with your specific versions):
== compilers-parser-engineer / cp-01 — environment verification ==
[1/9] Xcode CLT prefix : /Library/Developer/CommandLineTools OK
[2/9] Apple Clang : Apple clang version 16.0.0 OK
[3/9] Homebrew Clang++ : clang version 20.1.8 OK
[4/9] llvm-config : 20.1.8 OK
[5/9] LLVM tools : llc opt lli OK
[6/9] MLIR tools : mlir-opt mlir-translate OK
[7/9] CMake : 4.1.0 OK (need >=3.20)
[8/9] Ninja : 1.11.1 OK (optional)
[9/9] LLDB : lldb-1600.0.39.109 OK
Architecture : arm64 (Apple Silicon)
macOS : 15.0
SDK path : /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
LLVM prefix : /opt/homebrew/opt/llvm
LLVM_DIR : /opt/homebrew/opt/llvm/lib/cmake/llvm
MLIR_DIR : /opt/homebrew/opt/llvm/lib/cmake/mlir
== all critical tools present; you are ready for cp-02 ==
If anything is marked MISSING or OLD, see the matching step:
| Failure | Fix |
|---|---|
| Xcode CLT missing | Step 1 |
| Apple Clang missing | Step 1 |
| Homebrew clang++ missing | Step 3 |
llvm-config missing | Step 3 |
| MLIR tools missing | brew upgrade llvm (Step 3) |
| CMake missing/old | Step 2 |
| Ninja missing | Step 2 (optional for now) |
LLVM_DIR/MLIR_DIR unset | Step 3 |
A Mini Build To Confirm find_package(LLVM)
After the script passes, do this final check to confirm CMake can pull in LLVM (the linchpin for Phase 5):
cd scripts/llvm-smoke
cmake -B build -G Ninja
cmake --build build
./build/llvm-smoke
Expected:
LLVM version: 20.1.8
target triple: arm64-apple-macosx<version>
created module: smoke; declared one function: int main()
This compiles a tiny program that links against libLLVM and uses the IRBuilder API to construct a function. If this works, cp-11 (LLVM Codegen) will work.
What Just Happened
verify.sh ran ~30 commands across your toolchain, each printing a tool version. It then printed environment variables CMake needs (LLVM_DIR, MLIR_DIR).
The llvm-smoke mini-project then did the only thing that actually matters for compiler engineering: it pulled in the LLVM C++ headers and emitted IR programmatically. This is the API you'll spend Phases 5–9 writing against.
Next
→ Mark this lab complete and move to ../cp-02-arithmetic-evaluator/.