I recently updated my laptop from ubuntu 18.04 to 18.10.
(I think) since then, rust builds are failing for things that link to native libraries. Openssl is a common problem, but I don't think the only one - just one of the 'usual suspects'. For example:
the "openssl 0.9.24" crate, pulled in well down the tree via reqwest and tokio-tls (and others), panics in its build.rs with 'Unable to detect OpenSSL version'.
the "libc 0.2.48" crate, pulled in by a number of things cargo update-install -a is trying to update, is failing similarly.
I still have all the relevant apt packages (build-essential, pkg-config, *-dev, etc) in the system, but of course newer versions, and they don't seem to be getting used / found.
I'm missing something, obviously, but I'm not sure what. Is there something I need to update or clean in rust / rustup?
This turned out to be due to adding noexec to the tmpfs mount flags for /tmp; not surprising once found but there weren't many useful clues to lead me there.
Which leaves openssl as a more specific problem, rather than a prominent case of a more general one.
Adding and removing libssl-dev didn't help.
It seems I now have openssl 1.1.1, and that seems to not be supported by the old openssl 0.9.24 crate deep down the dependency chain; its build.rs looks like:
match env::var("DEP_OPENSSL_VERSION") {
Ok(ref v) if v == "101" => {
println!("cargo:rustc-cfg=ossl101");
println!("cargo:rustc-cfg=ossl10x");
}
Ok(ref v) if v == "102" => {
println!("cargo:rustc-cfg=ossl102");
println!("cargo:rustc-cfg=ossl10x");
}
Ok(ref v) if v == "110" => {
println!("cargo:rustc-cfg=ossl110");
}
_ => panic!("Unable to detect OpenSSL version"),
}
Newer releases of that crate, including semver-compatible 0.9.40, do have a match entry for ossl111, so I now have a more mundane problem of digging through the crate tree trying to force something to use newer dependencies and/or let cargo use 0.9.40.
I'm looking into what's going on with that crate, it seems to have moved to the main elastic repo, which in turn looks like it's getting close to an 0.21 release, but I haven't yet found the precise equivalent and/or figured out what the migration would be.
I'd very happily just use rustls rather than linking openssl at all, but again how to push this preference all the way down the dependency tree is .. non-obvious .. at least.