hyperのコンパイルがopenssl絡みで失敗する場合の対処方法

More than 1 year has passed since last update.

前提

項目 説明
OS MacOSX 10.11.2
Rust 1.5.0
検証日時 2016.01.04

エラーの内容としては以下のようなもの。

$ cargo build
         :
   Compiling openssl v0.7.4
   Compiling openssl-sys-extras v0.7.4
   Compiling uuid v0.1.18
   Compiling num v0.1.29
Build failed, waiting for other jobs to finish...
failed to run custom build command for `openssl v0.7.4`
Process didn't exit successfully: `/Users/hattori/work/rust-snippets/access-http/target/debug/build/openssl-bade188098f75a08/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
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-o" "/Users/hattori/work/rust-snippets/access-http/target/debug/build/openssl-bade188098f75a08/out/src/c_helpers.o" "-c" "src/c_helpers.c"
ExitStatus(Code(1))


command did not execute successfully, got: exit code: 1



--- stderr
src/c_helpers.c:1:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^
1 error generated.

対処方法

以下を実行後にcargo buildする。

$ export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include
$ export DEP_OPENSSL_INCLUDE=/usr/local/opt/openssl/include