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

[bug] tauri v2 cannot build on linux #7986

Closed
reyamir opened this issue Oct 9, 2023 · 5 comments · Fixed by tauri-apps/tao#815
Closed

[bug] tauri v2 cannot build on linux #7986

reyamir opened this issue Oct 9, 2023 · 5 comments · Fixed by tauri-apps/tao#815
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@reyamir
Copy link

reyamir commented Oct 9, 2023

Describe the bug

Error when run tauri dev

thread 'main' panicked at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/platform_impl/linux/window.rs:680:8:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Reproduction

Use any tauri v2 project then build on linux

Expected behavior

No error

Platform and versions

[✔] Environment
    - OS: Ubuntu 23.04 X64
    ✔ webkit2gtk-4.1: 2.40.5
    ✔ rsvg2: 2.54.5
    ✔ rustc: 1.73.0 (cc66ad468 2023-10-03)
    ✔ Cargo: 1.73.0 (9c4383fb5 2023-08-26)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 18.13.0
    - pnpm: 8.7.4
    - npm: 9.2.0

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.15
    - tauri-build [RUST]: 2.0.0-alpha.9
    - wry [RUST]: 0.33.0
    - tao [RUST]: 0.22.2
    - @tauri-apps/api [NPM]: 2.0.0-alpha.8
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.14

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:3000/
    - framework: React
    - bundler: Vite

Stack trace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
   1: core::panicking::panic_fmt
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
   2: core::panicking::panic
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:117:5
   3: core::option::Option<T>::unwrap
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/option.rs:935:21
   4: tao::platform_impl::platform::window::Window::current_monitor
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/platform_impl/linux/window.rs:675:19
   5: tao::window::Window::current_monitor
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/window.rs:1230:5
   6: tauri_runtime_wry::center_window
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.3/src/lib.rs:2532:26
   7: tauri_runtime_wry::create_webview
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.3/src/lib.rs:2598:13
   8: tauri_runtime_wry::Context<T>::create_webview::{{closure}}
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.3/src/lib.rs:204:11
   9: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:250:5
  10: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/alloc/src/boxed.rs:2007:9
  11: tauri_runtime_wry::handle_user_message
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.3/src/lib.rs:2310:57
  12: tauri_runtime_wry::send_user_message
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.3/src/lib.rs:149:5
  13: tauri_runtime_wry::Context<T>::create_webview
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.3/src/lib.rs:199:5
  14: <tauri_runtime_wry::WryHandle<T> as tauri_runtime::RuntimeHandle<T>>::create_window
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.3/src/lib.rs:1700:5
  15: tauri::app::setup
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-alpha.15/src/app.rs:1717:9
  16: tauri::app::App<R>::run::{{closure}}
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-alpha.15/src/app.rs:894:25
  17: tauri_runtime_wry::handle_event_loop
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.3/src/lib.rs:2366:7
  18: <tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run::{{closure}}
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.3/src/lib.rs:2006:7
  19: tao::platform_impl::platform::event_loop::EventLoop<T>::run_return::{{closure}}
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/platform_impl/linux/event_loop.rs:966:24
  20: glib::main_context::<impl glib::auto::main_context::MainContext>::with_thread_default
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glib-0.16.9/src/main_context.rs:156:12
  21: tao::platform_impl::platform::event_loop::EventLoop<T>::run_return
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/platform_impl/linux/event_loop.rs:890:5
  22: tao::platform_impl::platform::event_loop::EventLoop<T>::run
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/platform_impl/linux/event_loop.rs:844:21
  23: tao::event_loop::EventLoop<T>::run
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/event_loop.rs:212:5
  24: <tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.3/src/lib.rs:1988:5
  25: tauri::app::App<R>::run
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-alpha.15/src/app.rs:892:5
  26: tauri::app::Builder<R>::run
             at /home/reya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-alpha.15/src/app.rs:1643:5
  27: lume::main
             at ./src/main.rs:94:3
  28: core::ops::function::FnOnce::call_once
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Additional context

No response

@reyamir reyamir added status: needs triage This issue needs to triage, applied to new issues type: bug labels Oct 9, 2023
@joebnb
Copy link

joebnb commented Oct 11, 2023

when will tauri do a formal release

@FabianLars
Copy link
Member

@joebnb When it's ready: https://beta.tauri.app/blog/roadmap-to-tauri-2-0/

