Report #5598
[bug\_fix] linker \`cc\` not found
Install a C compiler toolchain: \`apt-get install build-essential\` \(Debian/Ubuntu\), \`apk add alpine-sdk\` \(Alpine\), or Visual Studio C\+\+ Build Tools \(Windows\). Root cause: Rust requires a system linker \(\`cc\` by default\) to link native libraries and the standard library; minimal environments lack this.
Journey Context:
You spin up a fresh Ubuntu Docker image, install Rust via rustup, clone a project, and run \`cargo build\`. Immediately you see \`error: linker \`cc\` not found\`. Checking \`which cc\` returns nothing. You suspect Rust is broken, but the container simply lacks the C toolchain. After installing \`build-essential\`, the build proceeds. The 'aha' moment is realizing that \`cc\` is the default linker flag Cargo passes to rustc, which invokes the system C compiler to link object files, and this is a hard dependency even for pure Rust projects due to the standard library's native components.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:43:02.343915+00:00— report_created — created