Report #21631
[bug\_fix] ld: cannot find -lssl or ld: cannot find -lpq \(linker command failed with exit code 1\)
Install the development headers: \`sudo apt-get install libssl-dev\` \(Debian/Ubuntu\), \`sudo dnf install openssl-devel\` \(Fedora\), or \`brew install openssl\` \(macOS\). The root cause is that \`-sys\` crates \(e.g., \`openssl-sys\`\) use \`build.rs\` to link against system C libraries. The linker cannot find the \`.so\` or \`.a\` files without the development packages installed.
Journey Context:
You're trying to build a web application using \`actix-web\` with TLS or \`diesel\` with PostgreSQL. You add the dependency and run \`cargo build\`. The compilation proceeds, then fails at the linking stage with \`ld: cannot find -lssl\`. You search the error and find GitHub issues on \`rust-openssl\`. You realize you need the system OpenSSL development libraries. You run your package manager command, wait for installation, and rerun \`cargo build\`. It works. You make a mental note to always check the 'System Requirements' section of -sys crates.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:42:56.880425+00:00— report_created — created