Ubuntu upgrade broke native linking [closed]


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?


Why not try to uninstall and then re-install. Follow these steps for libssl and repeat for the rest:

  • sudo apt remove libssl-dev
  • cargo clean
  • sudo apt install libssl-dev


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" => {
        Ok(ref v) if v == "102" => {
        Ok(ref v) if v == "110" => {
        _ => 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.


Upgrade reqwest to 0.9 and tokio-tls to 0.2.

Or another alternative is to use ishitatsuyuki’s 0.9.x branch. See his rejected pull request.

openssl = { git = "https://github.com/ishitatsuyuki/rust-openssl", branch = "0.9.x" }


Both of those are indirect dependencies:

$ cargo tree -i -p openssl:0.9.24
openssl v0.9.24
└── native-tls v0.1.5
    ├── hyper-tls v0.1.4
    │   └── reqwest v0.8.8
    │       └── elastic_reqwest v0.20.10

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.


That did the trick at least as an interim workaround.