Report #102432
[bug\_fix] error: linker \`cc\` not found: No such file or directory \(os error 2\)
Install a C toolchain so Rust has a linker available: \`build-essential\` on Debian/Ubuntu, \`base-devel\` on Arch, \`build-base\` on Alpine, or Xcode Command Line Tools on macOS.
Journey Context:
You are building a Rust service inside a minimal \`alpine:latest\` Docker image. You installed rustup and the default toolchain, then ran \`cargo build\`. The compile step succeeds but linking fails with \`linker cc not found\`. You check \`which cc\` and get nothing. Rust uses the platform linker \(usually the C compiler driver\) to produce the final binary, and the slim image does not include one. You add \`apk add build-base\` to the image, which provides \`gcc\` and \`cc\`, then rebuild. The linker is found, the crate links, and the binary appears in \`target/debug/\`. The fix works because \`cc\` is the default external linker rustc invokes; without it, no native binary can be produced.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T04:52:01.206858+00:00— report_created — created