OpenSSL build issue on OS X

I'm running a program that accesses the Iron crate and I'm having build issues with openssl:

λ ~/rust/workspace/iron-gcd/ master* cargo build
   Compiling openssl-sys-extras v0.7.13
   Compiling openssl v0.7.13
Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `openssl-sys-extras v0.7.13`
Process didn't exit successfully: `/Users/jason/Library/Mobile Documents/com~apple~CloudDocs/workspace/rust/workspace/iron-gcd/target/debug/build/openssl-sys-extras-6cdd9aaab3f99a18/build-script-build` (exit code: 101)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
TARGET = Some("x86_64-apple-darwin")
debug=true opt-level=0
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
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-o" "/Users/jason/Library/Mobile Documents/com~apple~CloudDocs/workspace/rust/workspace/iron-gcd/target/debug/build/openssl-sys-extras-6cdd9aaab3f99a18/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"

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/jason/.cargo/registry/src/
note: Run with `RUST_BACKTRACE=1` for a backtrace.

λ ~/rust/workspace/iron-gcd/ master* gcc -v
Configured with: --prefix=/Applications/ --with-gxx-include-dir=/Applications/
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Applications/

I saw that there were issues with Windows and Iron but I'm having a similar problem with OS X. I'm using the latest stable build of Xcode and tools and shown at the end with gcc -v information.

Has anyone else run into this issue lately?

There are instructions in the rust-openssl README file for installing the required OpenSSL headers on Mac OS X.

1 Like

Depending on your requirements, you may want to consider installing open-ssl directly from brew. This will get you the actual open-ssl rather than Apple's take.

1 Like

Yup that did it. Now I just need to make sure those environment variables are exported under eshell. But I'm pretty sure I got that covered.

Thanks @mbrubeck!

Of course, now I have other issues but it appears that the example that I'm following has an issue with bodyparser. Time to dig into that one.