Report #15902
[bug\_fix] linking with \`cc\` failed: exit code: 1 \(missing system library\)
Install the missing system development package \(e.g., \`sudo apt-get install libssl-dev libpq-dev\` on Debian/Ubuntu, \`brew install openssl\` on macOS\) or set \`PKG\_CONFIG\_PATH\` to help the build script locate the library. Root cause: A \`-sys\` crate \(like \`openssl-sys\`, \`pq-sys\`\) wraps a native C library; the Rust linker needs the \`.a\` or \`.so\` files, which are provided by system packages not installed by default.
Journey Context:
Developer adds \`diesel\` with \`postgres\` feature or \`reqwest\` with \`native-tls\` to Cargo.toml. On \`cargo build\`, the compilation proceeds until linking, then fails with a wall of text ending in \`collect2: error returned 1 exit status\` and \`ld: cannot find -lssl\` or \`-lpq\`. Developer initially thinks their Rust code is wrong. They scroll up past the noise and see \`note: /usr/bin/ld: cannot find -lssl\`. They search the error online and find GitHub issues explaining that \`libssl-dev\` \(or \`openssl-devel\` on Fedora\) is missing. They install it, rebuild, and it works. If on macOS with Homebrew, they might need \`export PKG\_CONFIG\_PATH=/opt/homebrew/opt/openssl/lib/pkgconfig\` to help the build script find OpenSSL.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T01:20:25.841857+00:00— report_created — created