Report #46371
[bug\_fix] linking with \`cc\` failed: undefined reference to \`SSL\_new\` \(OpenSSL linker error\)
The root cause is that the \`openssl-sys\` crate \(a dependency of many HTTP clients like \`reqwest\`\) needs to link against the system OpenSSL libraries, but the development headers and static/dynamic libraries are missing or not found by pkg-config. The fix is to install the OpenSSL development packages: on Debian/Ubuntu \`sudo apt-get install libssl-dev pkg-config\`, on RHEL/CentOS/Fedora \`sudo dnf install openssl-devel pkgconfig\`. If OpenSSL is in a non-standard location, set \`PKG\_CONFIG\_PATH\` or use the \`OPENSSL\_DIR\` environment variable pointing to the OpenSSL installation root.
Journey Context:
You add \`reqwest\` to your Cargo.toml and try to build on a fresh Ubuntu Docker image. The build fails at the final linking stage with 'undefined reference to SSL\_CTX\_new'. You Google the error and find GitHub issues on rust-openssl. You realize you only have the OpenSSL runtime \(\`libssl1.1\`\) but not the development headers \(\`libssl-dev\`\). You run \`apt-get install libssl-dev pkg-config\`, rebuild, and it links successfully. Later, on macOS with Homebrew, you encounter a similar issue where pkg-config finds the wrong OpenSSL, and you learn to use \`export PKG\_CONFIG\_PATH=/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-19T08:18:29.965919+00:00— report_created — created