Hello,
I want to cross-compile my rust app that uses Reqwest to raspberry 3. I have installed to toolchain to compile but the compiler tells me that OpenSSL or LibSSL needs to be installed!
Have you an idea on how to do that since I am on windows.
In my experience, it's usually more trouble than it's worth to cross-compile stuff that requires C dependencies across OSes. I'd recommend you setup a Linux VM (perhaps using WSL2 if that's already out) and then building using cross, while keeping in mind that unfortunately openssl requires some extra setup.
Alternatively, if your use case does not absolutely require openssl I'd also look into compiling reqwest with the rustls feature instead of openssl to avoid the C dependency and toolchain wrangling. Then you should be able to build with the regular --target option.
Declare the reqwest dependency in Cargo.toml like so: reqwest = { version = "0.10", default-features = false, features = ["blocking", "json"] }. Add/remove features you need accordingly, see reqwest - Rust for a list.
That's strange, I can't seem to reproduce that error. Here's how I try it:
Cargo.toml:
[package]
name = "repro"
version = "0.1.0"
authors = ["casept <davids.paskevics@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
reqwest = { version = "0.10", default-features = false, features = ["blocking", "json"] }
main.rs:
fn main() {
let body = reqwest::blocking::get("http://www.example.com").unwrap()
.text().unwrap();
println!("body = {:?}", body);
}
I seem to get a correct response. Can you post the exact code you're using?