Report #85361
[bug\_fix] linker \`cc\` not found
Install a C compiler and linker toolchain. On Debian/Ubuntu: \`apt-get install build-essential\`. On Alpine Linux: \`apk add build-base\`. On macOS: \`xcode-select --install\`. The root cause is that Rust uses the platform's C linker \(invoked as \`cc\`\) to link the final binary and any native dependencies \(like OpenSSL or SQLite\); without this system tool, the compilation succeeds but linking fails.
Journey Context:
Developer pulls a Rust project into a minimal Docker container \(e.g., \`rust:alpine\` or a slim Debian image\) or a fresh CI runner. They run \`cargo build --release\`. The compilation proceeds for minutes, compiling dozens of crates, then suddenly fails at the final step with \`error: linker \`cc\` not found\`. The developer searches the error and finds conflicting advice about \`musl\` targets vs \`gnu\` targets. They check \`which gcc\` and find nothing. They realize the container only has the Rust toolchain but no C compiler. After installing \`build-base\` \(Alpine\) or \`build-essential\` \(Ubuntu\), the linker \`cc\` \(which is usually a symlink to \`gcc\` or \`clang\`\) becomes available. The next build succeeds because \`cc\` can now link the object files and system libraries into the final executable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:51:57.584781+00:00— report_created — created