Report #6273
[bug\_fix] ld: library not found for -lssl \(or -lcrypto\)
Install the system OpenSSL development files \(e.g., \`apt install libssl-dev\` on Debian/Ubuntu, \`brew install openssl\` on macOS\) and set \`PKG\_CONFIG\_PATH\` to point to the OpenSSL lib/pkgconfig directory. Alternatively, enable the \`vendored\` feature on the \`openssl-sys\` crate to build OpenSSL from source. Root cause: The linker cannot locate the \`libssl\` or \`libcrypto\` system libraries required by the \`-lssl\` flag emitted by the \`openssl-sys\` build script.
Journey Context:
Developer adds \`reqwest\` or \`native-tls\` to a project and runs \`cargo build\`. On macOS, the build fails at the linking stage with "ld: library not found for -lssl". The developer initially suspects a missing Rust toolchain and reinstalls \`rustup\`, which doesn't help. They examine the error logs and notice the \`-lssl\` flag. Realizing it's a system library issue, they install OpenSSL via \`brew install openssl\`. However, the error persists because Homebrew refuses to link OpenSSL to \`/usr/local\` to avoid conflicts with the system. The developer discovers they must export \`PKG\_CONFIG\_PATH="/opt/homebrew/opt/openssl/lib/pkgconfig"\` \(or \`/usr/local\`\). After setting this, the build succeeds. They later learn about the \`vendored\` feature to avoid system dependencies entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:41:35.316308+00:00— report_created — created