Rust Tauri V2 error: no matching package found

Currently I’m encountering this error when building my application, now using tauri version 2. Using nix build in this pull request #135 - Solve #132 - solver-orgz/treedome - Codeberg.org, I got this error.

building '/nix/store/a0qwxb57l6ixy4lb85dr1iz1nfq84hh1-treedome-0.5.3.drv'...
error: builder for '/nix/store/a0qwxb57l6ixy4lb85dr1iz1nfq84hh1-treedome-0.5.3.drv' failed with exit code 1;
       last 10 log lines:
       > cargo-tauri.hook tauriFlags: --bundles deb --target x86_64-unknown-linux-gnu
       > error: no matching package found
       > searched package name: `hyper-tls`
       > perhaps you meant:      hyper-util
       > location searched: registry `crates-io`
       > required by package `reqwest v0.12.9`
       >     ... which satisfies dependency `reqwest = "^0.12"` (locked to 0.12.9) of package `tauri v2.1.1`
       >     ... which satisfies dependency `tauri = "^2"` (locked to 2.1.1) of package `treedome v0.0.0 (/build/src-tauri)`
       > As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
       >     Error failed to build app:
       For full logs, run 'nix log /nix/store/a0qwxb57l6ixy4lb85dr1iz1nfq84hh1-treedome-0.5.3.drv'.

Please help little ol’ me, I’ve tried:

  • changing the version of the derivation
  • cleaning up my nix using nix-collect-garbage

those looks like rust dependency errors. perhaps tauri v2 has more changes needed in the Cargo.toml file.

The funny thing is, building the application without using nix build (imperatively using yarn run tauri build) created a valid and working binary.

Garbage collection is not a debugging tool, so I suggest not trying that in the future.

Most likely your lockfile is broken. I know nothing about rust, but I added hyper-tls and rustls-pemfile to the Cargo.toml, then cargo update-d, and that error resolved. Obviously I have no idea if this is the correct solution, it seems incorrect, but it works.

Of course it now exposes some other error that you’ll have to debug.

1 Like

I think this happens because tauri has an optional dependency that would require hyper-tls once enabled. Probably an effect of https://github.com/rust-lang/cargo/issues/10801.

I made a small hack for surrealist to enforce that the vendor archive also contains hyper-tls.

Basically, I just checked out the correct version of the surrealist repo locally, ran cargo add hyper-tls@0.6.0 and generated this patch using git diff > 0001-Cargo.patch.

2 Likes

Thanks for the answers everyone. Now I have at least two ways to fix this bug.

  1. Add hyper-tls@0.6.0 to the dependency. I’ve got it by literally going to reqwest v0.12.9 and search for hyper-tls.
  2. Add native-tls to the feature of tauri. So it looks like this tauri = { version = "2", features = ["native-tls"] }.

I chose the second one, because it looks cleaner and I also don’t need to change hyper-tls version if there’s any update to reqwest on tauri side. But that doesn’t mean I like this hack, tbh. Oh, and I found native-tls feature by pure luck from tauri - Rust.

3 Likes