Report #14321
[bug\_fix] error: linking with cc failed: exit status 1 note: undefined reference to SSL\_CTX\_new
Install the required system development packages \(e.g., \`libssl-dev\` on Debian/Ubuntu, \`openssl-devel\` on Fedora/RHEL\), or enable the \`vendored\` feature on the \`-sys\` crate \(e.g., \`openssl = \{ version = "0.10", features = \["vendored"\] \}\`\) to build the C library from source. Root cause: \`-sys\` crates \(like \`openssl-sys\`\) use \`pkg-config\` or environment variables to link against native C libraries; if the headers and static/dynamic libraries are missing from the system linker path, the final linking step fails.
Journey Context:
Developer adds \`reqwest\` \(which depends on \`openssl-sys\`\) to their project. It compiles successfully on their macOS machine because Homebrew provides OpenSSL. They push code to a GitHub Actions runner using \`ubuntu-latest\`. The CI fails at the final linking step with \`undefined reference to SSL\_CTX\_new\`. Developer initially thinks it's a Rust version issue. They install \`pkg-config\` in CI, but the error persists. Searching the error message, they find the \`openssl-sys\` documentation stating that system libraries are required. They add a step to install \`libssl-dev\` via \`apt-get\` in the CI workflow. The build succeeds. Later, to avoid system dependency issues, they switch to the \`vendored\` feature to statically link OpenSSL.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T21:15:52.136503+00:00— report_created — created