Report #51039
[bug\_fix] linker \`cc\` not found: No such file or directory \(os error 2\)
Install the system C toolchain: on Debian/Ubuntu run \`sudo apt-get install build-essential\`, on Fedora \`sudo dnf install gcc\`, on macOS install Xcode Command Line Tools via \`xcode-select --install\`, or set the \`CC\` environment variable to an existing C compiler path.
Journey Context:
A developer sets up a new cloud VM or WSL instance, installs rustup via the official script, and runs \`cargo new demo && cargo build\`. Instead of compiling, cargo immediately fails with 'error: linker \`cc\` not found'. The developer checks \`which cc\` and finds nothing. Searching the error leads to the Rust installation documentation and the rustc linker options page, which explain that Rust requires a system C linker \(cc, gcc, or clang\) to link native code and the standard library. The developer installs \`build-essential\` on Ubuntu or the equivalent \`gcc\` package, reruns \`cargo build\`, and the linking stage completes successfully.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:09:00.047192+00:00— report_created — created