2016-11-27 25 views
3

我正在嘗試構建同時使用hyper和git2的東西。現在我遇到了openssl連接兩次的問題。一個由shepmaster提示我通過Cargos features和我試過,但我仍然卡住。使用git2和hyper:openssl不止一次鏈接

精確的錯誤,我在cargo build得到如下:

error: native library `openssl` is being linked to by more than one version of the same package, but it can only be linked once; try updating or pinning your dependencies to ensure that this package only shows up once 

    openssl-sys v0.7.17 
    openssl-sys v0.9.1 

至於我可以告訴OpenSSL是由GIT2和Hyper同時需要。有誰知道我做錯了什麼?由於我禁用了hyper的默認功能(並且爲了更好的測量,cookie),openssl不再需要它了。我查看了鎖文件,看看是否需要openssl,但我找不到任何東西。但我仍然得到錯誤。不幸的是貨物不會告訴我依賴關係來自哪裏。

這裏是我的Cargo.toml的依賴部分和鎖定文件:

[dependencies] 
openssl = "0.9.1" 
hoedown = "5.0.0" 
iron = "0.4.0" 
webbrowser = "0.1.3" 
router = "0.4.0" 
staticfile = "0.3.1" 
clap = "2.18.0" 
lazy_static = "0.2.2" 
linked-hash-map = "0.3.0" 
params = "0.5.0" 
git2 = "0.6.1" 

[dependencies.yaml-rust] 
version = "0.3.4" 
features = ["preserve_order"] 

[dependencies.hyper] 
version = "0.9.12" 
default-features = false 

[dependencies.cookie] 
version = "0.2.5" 
default-features = false 

這裏的情況下這是感興趣的Cargo.lock

回答

4

問題是PARAMS和OpenSSL的組合:

[dependencies] 
openssl = "0.9.1" 
params = "0.5.0" 

params 0.5需要多0.8,使用特性server,但withoutdefault-features = false

[dependencies.multipart] 
features = ["server"] 
version = "0.8" 

這意味着multipart 0.8也需要hyper 0.9。而hyper(使用默認功能)需要openssl 0.7。

超級中有一個ticket切換到較新的openssl版本。

+0

謝謝!我只想解析一個JSON體。好的,我只需要減少參數然後找到其他的東西來做到這一點。 – Machisuji

+0

@Machisuji我創建了一個[pull request](https://github.com/iron/params/pull/31),它可以解決這個問題。 – wimh

+0

@Machisuji它已被修復,您的原始示例現在正在工作,因爲現在參數0.5.0將[自動使用](http://doc.crates.io/specifying-dependencies.html)。 – wimh