Also about the issue itself, afaik we weren't able to reproduce this. Can you make sure it also happens in a completely fresh app createad with create-tauri-app?

@pgml
Copy link

pgml commented Oct 14, 2023

@reyamir Are you trying to run Tauri in a virtual environment?

I noticed that this error appears for me when I try to run tauri in a Linux VirtualBox.
On a real Linux installation it works just fine.

@mlollo
Copy link

mlollo commented Oct 15, 2023

I was able to reproduce this in WSL2 Debian on Win11. It was working well and then at some points it didn't. I was playing and testing with the splashscreen and allowList options. I can't find which of my changes caused the issue even when I rollback some of them. My project use tauri + yew with cargo and trunk.

$ cargo --version
cargo 1.72.1 (103a7ff2e 2023-08-15)
$ rustc --version
rustc 1.72.1 (d5c2e9c34 2023-09-19)
$ cat /etc/debian_version 
12.1
$ uname -a
Linux DESKTOP-ID 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 GNU/Linux
PS> wsl --version
WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2428
     Running BeforeDevCommand (`trunk serve`)
2023-10-15T14:45:26.273457Z  INFO 📦 starting build
2023-10-15T14:45:26.274040Z  INFO spawning asset pipelines
2023-10-15T14:45:26.441454Z  INFO copying file path="public/splashscreen.html"
2023-10-15T14:45:26.441486Z  INFO copying file path="public/icon.png"
2023-10-15T14:45:26.441530Z  INFO building zclient-ui
2023-10-15T14:45:26.441916Z  INFO finished copying file path="public/splashscreen.html"
2023-10-15T14:45:26.444575Z  INFO finished copying file path="public/icon.png"
2023-10-15T14:45:26.482049Z  INFO compiling sass/scss path="index.scss"
2023-10-15T14:45:26.490831Z  INFO finished compiling sass/scss path="index.scss"
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
2023-10-15T14:45:26.553825Z  INFO fetching cargo artifacts
2023-10-15T14:45:26.664132Z  INFO processing WASM for zclient-ui
2023-10-15T14:45:26.731594Z  INFO calling wasm-bindgen for zclient-ui
2023-10-15T14:45:27.060394Z  INFO copying generated wasm-bindgen artifacts
2023-10-15T14:45:27.064586Z  INFO applying new distribution
2023-10-15T14:45:27.066337Z  INFO ✅ success
2023-10-15T14:45:27.066532Z  INFO 📡 serving static assets at -> /
2023-10-15T14:45:27.066665Z  INFO 📡 server listening at:
    🏠 http://127.0.0.1:1420
    💻 http://172.22.180.125:1420
        Info Watching /home/user/zclient/src-tauri for changes...
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/platform_impl/linux/window.rs:680:8
stack backtrace:
   0:     0x5573e1434281 - std::backtrace_rs::backtrace::libunwind::trace::h66dc1c6acf794faa
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x5573e1434281 - std::backtrace_rs::backtrace::trace_unsynchronized::ha80d20099a67f790
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5573e1434281 - std::sys_common::backtrace::_print_fmt::h7b959d43f35f16d4
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x5573e1434281 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdaa196410d9ee0b9
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x5573e1460e3f - core::fmt::rt::Argument::fmt::h0ddfbbe8be3f80d0
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/fmt/rt.rs:138:9
   5:     0x5573e1460e3f - core::fmt::write::h66b3c629f3d623e4
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/fmt/mod.rs:1094:21
   6:     0x5573e1430277 - std::io::Write::write_fmt::hb6d80fba4115e0c2
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/io/mod.rs:1714:15
   7:     0x5573e1434095 - std::sys_common::backtrace::_print::h1a49cfb0cf3cce17
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x5573e1434095 - std::sys_common::backtrace::print::hca95c2d0055e42a2
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x5573e1435773 - std::panicking::default_hook::{{closure}}::hc03c01c56bca600c
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:269:22
  10:     0x5573e1435504 - std::panicking::default_hook::hb2cb5315b6634f1c
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:288:9
  11:     0x5573e1435cf9 - std::panicking::rust_panic_with_hook::h75cd912a39a34e8a
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:705:13
  12:     0x5573e1435bb1 - std::panicking::begin_panic_handler::{{closure}}::h1498b46f7849e167
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:595:13
  13:     0x5573e14346e6 - std::sys_common::backtrace::__rust_end_short_backtrace::hd36a39b27b98086b
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:151:18
  14:     0x5573e1435942 - rust_begin_unwind
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:593:5
  15:     0x5573e040fd03 - core::panicking::panic_fmt::h98ef273141454c23
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:67:14
  16:     0x5573e040fd93 - core::panicking::panic::hf53fd8b0bfa5848e
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:117:5
  17:     0x5573e0da09f0 - core::option::Option<T>::unwrap::h47ebff8d8220ba61
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/option.rs:935:21
  18:     0x5573e0d92e32 - tao::platform_impl::platform::window::Window::current_monitor::h43eb8b6bcf877b18
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/platform_impl/linux/window.rs:675:19
  19:     0x5573e0d2d9fb - tao::window::Window::current_monitor::h60a7ecf30ec1e28f
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/window.rs:1230:5
  20:     0x5573e0d28991 - tauri_runtime_wry::center_window::hbf26cb2e09ca0448
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.2/src/lib.rs:2532:26
  21:     0x5573e04bca5f - tauri_runtime_wry::create_webview::hbd6671ad6fa83ca9
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.2/src/lib.rs:2598:13
  22:     0x5573e04bf8b7 - tauri_runtime_wry::Context<T>::create_webview::{{closure}}::h2610c7600d9e8b0f
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.2/src/lib.rs:204:11
  23:     0x5573e04d976b - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbeca605ad674f720
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/ops/function.rs:250:5
  24:     0x5573e0462453 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6a12b1b1b49718bb
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:1993:9
  25:     0x5573e04c29dc - tauri_runtime_wry::handle_user_message::hfd5641ff7bfb8ea1
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.2/src/lib.rs:2310:57
  26:     0x5573e04c18ff - tauri_runtime_wry::send_user_message::h7b9ca73463efb709
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.2/src/lib.rs:149:5
  27:     0x5573e04bf636 - tauri_runtime_wry::Context<T>::create_webview::hb682dae529e0aa82
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.2/src/lib.rs:199:5
  28:     0x5573e04d0987 - <tauri_runtime_wry::WryHandle<T> as tauri_runtime::RuntimeHandle<T>>::create_window::h6f11d9778d76fe67
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.2/src/lib.rs:1700:5
  29:     0x5573e043af1e - tauri::app::setup::h112b66b5a5599d9f
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-alpha.14/src/app.rs:1716:9
  30:     0x5573e0436c33 - tauri::app::App<R>::run::{{closure}}::h34a4b5e9dfc0e941
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-alpha.14/src/app.rs:898:25
  31:     0x5573e04bfdbe - tauri_runtime_wry::handle_event_loop::h30d7ddb6aebc722c
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.2/src/lib.rs:2366:7
  32:     0x5573e04cb1c3 - <tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run::{{closure}}::h2430b407811b41e2
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.2/src/lib.rs:2006:7
  33:     0x5573e0728b2c - tao::platform_impl::platform::event_loop::EventLoop<T>::run_return::{{closure}}::h8e86ce9b79d3fb77
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/platform_impl/linux/event_loop.rs:966:24
  34:     0x5573e08a5e35 - glib::main_context::<impl glib::auto::main_context::MainContext>::with_thread_default::ha77955e88995ed27
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/glib-0.16.9/src/main_context.rs:156:12
  35:     0x5573e0727daa - tao::platform_impl::platform::event_loop::EventLoop<T>::run_return::h47e906b7435bd072
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/platform_impl/linux/event_loop.rs:890:5
  36:     0x5573e0729191 - tao::platform_impl::platform::event_loop::EventLoop<T>::run::h905da8e016756e5d
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/platform_impl/linux/event_loop.rs:844:21
  37:     0x5573e06f03dd - tao::event_loop::EventLoop<T>::run::h270fdf9283e73655
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tao-0.22.2/src/event_loop.rs:212:5
  38:     0x5573e04cac9f - <tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run::hb372a2e10dc81a1e
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-runtime-wry-1.0.0-alpha.2/src/lib.rs:1988:5
  39:     0x5573e0436a71 - tauri::app::App<R>::run::h44676385f4aff6de
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-alpha.14/src/app.rs:896:5
  40:     0x5573e0436fdd - tauri::app::Builder<R>::run::hcd4cfd0aff0b29ca
                               at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-2.0.0-alpha.14/src/app.rs:1642:5
  41:     0x5573e0413351 - zclient_lib::run::hce76b717a08cb687
                               at /home/user/zclient/src-tauri/src/lib.rs:16:5
  42:     0x5573e0410847 - zclient::main::hf182e9eba6f9aa4d
                               at /home/user/zclient/src-tauri/src/main.rs:6:5
  43:     0x5573e04107eb - core::ops::function::FnOnce::call_once::hd9d0aa317cd02643
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/ops/function.rs:250:5
  44:     0x5573e04107ae - std::sys_common::backtrace::__rust_begin_short_backtrace::ha51881971eb755ae
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:135:18
  45:     0x5573e0410781 - std::rt::lang_start::{{closure}}::he72e6463b7efba05
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/rt.rs:166:18
  46:     0x5573e142b2db - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h87e9a912d8a0de33
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/ops/function.rs:284:13
  47:     0x5573e142b2db - std::panicking::try::do_call::ha8d57d42181c12cf
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:500:40
  48:     0x5573e142b2db - std::panicking::try::h2fdb2d19c253437c
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:464:19
  49:     0x5573e142b2db - std::panic::catch_unwind::h9fe5959d2e133449
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panic.rs:142:14
  50:     0x5573e142b2db - std::rt::lang_start_internal::{{closure}}::ha072eb7bbeaa0b6a
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/rt.rs:148:48
  51:     0x5573e142b2db - std::panicking::try::do_call::h983dae29f79ed5db
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:500:40
  52:     0x5573e142b2db - std::panicking::try::h15014751f4b412ba
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:464:19
  53:     0x5573e142b2db - std::panic::catch_unwind::hf837426183b1055f
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panic.rs:142:14
  54:     0x5573e142b2db - std::rt::lang_start_internal::h2bbe0b58b2b89a9f
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/rt.rs:148:20
  55:     0x5573e041075a - std::rt::lang_start::h4a2ff779d16eed27
                               at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/rt.rs:165:17
  56:     0x5573e041086e - main
  57:     0x7f6c01df31ca - <unknown>
  58:     0x7f6c01df3285 - __libc_start_main
  59:     0x5573e0410641 - _start
  60:                0x0 - <unknown>
