Report #78587
[bug\_fix] error: linking with cc failed: exit code 1 \(ld: cannot find -lssl\)
Install the OpenSSL development headers for your platform: on Debian/Ubuntu run \`sudo apt-get install libssl-dev\`, on Fedora \`sudo dnf install openssl-devel\`, on macOS ensure OpenSSL is installed via Homebrew and potentially set environment variables like \`OPENSSL\_DIR\` if the build script requires hints.
Journey Context:
You're setting up a new CI pipeline in a minimal Ubuntu container or a fresh laptop. You add \`reqwest\` with default features to your Cargo.toml. \`cargo build\` progresses through compiling crates but fails at the final linking stage with a cryptic message about \`ld: cannot find -lssl\`. You check that Cargo.toml looks correct. You search the error and find it's a system dependency issue, not a Rust code issue. The \`openssl-sys\` crate \(a dependency\) runs a build script that emits \`cargo:rustc-link-lib=ssl\` to instruct the linker to link against libssl. However, the linker cannot find the static or dynamic library files because the \`libssl-dev\` package \(which provides \`libssl.so\` and \`libssl.a\` in standard paths like \`/usr/lib/x86\_64-linux-gnu/\`\) is not installed. Installing the dev package places the necessary files where \`pkg-config\` and the linker can find them, allowing the link to succeed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:30:05.905294+00:00— report_created — created