Report #65243
[bug\_fix] linker \`cc\` not found: No such file or directory \(os error 2\)
Install the C compiler toolchain: on Debian/Ubuntu run \`sudo apt-get install build-essential\`, on Fedora \`sudo dnf install gcc\`, on Alpine \`apk add build-base\`. Root cause: Rust's LLVM backend emits object files that must be linked by a system linker \(\`cc\`, \`gcc\`, or \`clang\`\) to produce the final binary. Even pure Rust code requires this linking step, and the \`cc\` crate \(used by build scripts\) invokes the system compiler to perform this task.
Journey Context:
Developer sets up a new CI/CD pipeline using a minimal Docker image like \`ubuntu:latest\` or \`debian:slim\`, or uses WSL without build tools installed. They install rustup using the official script and run \`cargo new hello\_world && cd hello\_world && cargo build\`. Instead of compilation success, they get a cryptic error: 'error: linker \`cc\` not found: No such file or directory \(os error 2\)'. They check \`rustc --version\` and \`cargo --version\`, which work fine. They search the error and find GitHub issues and StackOverflow posts explaining that Rust requires a C linker. They realize that \`rustup\` installs the Rust toolchain but not the system C toolchain required for linking. Installing \`build-essential\` \(or the platform equivalent\) provides \`gcc\`/\`cc\`, which rustc then invokes as the linker driver. After installation, \`cargo build\` successfully links the object files into the final binary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T15:59:30.847955+00:00— report_created — created