🚀 A new version of Tauri CLI is available! [2.0.0-alpha.15]
  • Cargo.toml
[package]
name = "zclient-ui"
version = "0.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
yew = { version = "0.21", features = ["csr"] }
yew-router = "0.18.0"
serde = { version = "1.0", features = ["derive"] }
serde-wasm-bindgen = "0.4"
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4"
wasm-logger = "0.2"
web-sys = "0.3"
js-sys = "0.3"
log = "0.4"

[workspace]
members = ["src-tauri"]
  • src-tauri/Cargo.toml
[package]
name = "zclient"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
edition = "2021"

[lib]
name = "zclient_lib"
crate-type = ["staticlib", "cdylib", "rlib"]

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

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

[dependencies]
tauri = { version = "2.0.0-alpha", features = [] }
tauri-plugin-window = "2.0.0-alpha"
tauri-plugin-shell = "2.0.0-alpha"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[features]
# this feature is used for production builds or when `devPath` points to the filesystem
# DO NOT REMOVE!!
custom-protocol = ["tauri/custom-protocol"]
  • tauri.conf.json
{
  "build": {
    "beforeDevCommand": "trunk serve",
    "beforeBuildCommand": "trunk build",
    "devPath": "http://localhost:1420",
    "distDir": "../dist",
    "withGlobalTauri": true
  },
  "package": {
    "productName": "zclient",
    "version": "0.1.0"
  },
  "tauri": {
    "bundle": {
      "active": true,
      "targets": "all",
      "identifier": "com.tauri.zclient",
      "icon": [
        "icons/32x32.png",
        "icons/128x128.png",
        "icons/[email protected]",
        "icons/icon.icns",
        "icons/icon.ico"
      ]
    },
    "security": {
      "csp": null
    },
    "windows": [
      {
        "fullscreen": false,
        "resizable": true,
        "title": "zclient",
        "width": 800,
        "height": 600,
        "visible": false,
        "label": "main",
        "center": true
      },
      {
        "fullscreen": false,
        "resizable": true,
        "width": 800,
        "height": 600,
        "title": "zclient",
        "url": "splashscreen.html",
        "label": "splashscreen",
        "center": true
      }
    ]
  },
  "plugins": {
    "shell": {
      "open": true
    },
    "updater": {
      "active": false
    },
    "allowlist": {
      "all": true,
      "clipboard": {
        "all": false,
        "readText": false,
        "writeText": false
      },
      "notification": {
        "all": true
      },
      "os": {
        "all": true
      },
      "path": {
        "all": true
      },
      "process": {
        "all": false,
        "exit": false,
        "relaunch": true,
        "relaunchDangerousAllowSymlinkMacos": false
      },
      "window": {
        "all": false,
        "center": false,
        "close": true,
        "create": false,
        "hide": false,
        "maximize": true,
        "minimize": true,
        "print": false,
        "requestUserAttention": false,
        "setAlwaysOnTop": false,
        "setCursorGrab": false,
        "setCursorIcon": false,
        "setCursorPosition": false,
        "setCursorVisible": false,
        "setDecorations": true,
        "setFocus": true,
        "setFullscreen": true,
        "setIcon": false,
        "setMaxSize": false,
        "setMinSize": false,
        "setPosition": false,
        "setResizable": false,
        "setSize": true,
        "setSkipTaskbar": false,
        "setTitle": false,
        "show": false,
        "startDragging": true,
        "unmaximize": true,
        "unminimize": true
      }
    }
  }
}
  • src-tauri/main.rs
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

