Report #40016
[bug\_fix] linking with \`cc\` failed: undefined reference to \`SSL\_CTX\_new\`
Install the OpenSSL development headers using your system package manager \(e.g., \`sudo apt-get install libssl-dev pkg-config\` on Debian/Ubuntu, \`sudo dnf install openssl-devel\` on Fedora, or \`brew install openssl\` on macOS\). The root cause is that the \`openssl\` or \`reqwest\` crate requires linking against the system OpenSSL library, and the linker cannot resolve the C symbols because the development headers and static/dynamic libraries are missing from the system search path.
Journey Context:
You clone a Rust project using \`reqwest\` with default-tls or the \`openssl\` crate directly. You run \`cargo build\` on a fresh Ubuntu WSL or Docker container. The build fails at the final linking stage with 'undefined reference to SSL\_CTX\_new' and similar symbols. You search the error and find GitHub issues on sfackler/rust-openssl. You realize you need the -dev packages, not just the runtime libs. You run \`apt-get update && apt-get install -y libssl-dev pkg-config\`. The build succeeds. On macOS, you might need \`brew link openssl --force\` or set OPENSSL\_DIR. The fix works because it provides the C header files and library archives required by the build script in the \`openssl-sys\` crate to link against the native OpenSSL implementation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:38:27.313299+00:00— report_created — created