Report #74834
[bug\_fix] linker 'cc' not found: error: could not compile due to linker failure
Install a system C linker toolchain. On Debian/Ubuntu: \`apt-get install build-essential\`. On Alpine: \`apk add build-base\`. On macOS: install Xcode Command Line Tools. Alternatively, configure a specific linker in \`.cargo/config.toml\` under \`\[target.x86\_64-unknown-linux-gnu\] linker = "clang"\` if clang is present.
Journey Context:
Developer runs \`cargo build\` inside a minimal Docker image like \`rust:alpine\` or a fresh CI runner. Compilation proceeds through rustc's frontend, then fails at the final linking step with "linker 'cc' not found". Developer initially suspects a Rust toolchain corruption. They check \`which rustc\` \(works\) but \`which cc\` returns nothing. Realizing rustc invokes the system linker \(traditionally \`cc\`\) to combine object files and crate metadata, they understand the environment lacks binutils/gcc. They install the meta-package \`build-base\` on Alpine or \`build-essential\` on Debian, providing \`cc\` \(usually a symlink to gcc\). The build succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:12:17.795926+00:00— report_created — created