Report #61791
[bug\_fix] error: linker \`cc\` not found
Install the system C toolchain: on Debian/Ubuntu run \`apt-get install build-essential pkg-config\`, and install \`-dev\` packages for specific system libraries \(e.g., \`libssl-dev\` for OpenSSL\). On Alpine, install \`build-base\`.
Journey Context:
The developer uses a slim Docker image \(\`rust:slim\`, \`debian:slim\`\) or a fresh cloud VM. After \`cargo build\`, the process fails at the linking stage with 'linker \`cc\` not found'. The developer realizes Cargo uses the system C compiler \(cc/gcc/clang\) to link native dependencies. They try \`apt-get install gcc\` but still fail because \`ar\` or system headers are missing. They learn that \`build-essential\` \(Debian\) or \`base-devel\` \(Arch\) provides the complete toolchain. If the crate links to system libs \(e.g., \`openssl-sys\`\), they must also install \`libssl-dev\` and \`pkg-config\` so the build script can locate headers. The fix works because Cargo delegates linking to the system toolchain, which must be present even for pure Rust projects if they have native dependencies.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:12:10.901787+00:00— report_created — created