openssl - 错误 : native library `openssl` is being linked to by more than one version of the same package

标签 openssl rust rust-cargo

我在尝试 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.6.7

openssl-sys v0.7.13

Cargo 和 Rust 版本:

$ cargo --version
cargo 0.11.0-nightly (3ff108a 2016-05-24)

$ rustc --version
rustc 1.11.0-nightly (7746a334d 2016-05-28)

文件:

不明白为什么这不能编译以及如何解决这个问题。 谢谢!

最佳答案

链接的工作方式,您只能链接一个本地库的单个版本,否则您最终会得到重复的符号。 cargo links manifest key有助于防止您意外链接到同一组符号两次。

要解决它,您需要通读您的 Cargo.lock(这不是一种难以理解的文件格式)。找到将有问题的库作为依赖项的 crate,并注意哪些有冲突的版本。

然后您必须手动解析您的 依赖项,以便它们的 依赖项使用相同版本的 native 库。


在这种情况下,依赖链的重要方面是:

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。

老实说,这是目前 Rust 中最粗糙的部分之一。至少这个版本的“同一个 crate 的多个不同版本”的奇怪之处提供了一个直接的 Cargo 错误。

关于openssl - 错误 : native library `openssl` is being linked to by more than one version of the same package,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37514797/

相关文章:

encryption - ssl_accept上的“no shared cipher”,为什么?

casting - Rust:如何从有符号整数类型转换为较大的带符号整数类型(不带*符号扩展名)

c - 从 Rust FFI 访问 DPDK 中的静态 C 函数

rust - 如何从构建脚本(build.rs)访问当前 cargo 文件(构建,测试,基准,文档等)

php - 如何在我的历史日志中隐藏 OpenSSL 使用的密码?

c - OpenSSL AES 256 CBC 通过 C 中的 EVP api

rust - 引用 rust 中的引用资料

openssl - 错误 : native library `openssl` is being linked to by more than one version of the same package

rust - 为什么 clap 添加到 Cargo.toml 时无法编译?

带有 openssl 1.1.1 : cannot perform post-handshake authentication 的 Apache 2.4.37