[Solved] Compile with openSSL error


#1

I’m trying to build a rust library that uses the openssl-sys v0.9.40 crate.

The error I get is this:

error: failed to run custom build command for openssl-sys v0.9.40
process didn’t exit successfully: /home/matt/src/work/indy-sdk/libindy/target/debug/build/openssl-sys-818d5fb1c5b59f00/build-script-main (exit code: 101)
— stdout
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
cargo:rerun-if-env-changed=OPENSSL_DIR

— stderr
thread ‘main’ panicked at ‘OpenSSL library directory does not exist: lib’, /home/matt/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.40/build/main.rs:60:9
note: Run with RUST_BACKTRACE=1 for a backtrace.

I’m pretty sure I have ssl installed correctly, but it is possible I do not.

The environment variables OPENSSL_DIR and OPENSSL_LIB_DIR are not set. I don’t know what to set them to.

Thnx
Matt


#2

I ended up solving this after thinking about it a different way. I used apt-file list libssl-dev to find location of the openssl header files (which I already had but it confirms I was right) and libraries (.a & .so) files. I was able to set OPENSSL_LIB_DIR. And build worked.


#3

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

[patch.crates-io]
openssl = { git = "https://github.com/ishitatsuyuki/rust-openssl", branch = "0.9.x" }