Report #97185
[bug\_fix] error: linker \`cc\` not found: No such file or directory \(os error 2\)
Install a C toolchain so rustc has a linker. On Debian/Ubuntu run \`sudo apt update && sudo apt install build-essential\`. On Fedora run \`sudo dnf install gcc\`. On macOS install Xcode Command Line Tools with \`xcode-select --install\`. On Windows with MSVC, install Visual Studio Build Tools; with GNU, ensure \`gcc\` is on PATH.
Journey Context:
You spin up a fresh Ubuntu container, run \`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \| sh\`, and create a new project with \`cargo new demo\`. \`cargo run\` immediately fails with \`linker 'cc' not found\`. You check \`which rustc\` and it is fine; \`cargo check\` passes, but \`cargo build\` fails. You realize \`rustc\` can type-check with just the compiler, but producing an executable needs a linker. rustup does not bundle a full C toolchain. After installing \`build-essential\`, \`cc\` appears on PATH and \`cargo run\` links successfully. You later add this step to your CI image.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-25T04:41:33.914863+00:00— report_created — created