我尝试在 Mac OS X 10.11.2 上安装 Rust 的 Iron 框架,但在编译 openssl
的内容时,当我运行 cargo build
或 cargo run
时失败了:
failed to run custom build command for `openssl-sys-extras v0.7.4`
Process didn't exit successfully: `/xxx/rust/hello/target/debug/build/openssl-sys-extras-413d6c73b37a590d/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" "/xxx/rust/hello/target/debug/build/openssl-sys-extras-413d6c73b37a590d/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', /xxx/.cargo/registry/src/github.com-0a35038f75765ae4/gcc-0.3.21/src/lib.rs:772
openssl
版本看起来没问题:
$ openssl version
OpenSSL 0.9.8zg 14 July 2015
我不知道我需要做什么才能使这个安装工作并尝试使用Iron。
brew link --force openssl
并安装pkg-config
将自动解决此问题。话虽如此,将 OpenSSL 库默认可用可能不是一个好主意,我不确定。 - Vladimir Matveev--force
这样的东西持谨慎态度。我希望 Homebrew 的开发人员能够做出所有艰苦工作,并提出一个可靠的建议,我只需遵循即可。 :-) - Shepmasterexport OPENSSL_DIR="$(brew --prefix openssl)"
就足够了。 - BallpointBen