Report #6877
[bug\_fix] linker \`cc\` not found \(or linker \`link.exe\` not found on Windows\)
Install the platform-specific C toolchain: on Debian/Ubuntu run \`sudo apt-get install build-essential\`, on macOS run \`xcode-select --install\`, or on Windows install Visual Studio Build Tools with the "Desktop development with C\+\+" workload, providing the system linker required by rustc.
Journey Context:
You've just installed Rust via rustup on a fresh Ubuntu Docker container or a new WSL2 instance. You write a simple "Hello, world\!" program and run \`cargo build\`. Instead of a binary, you get an error saying \`linker 'cc' not found\`. You're confused because you thought Rust was self-contained. You search the error and discover that rustc compiles to LLVM IR, which needs a system linker \(\`cc\` on Unix, \`link.exe\` on Windows\) to produce the final executable. You realize your minimal environment lacks the C compiler tools. You install \`build-essential\` on Debian or the Xcode CLI tools on macOS. After installation, \`cargo build\` works because the linker binary is now in PATH, allowing rustc to invoke it during the final linking stage.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T01:15:54.548976+00:00— report_created — created