Skip to content

compiler panicked - tauri #111855

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
bburdette opened this issue May 23, 2023 · 5 comments · Fixed by #113542
Closed

compiler panicked - tauri #111855

bburdette opened this issue May 23, 2023 · 5 comments · Fixed by #113542
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bburdette
Copy link

Trying to compile a tauri project. Worked ok before but not now after trying to get tauri-mobile working.

Code

bburdette/zknotes@c7f6b00

Error output

   Compiling app v0.1.0 (/home/bburdette/code/zknotes/zknotes/tauri/src-tauri)
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: TryFromIntError(())', compiler/rustc_metadata/src/rmeta/table.rs:292:57
stack backtrace:
   0:     0x7fd8636ee31a - std::backtrace_rs::backtrace::libunwind::trace::ha9053a9a07ca49cb
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fd8636ee31a - std::backtrace_rs::backtrace::trace_unsynchronized::h9c2852a457ad564e
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd8636ee31a - std::sys_common::backtrace::_print_fmt::h457936fbfaa0070f
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fd8636ee31a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5779d7bf7f70cb0c
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fd863751b6e - core::fmt::write::h5a4baaff1bcd3eb5
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/fmt/mod.rs:1232:17
   5:     0x7fd8636e12c5 - std::io::Write::write_fmt::h4bc1f301cb9e9cce
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/io/mod.rs:1684:15
   6:     0x7fd8636ee0e5 - std::sys_common::backtrace::_print::h5fcdc36060f177e8
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fd8636ee0e5 - std::sys_common::backtrace::print::h54ca9458b876c8bf
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fd8636f0e5f - std::panicking::default_hook::{{closure}}::hbe471161c7664ed6
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:271:22
   9:     0x7fd8636f0b9b - std::panicking::default_hook::ha3500da57aa4ac4f
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:290:9
  10:     0x7fd8669a38b5 - <rustc_driver_impl[fb92b3e21ac03dce]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[911a585bea10363d]::ops::function::FnOnce<(&core[911a585bea10363d]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fd8636f169d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h6507bddc3eebb4a5
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/alloc/src/boxed.rs:2001:9
  12:     0x7fd8636f169d - std::panicking::rust_panic_with_hook::h50c09d000dc561d2
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:696:13
  13:     0x7fd8636f1419 - std::panicking::begin_panic_handler::{{closure}}::h9e2b2176e00e0d9c
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:583:13
  14:     0x7fd8636ee786 - std::sys_common::backtrace::__rust_end_short_backtrace::h5739b8e512c09d02
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7fd8636f1122 - rust_begin_unwind
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
  16:     0x7fd86374dec3 - core::panicking::panic_fmt::hf33a1475b4dc5c3e
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
  17:     0x7fd86374e453 - core::result::unwrap_failed::hdff5465d74574b44
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1750:5
  18:     0x7fd865c789c6 - <rustc_metadata[29cf5a64f33334d8]::rmeta::encoder::EncodeContext>::encode_crate_root
  19:     0x7fd865c09586 - rustc_metadata[29cf5a64f33334d8]::rmeta::encoder::encode_metadata_impl
  20:     0x7fd865c0302c - rustc_data_structures[a232da6b1231993b]::sync::join::<rustc_metadata[29cf5a64f33334d8]::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata[29cf5a64f33334d8]::rmeta::encoder::encode_metadata::{closure#1}, (), ()>
  21:     0x7fd865c02d41 - rustc_metadata[29cf5a64f33334d8]::rmeta::encoder::encode_metadata
  22:     0x7fd865c01f73 - rustc_metadata[29cf5a64f33334d8]::fs::encode_and_write_metadata
  23:     0x7fd865bfc47e - rustc_interface[bd8390756bd7a52a]::passes::start_codegen
  24:     0x7fd865bf8208 - <rustc_middle[1a4ce3311a146f18]::ty::context::GlobalCtxt>::enter::<<rustc_interface[bd8390756bd7a52a]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[911a585bea10363d]::result::Result<alloc[37f5578e48c4c353]::boxed::Box<dyn core[911a585bea10363d]::any::Any>, rustc_span[fab0eb11f1fed58d]::ErrorGuaranteed>>
  25:     0x7fd865bf5fb8 - <rustc_interface[bd8390756bd7a52a]::queries::Queries>::ongoing_codegen
  26:     0x7fd865bf4d6c - rustc_span[fab0eb11f1fed58d]::with_source_map::<core[911a585bea10363d]::result::Result<(), rustc_span[fab0eb11f1fed58d]::ErrorGuaranteed>, rustc_interface[bd8390756bd7a52a]::interface::run_compiler<core[911a585bea10363d]::result::Result<(), rustc_span[fab0eb11f1fed58d]::ErrorGuaranteed>, rustc_driver_impl[fb92b3e21ac03dce]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  27:     0x7fd865bec3cc - std[685882fd5f6d52e5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[bd8390756bd7a52a]::util::run_in_thread_pool_with_globals<rustc_interface[bd8390756bd7a52a]::interface::run_compiler<core[911a585bea10363d]::result::Result<(), rustc_span[fab0eb11f1fed58d]::ErrorGuaranteed>, rustc_driver_impl[fb92b3e21ac03dce]::run_compiler::{closure#1}>::{closure#0}, core[911a585bea10363d]::result::Result<(), rustc_span[fab0eb11f1fed58d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[911a585bea10363d]::result::Result<(), rustc_span[fab0eb11f1fed58d]::ErrorGuaranteed>>
  28:     0x7fd865bebdfa - <<std[685882fd5f6d52e5]::thread::Builder>::spawn_unchecked_<rustc_interface[bd8390756bd7a52a]::util::run_in_thread_pool_with_globals<rustc_interface[bd8390756bd7a52a]::interface::run_compiler<core[911a585bea10363d]::result::Result<(), rustc_span[fab0eb11f1fed58d]::ErrorGuaranteed>, rustc_driver_impl[fb92b3e21ac03dce]::run_compiler::{closure#1}>::{closure#0}, core[911a585bea10363d]::result::Result<(), rustc_span[fab0eb11f1fed58d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[911a585bea10363d]::result::Result<(), rustc_span[fab0eb11f1fed58d]::ErrorGuaranteed>>::{closure#1} as core[911a585bea10363d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x7fd8636fb593 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h39990b24eedef2ab
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/alloc/src/boxed.rs:1987:9
  30:     0x7fd8636fb593 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h01a027258444143b
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/alloc/src/boxed.rs:1987:9
  31:     0x7fd8636fb593 - std::sys::unix::thread::Thread::new::thread_start::ha4f1cdd9c25884ba
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys/unix/thread.rs:108:17
  32:     0x7fd86347de24 - start_thread
  33:     0x7fd8634ff9b0 - __clone3
  34:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.69.0 (84c898d65 2023-04-16) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib --crate-type cdylib --crate-type rlib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `app`
@bburdette bburdette added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 23, 2023
@bburdette
Copy link
Author

this morning it works... made a few changes to configs. Maybe a tauri compile crashes if there's not a proper distDir?

bburdette/zknotes@a681430

If anyone ever looks at this, you can see the changes from crashing to working with

git diff c7f6b00114f5bc85503fdd2b7d9ce6b84d210854

@saethlin
Copy link
Member

If anyone ever looks at this,

I looked into this shortly after you reported it. This ICE looks concerning to me; it is from a checked conversion of a usize length to a u32 length for encoding crate metadata.

But I can't reproduce it. I'm on

rustc 1.69.0 (84c898d65 2023-04-16)
binary: rustc
commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc
commit-date: 2023-04-16
host: x86_64-unknown-linux-gnu
release: 1.69.0
LLVM version: 15.0.7

I run

git clone [email protected]:bburdette/zknotes
cd zknotes
git checkout c7f6b00114f5bc85503fdd2b7d9ce6b84d210854
git submodule update --init --recursive
cargo +stable build

And no ICE. Is there something else I need to do? I have no idea what tauri is.

@bburdette
Copy link
Author

bburdette commented May 24, 2023

info

Tauri is a toolkit for hosting a web app frontend in a rust desktop app, or mobile app. I'm just getting started with it. FWIW I also have some android compile targets installed, though I don't know that they would affect anything here. cargo build should just build the desktop app, not the android.

The way I'm setting up my build env is with nix develop. If you happen to use nix and have flakes enabled, you can cd to zknotes/ and call that command. It should install rustc, cargo, and some android build targets.

When this tauri project compiles it apparently looks at the tauri.conf.json file during the process. If that is incorrect it has problems. The one from commit c7f6b00114f5bc85503fdd2b7d9ce6b84d210854 is I think incorrect.

another try

Just gave it another try, checking out the c7f6b00114f5bc85503fdd2b7d9ce6b84d210854 commit on my laptop. I'm calling cargo build from the /tauri/src-tauri directory.

Mostly cargo build compiles, but it hangs on one of the final steps ('app') for 10 minutes or so, and finally panics. Just guessing, but I suspect something from the tauri build.rs returns a bad value after timing out.

@saethlin
Copy link
Member

I don't use nix. Running cargo build in tauri/src-tauri still doesn't reproduce the ICE.

I'm also not seeing a hang at the last step of the build. So I think there's something different about my build environment. I see a lot of stuff in the file that describes the flake, things like cargo-tauri that I definitely do not have installed.

@saethlin
Copy link
Member

I fixed this in #113542 and forgot to link this issue at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants