I was trying to get an elementary reqwest
http-request going like so
extern crate reqwest;
extern crate url;
use url::Url;
fn main() {
let resp = reqwest::get("http://google.com".parse::<Url>().unwrap());
println!("{:?}", resp.unwrap())
}
However, this produces the error
Could not find directory of OpenSSL installation, and this
-sys
crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set theOPENSSL_DIR
environment variable for the compilation process.Make sure you also have the development packages of openssl installed. For example,
libssl-dev
on Ubuntu oropenssl-devel
on Fedora....
Well, this was easy enough to fix. One call to sudo apt install libssl-dev
and sudo apt install pkg-config
and it's working. But I still don't understand what exactly went wrong here. I thought cargo
was supposed to take care of dependencies. Why am I now hunting them manually with apt
?
reqwest
depends on rust-native-tls
, which on Linux depends on openssl-sys
, which is where this message comes from.
So cargo
did do its job, taking care of Rust dependencies.
However, openssl-sys
depends on a C library (OpenSSL), at which point cargo
stops caring.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With