fn main() {
    #[cfg(desktop)]
    zclient_lib::run();
}
  • src-tauri/lib.rs
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
use tauri::Manager;
#[tauri::command]
fn greet(name: &str) -> Result<String, String> {
    // This is a very simplistic example but it shows how to return a Result
    // and use it in the front-end.
    if name.contains(' ') {
        Err("Name should not contain spaces".to_string())
    } else {
        Ok(format!("Hello, {}", name))
    }
}

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder::default()
        .plugin(tauri_plugin_window::init())
        .plugin(tauri_plugin_shell::init())
        .setup(|app| {
            let splashscreen_window = app.get_window("splashscreen").unwrap();
            let main_window = app.get_window("main").unwrap();
            // we perform the initialization code on a new task so the app doesn't freeze
            tauri::async_runtime::spawn(async move {
            // initialize your app here instead of sleeping :)
            println!("Initializing...");
            std::thread::sleep(std::time::Duration::from_secs(10));
            println!("Done initializing.");

            // After it's done, close the splashscreen and display the main window
            splashscreen_window.close().unwrap();
            main_window.show().unwrap();
            });
            Ok(())
        })
        .invoke_handler(tauri::generate_handler![greet])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
  • Install dependencies
rustup target add wasm32-unknown-unknown
cargo install trunk
cargo install wasm-bindgen-cli

sudo apt install libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libsoup-3.0-dev adb
rustup target add aarch64-linux-android rmv7-linux-androideabi i686-linux-android 86_64-linux-android
sudo apt install default-jdk
sudo apt install unzip
cargo install create-tauri-app
cargo install tauri-cli --version ^2.0.0-alpha.14
cargo create-tauri-app --alpha --mobile
> rapp
> Rust
> Yew
cargo tauri dev
cargo tauri android init

@mlollo
Copy link

mlollo commented Oct 15, 2023

I think I found what caused it. The combination of window settings center=true and visible=false. This was found when attempting to set up a splashscreen.
This tauri.config.json setting raises this issue in my wsl2/win11 setup :

{
  "build": {
    "beforeDevCommand": "trunk serve",
    "beforeBuildCommand": "trunk build",
    "devPath": "http://localhost:1420",
    "distDir": "../dist",
    "withGlobalTauri": true
  },
  "package": {
    "productName": "zclient",
    "version": "0.1.0"
  },
  "tauri": {
    "bundle": {
      "active": true,
      "targets": "all",
      "identifier": "com.tauri.zclient",
      "icon": [
        "icons/32x32.png",
        "icons/128x128.png",
        "icons/[email protected]",
        "icons/icon.icns",
        "icons/icon.ico"
      ]
    },
    "security": {
      "csp": null
    },
    "windows": [
      {
        "fullscreen": false,
        "resizable": true,
        "title": "zclient",
        "width": 800,
        "height": 600,
        "visible": false,
        "label": "main",
        "center": true
      }
    ]
  },
  "plugins": {
    "shell": {
      "open": true
    }
  }
}

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
Development

Successfully merging a pull request may close this issue.

5 participants