如何更改创建的子依赖项的版本?

huangapple go评论56阅读模式
英文:

How can i change the version of a sub dependancy of a crate?

问题

我正在尝试使用wasm32-unknown-unknown构建一些库,但我遇到了以下错误:

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/libloading-0.6.7/src/lib.rs:66:20

我可以使用wasm32-unknown-emscripten构建,但wasm-pack不支持它。

所以假设我有以下树结构:

neon_empty
└── neon v0.10.1
    ├── neon-macros v0.10.1 (proc-macro)
    │   ├── quote v1.0.28
    │   │   └── proc-macro2 v1.0.59
    │   │       └── unicode-ident v1.0.9
    │   ├── syn v1.0.109
    │   │   ├── proc-macro2 v1.0.59 (*)
    │   │   ├── quote v1.0.28 (*)
    │   │   └── unicode-ident v1.0.9
    │   └── syn-mid v0.5.3
    │       ├── proc-macro2 v1.0.59 (*)
    │       ├── quote v1.0.28 (*)
    │       └── syn v1.0.109 (*)
    ├── neon-runtime v0.10.1
    │   ├── cfg-if v1.0.0
    │   ├── libloading v0.6.7                <- 我想将此更改为0.7.3
    │   │   └── winapi v0.3.9
    │   └── smallvec v1.10.0
    ├── semver v0.9.0
    │   └── semver-parser v0.7.0
    └── smallvec v1.10.0
    [build-dependencies]
    └── neon-build v0.10.1

我该如何做?

英文:

I'm trying to build some libraries using the wasm32-unknown-unknown and I get

error[E0433]: failed to resolve: use of undeclared crate or module `imp`
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/libloading-0.6.7/src/lib.rs:66:20

I can build using the wasm32-unknown-emscripten but it is not supported by wasm-pack.

So lets say that I have the following tree:

neon_empty
└── neon v0.10.1
    ├── neon-macros v0.10.1 (proc-macro)
    │   ├── quote v1.0.28
    │   │   └── proc-macro2 v1.0.59
    │   │       └── unicode-ident v1.0.9
    │   ├── syn v1.0.109
    │   │   ├── proc-macro2 v1.0.59 (*)
    │   │   ├── quote v1.0.28 (*)
    │   │   └── unicode-ident v1.0.9
    │   └── syn-mid v0.5.3
    │       ├── proc-macro2 v1.0.59 (*)
    │       ├── quote v1.0.28 (*)
    │       └── syn v1.0.109 (*)
    ├── neon-runtime v0.10.1
    │   ├── cfg-if v1.0.0
    │   ├── libloading v0.6.7                <- I want to change this to 0.7.3
    │   │   └── winapi v0.3.9
    │   └── smallvec v1.10.0
    ├── semver v0.9.0
    │   └── semver-parser v0.7.0
    └── smallvec v1.10.0
    [build-dependencies]
    └── neon-build v0.10.1

How can I do it?

答案1

得分: 1

你需要分叉neon-runtime,更改libloading版本,然后在你的Cargo.toml文件中打补丁:

[patch.crates-io]
neon-runtime = { path = ".." }
# 或者
neon-runtime = { git = ".." }

这是因为(正如@Finomnis指出的)0.6.x和0.7.x不兼容语义版本。

英文:

You'll have to fork neon-runtime, change the libloading version and then patch it in your Cargo.toml file:

[patch.crates-io]
neon-runtime = { path = ".." }
# Or
neon-runtime = { git = ".." }

This is because (as @Finomnis pointed out) 0.6.x and 0.7.x are not semver-compatible

huangapple
  • 本文由 发表于 2023年6月1日 21:05:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76382197.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定