gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 08:33:11 24 4
gpt4 key购买 nike

我在尝试 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/43882354/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com