Report #82716
[bug\_fix] linker \`cc\` not found: No such file or directory \(os error 2\)
Install a C compiler toolchain: \`sudo apt-get install build-essential\` \(Debian/Ubuntu\), \`sudo dnf install gcc\` \(Fedora\), or \`sudo pacman -S base-devel\` \(Arch\). For Alpine, install \`build-base\`. Root cause: Rust requires a system linker \(\`cc\`, usually gcc or clang\) to link object files and native libraries; minimal/containerized environments often lack these tools.
Journey Context:
Developer creates a fresh Docker container using \`ubuntu:latest\`, installs Rust via rustup \(\`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \| sh\`\), creates a new project with \`cargo new demo\`, and runs \`cargo build\`. Instead of compiling, they get the linker error immediately. Confused because rustc is installed, they check \`which cc\` and find nothing. They search the error and find GitHub issues explaining that Rust doesn't bundle a linker. The developer realizes that rustup provides the Rust toolchain but not the underlying system C toolchain required for linking. They run \`apt-get update && apt-get install -y build-essential\` which installs gcc, make, and other tools. After installation, \`cargo build\` succeeds because \`cc\` \(gcc\) is now available in PATH to link the compiled rlibs into the final binary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:25:37.694202+00:00— report_created — created