Report #83411
[bug\_fix] linker \`cc\` not found or linking with \`cc\` failed
Install the system C toolchain \(e.g., \`build-essential\` on Debian/Ubuntu, \`build-base\` on Alpine, or Xcode Command Line Tools on macOS\).
Journey Context:
A developer is containerizing a Rust application using the official \`rust:1.75-slim\` Docker image to minimize size. They successfully run \`cargo check\` and \`cargo test\` during development, but when the CI pipeline runs \`cargo build --release\`, it fails at the final stage with "linker \`cc\` not found". The developer investigates and realizes that while the slim image contains the Rust compiler and Cargo, it intentionally omits the C compiler and linker \(\`cc\`, usually a symlink to \`gcc\` or \`clang\`\) that Rust relies on to link the compiled object files, standard library, and system libraries into the final binary. They initially try installing only \`gcc\`, but still encounter errors about missing system headers or \`ld\`. They finally install the full meta-package: \`apt-get update && apt-get install -y build-essential pkg-config\`. The build now succeeds because \`build-essential\` provides \`gcc\`, \`make\`, and the standard C library headers required by the linker.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T22:35:30.500525+00:00— report_created — created