【问题标题】:Using both git2 and hyper: openssl linked more than once同时使用 git2 和 hyper: openssl 链接不止一次
【发布时间】:2017-04-11 00:03:46
【问题描述】:

我正在尝试构建同时使用 hyper 和 git2 的东西。现在我遇到了openssl被链接两次的问题。 shepmaster 的提示将我带到 Cargos features,我尝试了,但我仍然卡住了。

我在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

据我所知,git2 和 hyper 都需要 openssl。有谁知道我做错了什么?由于我禁用了 hyper 的默认功能(以及更好的 cookie)openssl 不再需要它。我查看了锁定文件以查看其他任何东西是否需要openssl,但我找不到任何东西。但我仍然得到错误。不幸的是,cargo 没有告诉我依赖来自哪里。

这是我的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,以防万一。

【问题讨论】:

    标签: openssl rust rust-cargo hyper


    【解决方案1】:

    问题在于params和openssl的组合:

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

    params 0.5 需要多部分 0.8,具有 server 的功能,但 without default-features = false

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

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

    在 hyper 中有一个 ticket 可以切换到较新的 openssl 版本。

    【讨论】:

    • 谢谢!我只想解析发布的 JSON 正文。好的,我只需要删除参数并找到其他方法即可。
    • @Machisuji 我为应该解决这个问题的参数创建了一个pull request
    • @Machisuji 它已被修复,您的原始示例现在可以工作了,因为参数 0.5.0 现在将是 used automatically
    猜你喜欢
    • 2020-04-06
    • 1970-01-01
    • 2016-05-31
    • 1970-01-01
    • 1970-01-01
    • 2015-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多