Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does HWI 0.5.0 have a fixed once_cell dependency version 1.14? #72

Closed
thibistaken opened this issue Feb 18, 2023 · 11 comments
Closed

Comments

@thibistaken
Copy link

I hope this is the right place to get some help on this. I spoke with the Tauri team but they couldn't help.

I am building a desktop app with Rust using Tauri and BDK. I tried to update to the latest version of BDK 0.27.0 but I get an error due to conflicting versions in the HWI Rust wrapper dependencies. The error message is below.

It looks like BDK 0.27.0 requires HWI 0.5.0 from crates.io, which requires exactly the once_cell 1.14.0 crate. This version requirement in HWI conflicts with what Tauri currently requires on its LTS version (1.2), which is at least once_cell 1.15.0.

Why does HWI 0.5.0 require exactly version =1.14 for once_cell? Why not ^1.14 instead? Would you have a way to fix this?

Thank you!

[ERROR rust_analyzer::lsp_utils] cargo check failed:
Cargo watcher failed, the command produced no valid metadata (exit code: ExitStatus(unix_wait_status(25856))):
Updating crates.io index
error: failed to select a version for once_cell.
... required by package wry v0.22.0
... which satisfies dependency wry = "^0.22" of package tauri-runtime-wry v0.12.0
... which satisfies dependency tauri-runtime-wry = "^0.12.0" of package tauri v1.2.0
... which satisfies dependency tauri = "^1.2" of package juno v0.0.0 (/Users/thibm/Documents/dev/Juno/src-tauri)
versions that meet the requirements ^1.15 are: 1.17.0, 1.17.1, 1.16.0, 1.15.0

all possible versions conflict with previously selected packages.

previously selected package once_cell v1.14.0
... which satisfies dependency once_cell = "=1.14" of package hwi v0.5.0
... which satisfies dependency hwi = "^0.5" of package bdk v0.27.0
... which satisfies dependency bdk = "^0.27.0" of package juno v0.0.0 (/Users/thibm/Documents/dev/Juno/src-tauri)

failed to select a version for once_cell which could resolve this conflict

@danielabrozzoni
Copy link
Member

Hey there, thanks for reporting this! It seems like we don't even need once_cell (we probably dropped the dependency time ago, but then forgot to remove it from the Cargo.toml, I'm sorry!), I pushed a fix to #71, which I'll soon merge. Let me know if that works!

@danielabrozzoni
Copy link
Member

danielabrozzoni commented Feb 19, 2023

Oh, now I just remembered: I pinned once_cell to 1.14.0 to keep the MSRV to 1.41 (once_cell 1.17.0 requires rust 1.56!)

@thibistaken
Copy link
Author

thibistaken commented Feb 19, 2023 via email

@danielabrozzoni
Copy link
Member

Makes sense! Does pinning once_cell to 1.15 still meet the MSRV requirements you have?

No, as we try to target rust 1.48, but once_cell 1.15 requires rust 1.56.

I'm now thinking about publishing a whole new major version of hwi with the latest dependencies, so that hwi 2.* has the latest dependencies, while hwi 1.* keeps a low MSRV

@thibistaken
Copy link
Author

Ok, makes sense. I'll be looking forward to that one then! Thanks for all the work you do.

@danielabrozzoni
Copy link
Member

I'm now thinking about publishing a whole new major version of hwi with the latest dependencies, so that hwi 2.* has the latest dependencies, while hwi 1.* keeps a low MSRV

Steve found a workaround! 🎉
Can you please test with rust-hwi master?

hwi = { git = "https://github.com/bitcoindevkit/rust-hwi" }

If it works properly I'll release hwi 0.6.0 :)

@thibistaken
Copy link
Author

Thanks @danielabrozzoni! I added the line hwi = { git = "https://github.com/bitcoindevkit/rust-hwi" } to the Cargo.toml file as you can see below but it triggered the same error as before, included below as well. It seems like the HWI version included in the BDK version I'm trying to use is still conflicting with the Tauri dependencies even if I explicitly state the desired HWI version. Unless I'm doing something wrong? That is 100% possible! :)

error: failed to select a version for once_cell.
... required by package wry v0.22.0
... which satisfies dependency wry = "^0.22" of package tauri-runtime-wry v0.12.0
... which satisfies dependency tauri-runtime-wry = "^0.12.0" of package tauri v1.2.0
... which satisfies dependency tauri = "^1.2" of package juno v0.0.0 (/Users/thibm/Documents/dev/Juno/src-tauri)
versions that meet the requirements ^1.15 are: 1.17.1, 1.17.0, 1.16.0, 1.15.0

all possible versions conflict with previously selected packages.

previously selected package once_cell v1.14.0
... which satisfies dependency once_cell = "=1.14" of package hwi v0.5.0
... which satisfies dependency hwi = "^0.5" of package bdk v0.27.0
... which satisfies dependency bdk = "^0.27.0" of package juno v0.0.0 (/Users/thibm/Documents/dev/Juno/src-tauri)

Here is my Cargo.toml file, if that helps:

[package]
name = "juno"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
edition = "2021"
rust-version = "1.57"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
tauri-build = { version = "1.2", features = [] }

[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.2", features = ["dialog-open", "fs-read-file", "path-all", "shell-open"] }
bdk = { version = "0.27.0", features = [ "hardware-signer" ] }
hwi = { git = "https://github.com/bitcoindevkit/rust-hwi" }

[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = ["custom-protocol"]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = ["tauri/custom-protocol"]

@danielabrozzoni
Copy link
Member

danielabrozzoni commented Feb 22, 2023

Ah, I forgot you were using bdk! Basically rust is still importing hwi 0.5.0 as a dependency of bdk, and so you have the same error. The solution would be to tell rust to use bdk with hwi master as a dependency, but I honestly don't remember how to do that (maybe it can be done using patch-crates.io ?)

I don't have much time right now, but I'll try to find a way to do so in the next few days, sorry!

This could help: https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html

@thibistaken
Copy link
Author

Thank you! And no worries, you've already helped me quite a bunch. I'll try to figure it out.

@danielabrozzoni
Copy link
Member

Try adding a [patch.crates-io] line in your Cargo.toml:

[dependencies]
tauri = "^1.2"
bdk = { version = "0.27.0", features = ["hardware-signer"] }

[patch.crates-io]
hwi = { git = "https://github.com/bitcoindevkit/rust-hwi" }

@thibistaken
Copy link
Author

It worked this time! ✅ Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants