Skip to content

[bug] [v2] Cargo assertion failure during consecutive Tauri builds #9547

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

Closed
fabiankachlock opened this issue Apr 22, 2024 · 2 comments · Fixed by tauri-apps/create-tauri-app#791 or #11080
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@fabiankachlock
Copy link

fabiankachlock commented Apr 22, 2024

Describe the bug

I've just migrated my project to tauri v2 and cargo fails to build the project because of the following assertion mtimes.insert(output.clone(), mtime).is_none()

This only happens in consecutive builds. The first build after running cargo clean always works. The rebuild triggered by saving a file while tauri dev is running, fails the same way.

These errors occur on both windows & liunx with the same behavior.

Reproduction

You can find the project itself at https://github.com/fabiankachlock/zwoo
Follow these steps to reporduce:

  • Clone the repo: git clone [email protected]:fabiankachlock/zwoo.git
  • cd ./zwoo/frontend
  • checkout the branch git checkout feat/ZWOO-458-migrate-tauri
  • yarn (install frontend deps)
  • yarn vite --mode tauri --port 8070 (start frontend)
  • yarn tauri dev should work fine the first time, but running it a second time fails

Expected behavior

The project builds just fine even after consecutive calls to tauri dev/build or saving a file while tauri dev is active.

Full tauri info output

The windows machine:

[✔] Environment
    - OS: Windows 10.0.22631 X64
    ✔ WebView2: 123.0.2420.97
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
    ✔ cargo: 1.77.2 (e52e36006 2024-03-26)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.11.0
    - pnpm: 8.15.6
    - yarn: 1.22.19
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 2.0.0-beta.15
    - tauri-build [RUST]: 2.0.0-beta.12
    - wry [RUST]: 0.39.1
    - tao [RUST]: 0.27.0
    - tauri-cli [RUST]: 2.0.0-beta.13
    - @tauri-apps/api [NPM]: 2.0.0-beta.8
    - @tauri-apps/cli [NPM]: 2.0.0-beta.13

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist-tmp
    - devUrl: http://localhost:8070/
    - framework: Vue.js
    - bundler: Rollup

The linux machine:

[✔] Environment
    - OS: Linux Rolling Release X64
    ✔ webkit2gtk-4.1: 2.44.1
    ✔ rsvg2: 2.58.0
    ✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
    ✔ cargo: 1.77.2 (e52e36006 2024-03-26)
    ✔ rustup: 1.27.0 (2024-03-12)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 20.11.1
    - pnpm: 8.15.6
    - yarn: 1.22.21
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 2.0.0-beta.15
    - tauri-build [RUST]: 2.0.0-beta.12
    - wry [RUST]: 0.39.1
    - tao [RUST]: 0.27.0
    - tauri-cli [RUST]: 2.0.0-beta.10
    - @tauri-apps/api [NPM]: 2.0.0-beta.8
    - @tauri-apps/cli [NPM]: 2.0.0-beta.13

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist-tmp
    - devUrl: http://localhost:8070/
    - framework: Vue.js
    - bundler: Rollup

Stack trace

