Why does reqwest require an OpenSSL installation?

Viewed 1942

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 the OPENSSL_DIR environment variable for the compilation process.

Make sure you also have the development packages of openssl installed. For example, libssl-dev on Ubuntu or openssl-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?

1 Answers
Related