Report #88267
[bug\_fix] linker \`cc\` not found: No such file or directory
Install the system C compiler toolchain \(e.g., \`apt-get install build-essential\` on Debian/Ubuntu, \`dnf install gcc\` on Fedora, \`pacman -S base-devel\` on Arch, or Visual Studio Build Tools on Windows\). Root cause: Rust relies on a system linker \(\`cc\`, usually GCC or Clang\) to link object files and native libraries, even for pure Rust projects because the standard library links to libc.
Journey Context:
You spin up a fresh Docker container using \`rust:slim\` or an Ubuntu GitHub Actions runner. You clone a project and run \`cargo build\`. Immediately, you see the error: \`linker 'cc' not found: No such file or directory\`. Confused because you thought Rust was self-contained, you search the error. You discover that \`rust:slim\` lacks the C linker. The solution path diverges by OS: on Debian/Ubuntu you run \`apt-get update && apt-get install -y build-essential\`, on Alpine \(common in slim images\) you need \`apk add musl-dev\` or \`build-base\`, and on Windows you must install Visual C\+\+ Build Tools. After installing, \`cargo build\` succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:44:18.028366+00:00— report_created — created