我的货文件中有一个依赖项,需要根据平台不同,特别是默认特性。我想做的是:
[package]
name = "..blah.."
version = "..blah.."
authors = ["..blah.."]
[target.'cfg(target_os = "macos")'.dependencies]
hyper = { version = "0.9", default-features = false, features = ["security-framework"] }
[target.'cfg(target_os = "linux")'.dependencies]
hyper = { version = "0.9", default-features = true }但这似乎做不到我想做的事。在我的Mac上,它似乎在使用底线目标行,就好像我刚刚指定了hyper = "0.9"。如果我按指定的方式执行cargo build,则会得到与openssl有关的错误:
cargo:warning=#include
但是,如果我像这样构建它:
[dependencies]
hyper = { version = "0.9", default-features = false, features = ["security-framework"] }那它就能造得很好。这表明"macos“的cfg不起作用。
我如何使这一工作,或更具体地说,如何解决问题,我需要我的依赖使用不同的功能平台?
发布于 2016-12-02 03:35:09
看起来这是不可能的锈蚀1.13.0和货物0.13.0-夜间。参见货物问题三一九五和1197。
作为一种解决办法,您可以使用告诉货物使用国产OpenSSL
export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib
export DEP_OPENSSL_INCLUDE=`brew --prefix openssl`/includehttps://stackoverflow.com/questions/39709542
复制相似问题