-
-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'fatal error: 'openssl/hmac.h' file not found' on OSX 10.11 when building openssl-sys-extras
#316
Comments
The value of |
Unfortunately, the pass-through doesn't seem to work under the conditions I am using it. All I do is to use openssl as a dependency, without any extra configuration. However, to reproduce the issue, it seems to be enough to do the following on OSX 10.11: ➜ /tmp git clone https://github.com/sfackler/rust-openssl
Cloning into 'rust-openssl'...
cremote: Counting objects: 19706, done.
remote: Total 19706 (delta 0), reused 0 (delta 0), pack-reused 19706
Receiving objects: 100% (19706/19706), 6.85 MiB | 2.23 MiB/s, done.
Resolving deltas: 100% (16053/16053), done.
Checking connectivity... done.
➜ /tmp cd rust-openssl
➜ rust-openssl git:(master) cargo build
Could not find `Cargo.toml` in `/private/tmp/rust-openssl` or any parent directory
➜ rust-openssl git:(master) ll
total 32
-rw-r--r-- 1 byron wheel 2.7K Dec 7 10:03 README.md
-rw-r--r-- 1 byron wheel 6.9K Dec 7 10:03 THIRD_PARTY
-rw-r--r-- 1 byron wheel 828B Dec 7 10:03 appveyor.yml
drwxr-xr-x 6 byron wheel 204B Dec 7 10:03 openssl
drwxr-xr-x 6 byron wheel 204B Dec 7 10:03 openssl-sys
drwxr-xr-x 5 byron wheel 170B Dec 7 10:03 openssl-sys-extras
➜ rust-openssl git:(master) cd openssl
➜ openssl git:(master) cargo build
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading net2 v0.2.19
Downloading ws2_32-sys v0.2.1
Downloading cfg-if v0.1.0
Compiling libc v0.2.2
Compiling pkg-config v0.3.6
Compiling bitflags v0.3.3
Compiling lazy_static v0.1.15
Compiling gcc v0.3.20
Compiling openssl-sys v0.7.1 (file:///private/tmp/rust-openssl/openssl)
Compiling openssl-sys-extras v0.7.1 (file:///private/tmp/rust-openssl/openssl)
Build failed, waiting for other jobs to finish...
failed to run custom build command for `openssl-sys-extras v0.7.1 (file:///private/tmp/rust-openssl/openssl)`
Process didn't exit successfully: `/private/tmp/rust-openssl/openssl/target/debug/build/openssl-sys-extras-0ac187301cabb077/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("i686-apple-darwin")
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
TARGET = Some("i686-apple-darwin")
debug=true opt-level=0
HOST = Some("i686-apple-darwin")
TARGET = Some("i686-apple-darwin")
TARGET = Some("i686-apple-darwin")
HOST = Some("i686-apple-darwin")
CC_i686-apple-darwin = None
CC_i686_apple_darwin = None
HOST_CC = None
CC = None
HOST = Some("i686-apple-darwin")
TARGET = Some("i686-apple-darwin")
HOST = Some("i686-apple-darwin")
CFLAGS_i686-apple-darwin = None
CFLAGS_i686_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m32" "-o" "/private/tmp/rust-openssl/openssl/target/debug/build/openssl-sys-extras-0ac187301cabb077/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"
ExitStatus(Code(1))
command did not execute successfully, got: exit code: 1
--- stderr
src/openssl_shim.c:1:10: fatal error: 'openssl/hmac.h' file not found
#include <openssl/hmac.h>
^
1 error generated.
thread '<main>' panicked at 'explicit panic', /Users/byron/.multirust/cargo/registry/src/github.com-121aea75f9ef2ce2/gcc-0.3.20/src/lib.rs:772 With only ➜ openssl git:(master) OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include cargo build
Compiling openssl-sys-extras v0.7.1 (file:///private/tmp/rust-openssl/openssl)
failed to run custom build command for `openssl-sys-extras v0.7.1 (file:///private/tmp/rust-openssl/openssl)`
Process didn't exit successfully: `/private/tmp/rust-openssl/openssl/target/debug/build/openssl-sys-extras-0ac187301cabb077/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("i686-apple-darwin")
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
TARGET = Some("i686-apple-darwin")
debug=true opt-level=0
HOST = Some("i686-apple-darwin")
TARGET = Some("i686-apple-darwin")
TARGET = Some("i686-apple-darwin")
HOST = Some("i686-apple-darwin")
CC_i686-apple-darwin = None
CC_i686_apple_darwin = None
HOST_CC = None
CC = None
HOST = Some("i686-apple-darwin")
TARGET = Some("i686-apple-darwin")
HOST = Some("i686-apple-darwin")
CFLAGS_i686-apple-darwin = None
CFLAGS_i686_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m32" "-o" "/private/tmp/rust-openssl/openssl/target/debug/build/openssl-sys-extras-0ac187301cabb077/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"
ExitStatus(Code(1))
command did not execute successfully, got: exit code: 1
--- stderr
src/openssl_shim.c:1:10: fatal error: 'openssl/hmac.h' file not found
#include <openssl/hmac.h>
^
1 error generated.
thread '<main>' panicked at 'explicit panic', /Users/byron/.multirust/cargo/registry/src/github.com-121aea75f9ef2ce2/gcc-0.3.20/src/lib.rs:772 With both, ➜ openssl git:(master) OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include DEP_OPENSSL_INCLUDE=/usr/local/opt/openssl/include cargo build
Compiling openssl-sys-extras v0.7.1 (file:///private/tmp/rust-openssl/openssl)
Compiling openssl v0.7.1 (file:///private/tmp/rust-openssl/openssl)
➜ openssl git:(master) Maybe there are other ways to fix it, after all, it was compiling just fine on OSX 10.10 - until now the only solution was to set environment variables though. Having to set two distinct ones with seemingly similar effect appears to be something worth looking at from a usability standpoint. Am I missing something obvious ? |
I think you're demonstrating the behaviour @sfackler described. If you do a clean build with just the non dep prefixed environment variables set it ought to build fine. |
Thanks for chiming in. However, the comment raises more questions:
|
When you ran |
Amazing, thanks for the clarification and the immense amount of patience ! The build did work fine when providing the correct environment variable, It's interesting that I never needed Considering this, #317 shouldn't be needed anymore, even though it might not hurt either. |
You'll want to set |
Now I see ! Thank you ! Considering the importance of using the correct version, do you think it would be worth adjusting the build routines to help assure people don't accidentally link against the wrong version ? |
Yeah, I'm not sure of an easy way to check if you're linking against the right version unfortunately. I'll add a message to |
Ah ha! https://www.openssl.org/docs/manmaster/crypto/OPENSSL_VERSION_NUMBER.html I'll put a thing into |
This is blocked on rust-lang/cc-rs#63 for now. |
When trying to build
openssl-sys-extras
, the build seems to fail withfatal error: 'openssl/hmac.h' file not found
on OSX 10.11, even ifOPENSSL_INCLUDE_DIR
is set to/usr/local/opt/openssl/include
.The Fix
Looking at the build script of
openssl-sys-extras
, you will see that it usesDEP_OPENSSL_INCLUDE
to determine additional include directories. Thus running cargo with something like this ...... will do the trick.
Proposition
To prevent others from running into the issue as well, one could use
OPENSSL_INCLUDE_DIR
as secondary option in the build script.The text was updated successfully, but these errors were encountered: