Rust errors / Build and Cargo
Rust build error · checked with Rust 1.99.0
error: failed to run custom build command for `openssl-sys`
error: failed to run custom build command for `openssl-sys`
What it meansThe openssl-sys crate links to the system OpenSSL library and could not find it (or pkg-config) on your machine.
Why it happens
- OpenSSL development headers are not installed.
- pkg-config is missing.
- Cross-compiling, where the host OpenSSL does not match the target.
How to fix it
1. Install OpenSSL dev files
Debian/Ubuntu shown; Fedora uses openssl-devel, macOS uses brew install openssl@3.
sudo apt install pkg-config libssl-dev2. Avoid OpenSSL entirely
Most HTTP crates can use rustls (pure Rust TLS) instead.
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] }3. Build OpenSSL from source
The vendored feature compiles OpenSSL into your binary (needs perl and a C compiler); handy for cross-compiling.
openssl = { version = "0.10", features = ["vendored"] }Other wordings of this error
failed to run custom build command for openssl-sys, Could not find directory of OpenSSL installation, openssl-sys build failed, pkg-config openssl not found
Other build errors
- error: linker `link.exe` not found
- error: linker `cc` not found
- error: failed to select a version for the requirement
- error: failed to select a version for `libsqlite3-sys`... the package `libsqlite3-sys` lin
- error: could not compile `my-crate` (bin "my-crate") due to 1 previous error
- error: package `foo v1.2.3` cannot be built because it requires rustc 1.80 or newer, while
- feature `edition2024` is required
- Blocking waiting for file lock on package cache
Up next
Find the right pagePaste any Rust errorCompiler codes and build errors in one finder.Read it next →Also worth your time
Did this answer your question?