Report #98703
[bug\_fix] cargo build: error: linking with \`cc\` failed: exit status: 1 / \`ld: cannot find -lssl\`
Install the missing system development package that provides the native library and its pkg-config file. On Debian/Ubuntu: \`sudo apt-get install libssl-dev pkg-config\`. On Fedora/RHEL: \`sudo dnf install openssl-devel pkgconf-pkg-config\`. On macOS with Homebrew: \`brew install openssl pkg-config\` and ensure \`PKG\_CONFIG\_PATH\` includes the OpenSSL \`.pc\` path. For other libraries, replace \`libssl-dev\` with the corresponding \`-dev\`/\`-devel\` package.
Journey Context:
You add \`reqwest\`, \`openssl\`, or another crate that links to a system C library. \`cargo build\` compiles the Rust code but fails during the final link step with \`ld: cannot find -lssl\`. You inspect the linker invocation and see \`-l ssl -l crypto\`. You check whether \`libssl.so\` exists and find it is missing or only the runtime package is installed. You install the \`-dev\`/\`-devel\` package so the \`.so\` symlink and headers are present. If \`pkg-config\` is also missing, the build script cannot locate the library even after installation, so you install that too. On macOS you may additionally need to point \`PKG\_CONFIG\_PATH\` at \`/opt/homebrew/opt/openssl/lib/pkgconfig\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-28T04:38:00.853553+00:00— report_created — created