2

我正在使用Rocket设置 Rust 服务器,并尝试将它与JWT library一起使用。他们使用不同版本的 *ring* crate,我在以下过程中遇到错误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`

我的货物.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 文件中不匹配的依赖项,但我不知道该怎么做。

4

1 回答 1

7

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

没有更新版本的rocket可用取决于 的版本0.10cookie这取决于ring 0.12,因此您需要降级jsonwebtoken2.0.3.

您可以通过检查相关crates.iocrate 的页面(如使用jsonwebtoken)、返回旧版本并查看它需要哪些依赖项来解决此问题。

于 2018-03-20T13:39:57.910 回答