错误:本机库"openssl"被同一软件包的多个版本链接到 [英] error: native library `openssl` is being linked to by more than one version of the same package
问题描述
当我尝试装货时,我面临着这个问题:
I'm facing this problem when I try to cargo build:
错误:同一个程序包的多个版本链接到本机库
openssl
,但是只能链接一次;尝试更新或固定您的依赖项,以确保该软件包仅显示一次
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.6.7
openssl-sys v0.7.13
货运和防锈版本:
$ cargo --version
cargo 0.11.0-nightly (3ff108a 2016-05-24)
$ rustc --version
rustc 1.11.0-nightly (7746a334d 2016-05-28)
文件:
无法弄清为什么不编译以及如何解决此问题. 谢谢!
can't get why this doesn't compile and how to solve this problem. Thank you!
推荐答案
链接的工作方式是,只能链接一个版本的本机库,否则最终将出现重复的符号. Cargo的 links
清单密钥有助于防止您意外链接到同一组符号两次.
The way that linking works, you can only have a single version of a native library linked, otherwise you end up with duplicate symbols. Cargo's links
manifest key helps prevent you from accidentally linking to the same set of symbols twice.
要解决此问题,您需要通读Cargo.lock
(这不是很难理解的文件格式).查找将有问题的库作为依赖项的板条箱,并注意哪些板条的版本有冲突.
To solve it, you need to read through your Cargo.lock
(it's not a difficult file format to understand). Find the crates that have the offending library as a dependency and note which ones have conflicting versions.
然后,您必须手动解析您的依赖关系,以便其依赖关系使用相同版本的本机库.
Then you have to manually resolve your dependencies so that their dependencies use the same version of the native library.
在这种情况下,依赖关系链的重要方面是:
In this case, the important aspects of the dependency chain are:
server (0.0.1) => cookie (0.2.4) => openssl (0.7.13)
=> hyper (0.6.16) => cookie (0.1.21) => openssl (0.6.7)
要修复此问题,请修改您的Cargo.toml
以使用与hyper相同版本的cookie.然后,您将隐式获得相同版本的openssl.
To fix it, modify your Cargo.toml
to use the same version of cookie as hyper. Then you will implicitly get the same version of openssl.
说实话,这是Rust目前最粗糙的部分之一.至少此版本的同一条木箱的多个不同版本"的陌生性提供了直接的货运错误.
To be honest, this is one of the roughest parts of Rust at the moment. At least this version of the "multiple different versions of the same crate" strangeness provides a straight-forward Cargo error.
这篇关于错误:本机库"openssl"被同一软件包的多个版本链接到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!