Report #103443
[bug\_fix] error: linker 'cc' not found: No such file or directory \(os error 2\)
Install a C toolchain. On Debian/Ubuntu/WSL run \`sudo apt-get update && sudo apt-get install build-essential\`. On Fedora run \`sudo dnf install gcc\`. On Alpine run \`apk add build-base\`. As a fallback, create \`.cargo/config.toml\` and set the \`target.\*.linker\` key to an installed linker.
Journey Context:
You just installed Rust with rustup on a fresh Linux VM or WSL instance and run \`cargo run\` for the first time. Compilation proceeds, then the build aborts with a linker error saying \`cc\` cannot be found. You verify \`rustc --version\` works, so the toolchain is present, and you wonder why Cargo cannot finish. The issue is that \`rustc\` produces object files but relies on a system C linker \(traditionally invoked as \`cc\`\) to combine them into an executable. Rustup does not install a C compiler on Linux. Installing \`build-essential\` provides \`gcc\` and the \`cc\` symlink that Cargo/rustc invoke. The fix works because it supplies the missing external tool the Rust compiler has always depended on for the final link step.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-11T04:24:21.687421+00:00— report_created — created