Report #89939
[bug\_fix] error: linker \`cc\` not found: No such file or directory \(os error 2\)
Install the system C compiler and linker toolchain. On Debian/Ubuntu: \`sudo apt-get install build-essential\`. On Fedora: \`sudo dnf install gcc\`. On macOS: install Xcode Command Line Tools.
Journey Context:
Developer sets up a new CI pipeline using a minimal Docker image like \`rust:slim\` or a fresh Ubuntu VM. They install Rust via rustup and run \`cargo build\`. Instead of compiling, the build fails immediately with 'linker \`cc\` not found'. Developer checks \`rustc --version\` and it's fine. They search the error and find that Rust requires a system linker \(traditionally invoked as \`cc\`, usually a symlink to \`gcc\` or \`clang\`\) to link object files into the final binary. The minimal image lacks these tools. Developer updates their Dockerfile to install \`build-essential\` \(Debian\) or \`gcc\`, which provides the \`cc\` binary. After installation, \`cargo build\` succeeds because the linker is now available in PATH.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T09:33:16.956852+00:00— report_created — created