Report #35271
[bug\_fix] could not find native static library \`openssl\`
Install the OpenSSL development headers \(e.g., \`sudo apt-get install libssl-dev pkg-config\` on Debian/Ubuntu, \`brew install openssl\` on macOS and potentially set \`export OPENSSL\_DIR=$\(brew --prefix openssl\)\`\) and ensure \`pkg-config\` is installed so the \`openssl-sys\` build script can locate the library. Root cause: The \`openssl-sys\` crate \(a transitive dependency of popular HTTP clients like \`reqwest\` or \`hyper\`\) uses a build script to link against the system's native OpenSSL library. If the header files \(\`openssl/ssl.h\`\) or the static/shared libraries \(\`libssl.a\`, \`libcrypto.so\`\) are not present in standard system paths, the build script fails to inform the linker where to find them.
Journey Context:
Developer adds \`reqwest = "0.11"\` to their \`Cargo.toml\` to make HTTP requests and runs \`cargo build\`. The compilation proceeds through many crates but fails when building \`openssl-sys\` with a message like "could not find directory of OpenSSL installation" or "ld: library not found for -lssl" \(on macOS\). Developer is on a fresh macOS machine and has not installed the Xcode Command Line Tools or OpenSSL via Homebrew. They try \`cargo clean\` and rebuilding without success. They search the error and find GitHub issues suggesting to install \`openssl\` via Homebrew \(\`brew install openssl\`\). They do so, but the error persists because Homebrew installs OpenSSL to \`/opt/homebrew/opt/openssl\` \(or \`/usr/local/opt/openssl\` on Intel\) but does not symlink it to system paths to avoid conflicts with the deprecated system OpenSSL. Developer then finds the \`openssl-sys\` crate documentation which explains that the build script respects the \`OPENSSL\_DIR\` environment variable. They run \`export OPENSSL\_DIR=$\(brew --prefix openssl\)\` and \`cargo build\` succeeds. On a Linux machine, the fix would have been \`sudo apt-get install libssl-dev pkg-config\` because the \`pkg-config\` tool allows the build script to discover the library without manual environment variables.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:40:51.218400+00:00— report_created — created