0

I tried to add hyper as a dependency to a project of mine, and the build blew up on openssl-rust, because it relies on the openssl headers and libraries being part of the OS, which is not true of OS X anymore (the libraries are there but it's a custom build so grabbing the headers elsewhere won't work). I've seen https://github.com/sfackler/rust-openssl/issues/255, https://github.com/sfackler/rust-openssl/issues/316, and https://github.com/alexcrichton/gcc-rs/issues/63 so I know I need to override something to set the equivalent of the following environment variables in cargo's build system:

OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include
OPENSSL_LIB_DIR=/usr/local/opt/openssl/lib

however looking at http://doc.crates.io/build-script.html#overriding-build-scripts I haven't been able to figure out how I do that.

Some things that I've seen but don't think make for acceptable answers:

  • brew link --force openssl
  • setting the environment variables every time I call cargo build

Note I've seen OpenSSL crate fails compilation on Mac OS X 10.11 (I'd even seen it before posting this, should have said so earlier) but that answer just says to set the env variables every time you compile (one way or another) which I'm not willing to accept as an answer when there's a system for overriding the build script that might work if someone could explain how it works.

Community
  • 1
  • 1
Camden Narzt
  • 2,271
  • 1
  • 23
  • 42
  • Have a look at http://stackoverflow.com/questions/37375712/cross-compile-rust-openssl-for-raspberry-pi-2, and adapt it for osx. I suppose compiling your own version of openssl and not specifying a target could work. Also I found I need to do a `cargo clean` sometimes for the rust-openssl to understand the new environment variables. – tafia May 24 '16 at 05:59
  • Answered at: http://stackoverflow.com/questions/34612395/openssl-crate-fails-compilation-on-mac-os-x-10-11/38946292#38946292 – Camden Narzt Aug 14 '16 at 20:25

0 Answers0