Cargo dependency issue with openssl

So, I am trying to build a hyper server from Swagger using the Swagger codegen.

It builds the server stub successfully, but when I try to build it, I get an openSSL build error.

The server mustache files are 2 years old, and it is trying to pull an older version of openSSL than I have locally on my machine.

Compiling quote v1.0.4
Compiling url v1.7.2
Compiling mime v0.2.6
error: failed to run custom build command for openssl v0.9.24

Caused by:
process didn't exit successfully: /Users/andrevan/Desktop/Andrew/Charter/IstioProjects/swagger-rust/target/debug/build/openssl-dfea6b48aa86ef68/build-script-build (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /Users/andrevan/.cargo/registry/src/
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

There is a fix for the openSSL end of it here OpenSSL build issue on OS X
But what concerns me is the fact that I am using the carets to pull the latest version and it is still trying to get 0.9.24 of rust-openssl.

How do I get it to pull the latest version?

Run cargo install cargo-tree; cargo tree to see what is requesting openssl. Maybe some deeper dependency wants an old version.

Alternatively, delete Cargo.lock. I've seen a bug recently that made Cargo pick an old version for no good reason.

openssl crate isn't very clear about this, but it wants pkg-config installed as well. Make sure you have it, otherwise it won't find openssl even if openssl is installed.

1 Like

Thanks, cargo tree is incredibly helpful.
The offender is in the old Swagger lib, which has probably not been updated in ages.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.