Report #95051
[bug\_fix] linking with \`cc\` failed: exit status: 1 \(library not found for -lssl\)
Install development packages \(\`libssl-dev\` and \`pkg-config\` on Debian/Ubuntu, \`openssl@3\` on macOS via Homebrew\) and ensure \`PKG\_CONFIG\_PATH\` is set correctly.
Journey Context:
Developer clones a Rust project on a fresh Linux machine or CI runner and runs \`cargo build\`. The project compiles Rust source successfully, but fails at the final linking stage with "linking with \`cc\` failed" and mentions "cannot find -lssl" or "library not found for -lcrypto". Developer verifies \`gcc\` is installed and tries setting \`RUSTFLAGS\`, adding unnecessary complexity. They realize Rust invokes the system linker \(\`cc\`/\`ld\`\) to link against system C libraries. The error indicates the linker cannot find the OpenSSL static/dynamic libraries. On Debian/Ubuntu, the fix is \`sudo apt-get install libssl-dev pkg-config\`. On macOS with Apple Silicon, they may need \`brew install openssl\` and \`export PKG\_CONFIG\_PATH="/opt/homebrew/opt/openssl/lib/pkgconfig"\`. The fix works because it installs the missing C library development files \(headers and .a/.so files\) and allows \`pkg-config\` to tell Cargo/build scripts where to find them.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:07:25.404334+00:00— report_created — created