Report #12728
[bug\_fix] linker 'cc' not found or linking with 'cc' failed
Install the system C toolchain and required development libraries. On Debian/Ubuntu: \`apt-get install build-essential pkg-config libssl-dev\`. On macOS: install Xcode Command Line Tools. On Windows: install Visual Studio Build Tools with 'Desktop development with C\+\+' workload or MinGW.
Journey Context:
A developer sets up a new CI/CD pipeline using a minimal Docker image like \`rust:slim\` or a fresh Ubuntu VM. They clone a Rust project that depends on \`reqwest\` or \`diesel\` and run \`cargo build\`. The build fails immediately with 'linker \`cc\` not found'. The developer is confused because they installed Rust via rustup and expected a complete toolchain. They try installing \`gcc\` alone, which provides \`cc\`, but then the build fails with 'error: linking with \`cc\` failed' and 'undefined reference to \`SSL\_CTX\_new\`' because the project links against OpenSSL. They try setting \`OPENSSL\_DIR\` environment variables to point to OpenSSL source, but the linker still cannot find the libraries. They realize that while Rust provides the compiler \(\`rustc\`\), it relies on the platform's system linker \(\`cc\`, \`ld\`\) and C libraries for linking native dependencies. The epiphany is that 'cc not found' indicates a missing system toolchain, not a Rust issue. The fix is to install the complete build environment: \`build-essential\` \(providing \`cc\`, \`ar\`, \`make\`\), \`pkg-config\` \(for locating libraries\), and the specific development libraries like \`libssl-dev\` or \`libpq-dev\` required by the \`-sys\` crates in their dependency tree.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:48:03.581877+00:00— report_created — created