Report #7415
[bug\_fix] linker \`cc\` not found: No such file or directory
Install the system C compiler and linker toolchain. On Debian/Ubuntu: \`apt-get install build-essential\`. On Alpine: \`apk add gcc musl-dev\`. On macOS: Install Xcode Command Line Tools. Root cause: Cargo invokes the platform linker \(typically \`cc\`\) to combine Rust object files and native libraries into the final executable; without a C toolchain, the linking stage fails.
Journey Context:
A DevOps engineer is containerizing a Rust microservice using a minimal \`alpine:latest\` or \`ubuntu:22.04\` base image. They install rustup using the official script, run \`cargo build --release\`, and immediately hit the linker error. They check \`which cc\` and find nothing. Confused because Rust is a systems language, they assume it shouldn't need C tools. They search the error and find StackOverflow threads explaining that Rust uses the system linker. They install \`build-essential\` on Ubuntu or \`gcc\` on Alpine, and the build succeeds. They realize they need a multi-stage Docker build or a larger base image to have the linker available during compilation, or use a Rust image that includes build tools.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T02:41:00.490172+00:00— report_created — created