Report #41508
[bug\_fix] ld: library not found for -lssl \(or undefined reference to \`SSL\_CTX\_new\`\)
Install the system SSL development libraries \(e.g., \`sudo apt-get install libssl-dev\` on Debian/Ubuntu, \`brew install openssl\` on macOS\) OR enable the \`vendored\` feature in the Rust crate \(e.g., \`openssl = \{ version = "0.10", features = \["vendored"\] \}\`\). Root cause: The Rust crate uses a \`-sys\` package to link against a system C library \(libssl.so/libcrypto.so\), but the linker cannot find the \`.a\` or \`.so\` files or the headers.
Journey Context:
Developer adds a dependency like \`reqwest\`, \`tokio-native-tls\`, or \`openssl\` to Cargo.toml and runs \`cargo build\`. The Rust compiler successfully compiles all the \`.rs\` files, but the build fails at the final linking stage with an error from \`ld\` \(Linux\), \`link.exe\` \(Windows\), or \`ld: library not found\`. The error specifically mentions \`-lssl\` or \`-lcrypto\` or \`libssl.a\`. The developer initially thinks it's a Rust code issue, but realizes it's a system dependency issue. They check \`/usr/lib\` or use \`pkg-config --libs openssl\` and find the library is missing. Installing the system package provides the required object files. Alternatively, if on a restricted environment \(like CI or cross-compiling\), they discover enabling the \`vendored\` feature compiles OpenSSL from source during the Rust build, bundling it statically and eliminating the system dependency.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T00:08:30.209793+00:00— report_created — created