Hi there,
I just tried to compile my project after adding hyper as a dependency and received this error:
$ cargo build --release
Compiling openssl-sys-extras v0.7.14
Compiling openssl v0.7.14
Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `openssl v0.7.14`
process didn't exit successfully: `/Users/fabioberger/Documents/projects/rust/lighthouse/target/release/build/openssl-5464f8f6e728c35a/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("3")
PROFILE = Some("release")
TARGET = Some("x86_64-apple-darwin")
debug=false opt-level=3
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-fPIC" "-o" "/Users/fabioberger/Documents/projects/rust/lighthouse/target/release/build/openssl-5464f8f6e728c35a/out/src/c_helpers.o" "-c" "src/c_helpers.c"
cargo:warning=src/c_helpers.c:1:10: fatal error: 'openssl/ssl.h' file not found
cargo:warning=#include <openssl/ssl.h>
cargo:warning= ^
cargo:warning=1 error generated.
ExitStatus(ExitStatus(256))
command did not execute successfully, got: exit code: 1
--- stderr
thread 'main' panicked at 'explicit panic', /Users/fabioberger/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.37/src/lib.rs:952
stack backtrace:
1: 0x102e36ab9 - std::sys::backtrace::tracing::imp::write::h00e948915d1e4c72
2: 0x102e3c9e0 - std::panicking::default_hook::_{{closure}}::h7b8a142818383fb8
3: 0x102e3bd30 - std::panicking::default_hook::h41cf296f654245d7
4: 0x102e3c2f6 - std::panicking::rust_panic_with_hook::h4cbd7ca63ce1aee9
5: 0x102e1da94 - std::panicking::begin_panic::heb5541c22bb99ccf
6: 0x102e29fee - gcc::fail::h035267235bacb8f3
7: 0x102e29a86 - gcc::run::h10dd5abb3da241f3
8: 0x102e1fa7e - gcc::Config::compile::h0f13da9d578bb106
9: 0x102e1c805 - build_script_build::main::hb7741c2c34a9f03d
10: 0x102e3cfca - __rust_maybe_catch_panic
11: 0x102e3b7fe - std::rt::lang_start::h53bf99b0829cc03c
Any help with how to resolve this would be greatly appreciated!
Fabio
I ran into the same issue, installing a new version of OpenSSL worked for me, by for example running brew install openssl. And then adding the code below to your ~/.profile.
export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib
Basically the rust-openssl package needs headers > v1.0 (?) and the default ones in Mac OS are from version 0.9.8, see https://github.com/sfackler/rust-openssl#osx.
One thing to watch out for: the openssl environment variables need an absolute path since the openssl build runs in a different directory than where cargo is invoked. The same error is reported for relative paths as for openssl just being missing.
If you're running this on a Mac, you may want to use the security-framework feature instead. In the long term, this is my plan: https://github.com/hyperium/hyper/issues/907#issuecomment-255509020
I'm facing the same, although i download OPENSSL for windows (openssl-win64) nothing changed , still the same message "openssl/bn.h" no such file or directory .. any one can help , note: i am trying to run a cryptographic proof of data integrity written in C on windows8 machine ..
Needed apt install libssl-dev to fix this on Ubuntu, in addition to apt install openssl
Most helpful comment
Needed
apt install libssl-devto fix this on Ubuntu, in addition toapt install openssl