如何解决我的货运文件中不匹配的依存关系,以解决本机库冲突? [英] How do I fix mismatching dependencies in my Cargo file to work around native library collisions?

查看:118
本文介绍了如何解决我的货运文件中不匹配的依存关系,以解决本机库冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用火箭设置Rust服务器,而我正在尝试与 JWT库结合使用。他们使用不同版本的* ring *板条箱,在货物建造期间出现错误:

I'm setting up a Rust server with Rocket and I'm trying to use it with a JWT library. They use different versions of the *ring* crate and I get an error during cargo build:

error: multiple packages link to native library `ring-asm`, but a native library can be linked only once

package `ring v0.12.1`
    ... which is depended on by `jsonwebtoken v4.0.1`
    ... which is depended on by `auther v0.1.0 (file:///home/drpytho/x/downloadble/auther)`
links to native library `ring-asm`

package `ring v0.11.0`
    ... which is depended on by `cookie v0.9.2`
    ... which is depended on by `rocket v0.3.6`
    ... which is depended on by `rocket_codegen v0.3.6`
    ... which is depended on by `auther v0.1.0 (file:///home/drpytho/x/downloadble/auther)`
also links to native library `ring-asm`

我的Cargo.toml

My Cargo.toml

[package]
name = "auther"
version = "0.1.0"
authors = ["Name <Email@mail.se>"]

[dependencies]
rocket = "0.3.6"
rocket_codegen = "0.3.6"
jsonwebtoken = "4"
serde_derive = "1"
serde = "1"

我读到您应该修复Cargo文件中不匹配的依赖项,但我不知道该怎么做。

I read that you are supposed to fix the mismatching dependencies in your Cargo file, but I can't figure out how to do it.

推荐答案

您必须通过不临时依赖于链接到本机库的板条箱的不同版本来解决此问题。

You have to fix this by not transitively depending on different versions of crates that link to a native library.

没有新版本的 rocket 可用,取决于 cookie 的版本 0.10 ,具体取决于 ring 0.12 ,因此您需要将 jsonwebtoken 降级为 2.0.3

There's no newer version of rocket available that depends on version 0.10 of cookie, which depends on ring 0.12, so you'll need to downgrade jsonwebtoken to 2.0.3.

您可以通过检查 crates.io 来解决此问题。有问题的板条箱的页面(例如 jsonwebtoken ),返回旧版本s,并查看它需要什么依赖项。

You can work this out by checking the crates.io pages for the crates in question (like with jsonwebtoken), going back through older versions, and looking to see what dependencies it needs.

这篇关于如何解决我的货运文件中不匹配的依存关系,以解决本机库冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