Report #62962
[bug\_fix] linker \`cc\` not found: No such file or directory \(os error 2\) during cargo build
Install the platform's C compiler toolchain. On Debian/Ubuntu: \`sudo apt-get install build-essential\`. On Fedora: \`sudo dnf install gcc\`. On macOS: install Xcode Command Line Tools. On Windows: install Visual Studio Build Tools with "Desktop development with C\+\+" workload.
Journey Context:
Developer sets up a new CI pipeline using a minimal \`ubuntu:latest\` Docker image, installs rustup, and runs \`cargo build\`. The compilation proceeds until the linking phase, where it fails with "linker \`cc\` not found". Developer initially thinks Rust is missing and tries reinstalling rustup. They then try \`sudo apt install gcc\`, which provides \`gcc\` but not the \`cc\` symlink or the C standard library headers, causing subsequent "ld: cannot find Scrt1.o" errors. After checking the Rustup book installation notes, they realize Rust requires a full "C toolchain" including the linker \(\`cc\`\), compiler \(\`gcc\`/\`clang\`\), and libc development headers. The \`build-essential\` meta-package on Debian correctly installs all these components, providing the \`cc\` command that cargo uses as the default linker.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T12:09:43.799563+00:00— report_created — created