anlumo / flutter_embedder

Flutter embedder written in Rust (WIP)
Apache License 2.0
70 stars 4 forks source link

'main' panicked at src\flutter_application.rs:844:17 #4

Open canewsin opened 2 weeks ago

canewsin commented 2 weeks ago

Running F:\TMP\RustTarget\debug\flutter_embedder.exe E:\FlutterProjs\flutter_app_embeded\build\flutter_assets

../../../flutter/shell/platform/embedder/embedder.cc (1866): 'FlutterEngineInitialize' returned 'kInvalidArguments'. Not running in AOT mode but could not resolve the kernel binary.
thread 'main' panicked at src\flutter_application.rs:844:17:
Invalid arguments.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
../../../flutter/shell/platform/embedder/embedder.cc (2332): 'FlutterEngineDeinitialize' returned 'kInvalidArguments'. Engine handle was invalid.
thread 'main' panicked at src\flutter_application.rs:844:17:
Invalid arguments.
stack backtrace:
   0:     0x7ff6a9a3485d - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ff6a9a3485d - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66      
   2:     0x7ff6a9a3485d - std::sys::backtrace::_print_fmt
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\sys\backtrace.rs:68
   3:     0x7ff6a9a3485d - std::sys::backtrace::_print::impl$0::fmt
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\sys\backtrace.rs:44
   4:     0x7ff6a9a4bfe9 - core::fmt::rt::Argument::fmt
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\core\src\fmt\rt.rs:173
   5:     0x7ff6a9a4bfe9 - core::fmt::write
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\core\src\fmt\mod.rs:1182
   6:     0x7ff6a9a30d21 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\io\mod.rs:1835
   7:     0x7ff6a9a34636 - std::sys::backtrace::print
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\sys\backtrace.rs:34
   8:     0x7ff6a9a36548 - std::panicking::default_hook::closure$1
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:265
   9:     0x7ff6a9a361f9 - std::panicking::default_hook
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:292
  10:     0x7ff6a9a36bc2 - std::panicking::rust_panic_with_hook
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:796
  11:     0x7ff6a9a369cf - std::panicking::begin_panic_handler::closure$0
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:663
  12:     0x7ff6a9a34f4f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\sys\backtrace.rs:171
  13:     0x7ff6a9a365e6 - std::panicking::begin_panic_handler
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:661
  14:     0x7ff6a9a56714 - core::panicking::panic_fmt
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\core\src\panicking.rs:74
  15:     0x7ff6a879130b - flutter_embedder::flutter_application::FlutterApplication::unwrap_result
                               at E:\PythonProjs\flutter_embedder\src\flutter_application.rs:844
  16:     0x7ff6a873af01 - flutter_embedder::flutter_application::impl$5::drop
                               at E:\PythonProjs\flutter_embedder\src\flutter_application.rs:858
  17:     0x7ff6a873652f - core::ptr::drop_in_place<flutter_embedder::flutter_application::FlutterApplication>
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5\library\core\src\ptr\mod.rs:542
  18:     0x7ff6a87eb784 - flutter_embedder::flutter_application::FlutterApplication::new<flutter_embedder::main::async_block$0::closure_env$0>
                               at E:\PythonProjs\flutter_embedder\src\flutter_application.rs:375
  19:     0x7ff946ba1060 - <unknown>
  20:     0x7ff946ba53ea - is_exception_typeof
  21:     0x7ff946bafb80 - _C_specific_handler
  22:     0x7ff946ba45f0 - is_exception_typeof
  23:     0x7ff946bb04b1 - _CxxFrameHandler3
  24:     0x7ff97bad50cf - _chkstk
  25:     0x7ff97ba50154 - RtlUnwindEx
  26:     0x7ff946bb0046 - _C_specific_handler
  27:     0x7ff946ba3245 - is_exception_typeof
  28:     0x7ff946ba3666 - is_exception_typeof
  29:     0x7ff946ba46ec - is_exception_typeof
  30:     0x7ff946bb04b1 - _CxxFrameHandler3
  31:     0x7ff97bad504f - _chkstk
  32:     0x7ff97ba4e866 - RtlFindCharInUnicodeString
  33:     0x7ff97ba84945 - RtlRaiseException
  34:     0x7ff978f7fabc - RaiseException
  35:     0x7ff946ba6ba7 - CxxThrowException
  36:     0x7ff6a9a3c900 - panic_unwind::imp::panic
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\panic_unwind\src\seh.rs:353
  37:     0x7ff6a9a3c900 - panic_unwind::__rust_start_panic
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\panic_unwind\src\lib.rs:100
  38:     0x7ff6a9a36f55 - std::panicking::rust_panic
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:857
  39:     0x7ff6a9a36c53 - std::panicking::rust_panic_with_hook
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:821
  40:     0x7ff6a9a369cf - std::panicking::begin_panic_handler::closure$0
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:663
  41:     0x7ff6a9a34f4f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\sys\backtrace.rs:171
  42:     0x7ff6a9a365e6 - std::panicking::begin_panic_handler
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:661
  43:     0x7ff6a9a56714 - core::panicking::panic_fmt
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\core\src\panicking.rs:74
  44:     0x7ff6a879130b - flutter_embedder::flutter_application::FlutterApplication::unwrap_result
                               at E:\PythonProjs\flutter_embedder\src\flutter_application.rs:844
  45:     0x7ff6a87ead97 - flutter_embedder::flutter_application::FlutterApplication::new<flutter_embedder::main::async_block$0::closure_env$0>
                               at E:\PythonProjs\flutter_embedder\src\flutter_application.rs:355
  46:     0x7ff6a8757d28 - flutter_embedder::main::async_block$0
                               at E:\PythonProjs\flutter_embedder\src\main.rs:111
  47:     0x7ff6a879e759 - tokio::runtime::park::impl$4::block_on::closure$0<enum2$<flutter_embedder::main::async_block_env$0> >
                               at C:\Users\nbhar\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\runtime\park.rs:281     
  48:     0x7ff6a879db4a - tokio::runtime::coop::with_budget
                               at C:\Users\nbhar\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\runtime\coop.rs:107     
  49:     0x7ff6a879db4a - tokio::runtime::coop::budget
                               at C:\Users\nbhar\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\runtime\coop.rs:73      
  50:     0x7ff6a879db4a - tokio::runtime::park::CachedParkThread::block_on<enum2$<flutter_embedder::main::async_block_env$0> >
                               at C:\Users\nbhar\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\runtime\park.rs:281     
  51:     0x7ff6a8750226 - tokio::runtime::context::blocking::BlockingRegionGuard::block_on<enum2$<flutter_embedder::main::async_block_env$0> >
                               at C:\Users\nbhar\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\runtime\context\blocking.rs:66
  52:     0x7ff6a86f1f99 - tokio::runtime::scheduler::multi_thread::impl$0::block_on::closure$0<enum2$<flutter_embedder::main::async_block_env$0> >
                               at C:\Users\nbhar\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\runtime\scheduler\multi_thread\mod.rs:87
  53:     0x7ff6a87c5b1c - tokio::runtime::context::runtime::enter_runtime<tokio::runtime::scheduler::multi_thread::impl$0::block_on::closure_env$0<enum2$<flutter_embedder::main::async_block_env$0> >,tuple$<> >
                               at C:\Users\nbhar\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\runtime\context\runtime.rs:65
  54:     0x7ff6a86f1e94 - tokio::runtime::scheduler::multi_thread::MultiThread::block_on<enum2$<flutter_embedder::main::async_block_env$0> >  
                               at C:\Users\nbhar\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\runtime\scheduler\multi_thread\mod.rs:86
  55:     0x7ff6a86f25e7 - tokio::runtime::runtime::Runtime::block_on<enum2$<flutter_embedder::main::async_block_env$0> >
                               at C:\Users\nbhar\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\runtime\runtime.rs:349  
  56:     0x7ff6a8763da7 - flutter_embedder::main
                               at E:\PythonProjs\flutter_embedder\src\main.rs:63
  57:     0x7ff6a87309eb - core::ops::function::FnOnce::call_once<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > (*)(),tuple$<> >
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5\library\core\src\ops\function.rs:250
  58:     0x7ff6a871a9fe - std::sys::backtrace::__rust_begin_short_backtrace<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > (*)(),enum2$<core::result::Result<tuple$<>,std::io::error::Error> > >
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5\library\std\src\sys\backtrace.rs:155
  59:     0x7ff6a874bbe1 - std::rt::lang_start::closure$0<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > >
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5\library\std\src\rt.rs:159
  60:     0x7ff6a9a2a149 - std::rt::lang_start_internal::closure$2
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\rt.rs:141
  61:     0x7ff6a9a2a149 - std::panicking::try::do_call
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:553
  62:     0x7ff6a9a2a149 - std::panicking::try
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panicking.rs:517
  63:     0x7ff6a9a2a149 - std::panic::catch_unwind
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\panic.rs:350
  64:     0x7ff6a9a2a149 - std::rt::lang_start_internal
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5/library\std\src\rt.rs:141
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5\library\std\src\rt.rs:158
                               at /rustc/5315cbe15b79533f380bbb6685aa5480d5ff4ef5\library\std\src\rt.rs:158
  66:     0x7ff6a8764bc9 - main
  67:     0x7ff6a9a5423c - invoke_main
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  68:     0x7ff6a9a5423c - __scrt_common_main_seh
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  69:     0x7ff97a5b257d - BaseThreadInitThunk
  70:     0x7ff97ba8af28 - RtlUserThreadStart
error: process didn't exit successfully: `F:\TMP\RustTarget\debug\flutter_embedder.exe E:\FlutterProjs\flutter_app_embeded\build\flutter_assets` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)
anlumo commented 2 weeks ago

Try building the flutter bundle in debug mode. Release (AOT) mode needs different flags in initialization, but I haven’t looked into that yet.

canewsin commented 2 weeks ago

This is a debug build, in release mode files kernel and snapshot are completely missing completely.

canewsin commented 2 weeks ago

Also I see the flutter_embedder.h is changed, reporting this just for sake because of how the header file is layout it might not be the issue.

anlumo commented 2 weeks ago

The structs have some primitive kind of versioning (they include the byte size as the first element), so the layout is not the issue.

The basic problem is that the engine can't find the kernel binary that's supposed to be in the bundle you compiled. Maybe the path to the bundle is not correct?