thread 'main' panicked at src/cargo\core\compiler\fingerprint\mod.rs:1111:13:
assertion failed: mtimes.insert(output.clone(), mtime).is_none()
stack backtrace:
   0:     0x7ff6f9a012d2 - git_midx_writer_dump
   1:     0x7ff6f9a2b85d - git_midx_writer_dump
   2:     0x7ff6f99fa661 - git_midx_writer_dump
   3:     0x7ff6f9a010fa - git_midx_writer_dump
   4:     0x7ff6f9a03f79 - git_midx_writer_dump
   5:     0x7ff6f9a03c35 - git_midx_writer_dump
   6:     0x7ff6f9a04494 - git_midx_writer_dump
   7:     0x7ff6f9a0432b - git_midx_writer_dump
   8:     0x7ff6f9a01bd9 - git_midx_writer_dump
   9:     0x7ff6f9a04036 - git_midx_writer_dump
  10:     0x7ff6f9ae0227 - git_midx_writer_dump
  11:     0x7ff6f9ae0302 - git_midx_writer_dump
  12:     0x7ff6f8d597f1 - git_filter_source_repo
  13:     0x7ff6f8d51ace - git_filter_source_repo
  14:     0x7ff6f8e10e79 - git_odb_object_id
  15:     0x7ff6f928b329 - git_filter_source_path
  16:     0x7ff6f8d52677 - git_filter_source_repo
  17:     0x7ff6f8d4d61a - git_filter_source_repo
  18:     0x7ff6f912d787 - git_filter_source_path
  19:     0x7ff6f920f770 - git_filter_source_path
  20:     0x7ff6f8b5a97d - git_filter_source_repo
  21:     0x7ff6f8b5a679 - git_filter_source_repo
  22:     0x7ff6f88e53cc - git_libgit2_prerelease
  23:     0x7ff6f89500c5 - git_filter_source_repo
  24:     0x7ff6f8947b2e - git_filter_source_repo
  25:     0x7ff6f892de06 - git_libgit2_prerelease
  26:     0x7ff6f894cb2c - git_filter_source_repo
  27:     0x7ff6f99f0622 - git_midx_writer_dump
  28:     0x7ff6f894ae5c - git_filter_source_repo
  29:     0x7ff6f9a344dc - git_midx_writer_dump
  30:     0x7fff8170257d - BaseThreadInitThunk
  31:     0x7fff8384aa48 - RtlUserThreadStart

Additional context

No response

@fabiankachlock fabiankachlock added status: needs triage This issue needs to triage, applied to new issues type: bug labels Apr 22, 2024
@fabiankachlock fabiankachlock changed the title [bug] Cargo assertion failure during consecutive Tauri builds [bug] [v2] Cargo assertion failure during consecutive Tauri builds Apr 24, 2024
@fabiankachlock
Copy link
Author

After digging a bit more into the problem, it seems to be directly related to the following warning:

warning: output filename collision.
The lib target `zwoo_lib` in package `zwoo v1.0.0-beta.17 (C:\dev\csharp\zwoo\frontend\src-tauri)` has the same output filename as the lib target `zwoo_lib` in package `zwoo v1.0.0-beta.17 (C:\dev\csharp\zwoo\frontend\src-tauri)`.
Colliding filename is: C:\dev\csharp\zwoo\target\debug\deps\libzwoo_lib.rlib
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.

Although I tried to ignore that warning, after removing lib from lib.crate-type it works just fine on both windows and linux.

After revisiting the docs, this is actually the intended configuration. Since I don't have a glue, how the extra crate type ended up there, I guess this issue can be closed.

@boris-schwarz
Copy link

Same for me, after removing lib from lib.crate-type it worked again.

I don't know how it ended up there, but my app stopped working right after I ran npm install @tauri-apps/api@next (it was missing, since I used the old way of extending an existing project instead of running npm create tauri-app@latest -- --beta, so I had only the cli installed).

AlexProgrammerDE added a commit to AlexProgrammerDE/tauri that referenced this issue Sep 21, 2024
AlexProgrammerDE added a commit to AlexProgrammerDE/tauri that referenced this issue Sep 21, 2024
AlexProgrammerDE added a commit to AlexProgrammerDE/tauri that referenced this issue Sep 21, 2024
AlexProgrammerDE added a commit to AlexProgrammerDE/create-tauri-app that referenced this issue Sep 21, 2024
AlexProgrammerDE added a commit to AlexProgrammerDE/tauri that referenced this issue Sep 21, 2024
AlexProgrammerDE added a commit to AlexProgrammerDE/tauri that referenced this issue Sep 21, 2024
AlexProgrammerDE added a commit to AlexProgrammerDE/tauri that referenced this issue Sep 21, 2024
AlexProgrammerDE added a commit to AlexProgrammerDE/tauri that referenced this issue Sep 21, 2024
lucasfernog pushed a commit that referenced this issue Sep 21, 2024
* Fix crate type

Fixes #9547

* Fix crate type

Fixes #9547

* Fix crate type

Fixes #9547

* Fix crate type

Fixes #9547
lucasfernog added a commit to tauri-apps/create-tauri-app that referenced this issue Sep 21, 2024
* Fix crate type

Fixes tauri-apps/tauri#9547

* add change file

---------

Co-authored-by: Lucas Nogueira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
2 participants