货物发布使用不同的依赖版本

发布于 2025-02-05 00:20:10 字数 1504 浏览 3 评论 0原文

当我进行货物库发布时,它将无法编译该项目,因为出于某种原因,它使用了依赖关系的不同版本。但是,如果我做货物构建它可以正常工作。

我看到,对于货物出版它使用了其中一个依赖项的两个不同版本:

   Compiling bitcoin v0.27.1
   Compiling bitcoin v0.28.1

稍后失败,因为其中一个依赖项使用0.27.1,另一个使用0.28.1。

依赖项被指定为bitcoin =“ = 0.27.1”cargo.toml中。如果我查看cargo.lock文件,我只会看到版本0.27.1。即cargo.lock中只有一个条目,没有其他版本。 货物树仅显示版本0.27.1货物构建仅使用0.27.1进行编译。

目前尚不清楚0.28.1来自货物发布

我如何告诉cargo Publish不使用0.28。 1并坚持cargo.lock中的版本?我尝试了- 锁定- 冷冻,但我没有任何效果。

更新 其中一个依赖项已定义bitcoin =“> = 0.27”,并且似乎货物试图使用最新的版本0.28.1仅仅是因为它只是因为它适合该遗留的标准。和0.27.1为其他人。显然这是行不通的。如何强制使用一个版本?

更新2: 有冲突版本的整个树货物树 - all-features

├── bitcoin v0.27.1
.
├── emerald-hwkey v0.2.0
│   ├── bitcoin v0.27.1 (*)
│   ├── hdpath v0.6.1
│   │   ├── bitcoin v0.28.1

where hdpath:0.6.1's crate.toml接受任何版本通过:

bitcoin = { version = ">= 0.27", optional = true }

尚不清楚为什么货物试图升级此特定版本,并使一切都彼此不相容。

更新3: 如果我使用强制性“> = 0.27,< 0.28”使用hdpath的本地版本,那么它似乎有效。但是我不想要那个,因为hdpath本身没有这种限制的理由,并且可以与任何版本一起使用。

因此,我只需要确保它使用与父项目兼容的版本。有什么办法吗?

When I do cargo publish of my library it fails to compile the project because for a some reason it uses different version of a dependency. But if I do cargo build it works fine.

I see that for cargo publish it uses two different version of one of the dependencies:

   Compiling bitcoin v0.27.1
   Compiling bitcoin v0.28.1

And it fails later because one of the dependencies uses 0.27.1 and another 0.28.1.

The dependency is specified as bitcoin = "=0.27.1" in Cargo.toml. If I look into Cargo.lock file I see only version 0.27.1. I.e. only one entry, no other versions in Cargo.lock. cargo tree shows only version 0.27.1 as well. And cargo build uses only 0.27.1 for compilation.

It's absolutely unclear where from the 0.28.1 comes from during the cargo publish

How I can tell cargo publish to not use 0.28.1 and stick to version in the Cargo.lock? I tried --locked and --frozen but I doesn't make any effect.

UPDATE
One of the dependencies has defined bitcoin = ">= 0.27" and it seems that Cargo tries to use the most up-to-date version 0.28.1 only because it fits that criteria for that lib. And 0.27.1 for others. That obviously would not work. How to enforce it to use one version?

UPDATE 2:
There is the whole tree of the conflicting versions cargo tree --all-features:

├── bitcoin v0.27.1
.
├── emerald-hwkey v0.2.0
│   ├── bitcoin v0.27.1 (*)
│   ├── hdpath v0.6.1
│   │   ├── bitcoin v0.28.1

Where hdpath:0.6.1's Crate.toml accepts any version via:

bitcoin = { version = ">= 0.27", optional = true }

So it's unclear why Cargo tries to upgrade this particular version and makes everything incompatible to each other.

UPDATE 3:
It seems that it works if I use a local version of hdpath with enforced ">= 0.27, < 0.28". But I don't want that because hdpath by itself doesn't have a reason for such restriction and works fine with any of the versions.

So I just need to make sure it uses the version compatible with the parent project. Is there any way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文