AppFlowy icon indicating copy to clipboard operation
AppFlowy copied to clipboard

[Bug] Can't build the app

Open Jam1zhu opened this issue 3 years ago • 6 comments
trafficstars

Initialize the installation according to the document. When executing cargo make --profile development-windows-x86 flowy-sdk-dev, the following exception occurs

  Compiling flowy-grid v0.1.0 (F:\appflowdemo\AppFlowy-main\frontend\rust-lib\flowy-grid)
   Compiling dart-ffi v0.1.0 (F:\appflowdemo\AppFlowy-main\frontend\rust-lib\dart-ffi)
error: failed to run custom build command for `flowy-error v0.1.0 (F:\appflowdemo\AppFlowy-main\frontend\rust-lib\flowy-error)`

Caused by:
  process didn't exit successfully: `F:\appflowdemo\AppFlowy-main\frontend\rust-lib\target\debug\build\flowy-error-290bbe6be7972ecd\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=\\?\F:\appflowdemo\AppFlowy-main\frontend\rust-lib\flowy-error\src\errors.rs
  cargo:rerun-if-changed=./src/protobuf/proto\errors.proto

  --- stderr
  thread 'main' panicked at 'Generate dart pb file failed with: ./src/protobuf/proto\errors.proto', F:\appflowdemo\AppFlowy-main\shared-lib\lib-infra\src\code_gen\protobuf_file\mod.rs:105:13
  stack backtrace:
     0:     0x7ff62b1decdf - std::backtrace_rs::backtrace::dbghelp::trace
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
     1:     0x7ff62b1decdf - std::backtrace_rs::backtrace::trace_unsynchronized
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
     2:     0x7ff62b1decdf - std::sys_common::backtrace::_print_fmt
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\sys_common\backtrace.rs:67
     3:     0x7ff62b1decdf - std::sys_common::backtrace::_print::impl$0::fmt
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\sys_common\backtrace.rs:46
     4:     0x7ff62b1ffcca - core::fmt::write
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\core\src\fmt\mod.rs:1168
     5:     0x7ff62b1d84e8 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\io\mod.rs:1660
     6:     0x7ff62b1e1a8b - std::sys_common::backtrace::_print
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\sys_common\backtrace.rs:49
     7:     0x7ff62b1e1a8b - std::sys_common::backtrace::print
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\sys_common\backtrace.rs:36
     8:     0x7ff62b1e1a8b - std::panicking::default_hook::closure$1
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panicking.rs:211
     9:     0x7ff62b1e1584 - std::panicking::default_hook
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panicking.rs:228
    10:     0x7ff62b1e1f8c - std::panicking::rust_panic_with_hook
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panicking.rs:606
    11:     0x7ff62b1e1e4b - std::panicking::begin_panic_handler::closure$0
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panicking.rs:502
    12:     0x7ff62b1df627 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure$0,never$>
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\sys_common\backtrace.rs:139
    13:     0x7ff62b1e1b49 - std::panicking::begin_panic_handler
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panicking.rs:498
    14:     0x7ff62b208320 - core::panicking::panic_fmt
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\core\src\panicking.rs:116
    15:     0x7ff62a7f33c6 - lib_infra::code_gen::protobuf_file::generate_dart_protobuf_files::closure$0
                                 at F:\appflowdemo\AppFlowy-main\shared-lib\lib-infra\src\code_gen\protobuf_file\mod.rs:105
    16:     0x7ff62a818306 - core::slice::iter::impl$173::for_each<alloc::string::String,lib_infra::code_gen::protobuf_file::generate_dart_protobuf_files::closure$0>
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\core\src\slice\iter\macros.rs:211
    17:     0x7ff62a7f277b - lib_infra::code_gen::protobuf_file::generate_dart_protobuf_files
                                 at F:\appflowdemo\AppFlowy-main\shared-lib\lib-infra\src\code_gen\protobuf_file\mod.rs:99
    18:     0x7ff62a7f1c48 - lib_infra::code_gen::protobuf_file::gen
                                 at F:\appflowdemo\AppFlowy-main\shared-lib\lib-infra\src\code_gen\protobuf_file\mod.rs:47
    19:     0x7ff62a7f11e2 - build_script_build::main
                                 at F:\appflowdemo\AppFlowy-main\frontend\rust-lib\flowy-error\build.rs:4
    20:     0x7ff62a7f115b - core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\core\src\ops\function.rs:227
    21:     0x7ff62a7f101b - std::sys_common::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\std\src\sys_common\backtrace.rs:123
    22:     0x7ff62a7f10b1 - std::rt::lang_start::closure$0<tuple$<> >
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\std\src\rt.rs:145
    23:     0x7ff62b1de53f - core::ops::function::impls::impl$2::call_once
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\core\src\ops\function.rs:259
    24:     0x7ff62b1de53f - std::panicking::try::do_call
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panicking.rs:406
    25:     0x7ff62b1de53f - std::panicking::try
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panicking.rs:370
    26:     0x7ff62b1de53f - std::panic::catch_unwind
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panic.rs:133
    27:     0x7ff62b1de53f - std::rt::lang_start_internal::closure$2
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\rt.rs:128
    28:     0x7ff62b1de53f - std::panicking::try::do_call
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panicking.rs:406
    29:     0x7ff62b1de53f - std::panicking::try
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panicking.rs:370
    30:     0x7ff62b1de53f - std::panic::catch_unwind
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\panic.rs:133
    31:     0x7ff62b1de53f - std::rt::lang_start_internal
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\rt.rs:128
    32:     0x7ff62a7f107f - std::rt::lang_start<tuple$<> >
                                 at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\std\src\rt.rs:144
    33:     0x7ff62a7f1206 - main
    34:     0x7ff62b2062f0 - invoke_main
                                 at d:\a01\_work\43\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
    35:     0x7ff62b2062f0 - __scrt_common_main_seh
                                 at d:\a01\_work\43\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    36:     0x7ffa06924034 - BaseThreadInitThunk
    37:     0x7ffa07773691 - RtlUserThreadStart
warning: build failed, waiting for other jobs to finish...
error: build failed
[cargo-make][1] INFO - Running Task: post-desktop
🚀 🚀 🚀  Flowy-SDK(windows) build success
[cargo-make][1] ERROR - Error while running duckscript: Source: Unknown Line: 7 - Path does not exist.
[cargo-make][1] WARN - Build Failed.
[cargo-make] INFO - Running Task: legacy-migration
[cargo-make] INFO - Running Task: restore-crate-type
[cargo-make] ERROR - Task error detected, exit code: 1
[cargo-make] WARN - Build Failed.

Desktop (please complete the following information):

OS: Windows 10 Version 0.0.3

What is the possible reason for this?

Jam1zhu avatar Mar 10 '22 07:03 Jam1zhu

@Jam1zhu It seems like protoc-gen-dart wasn't installed. Try run this command: which protoc-gen-dart It should output the path of your protoc-gen-dart. e.g. .xx/pub-cache/bin/protoc-gen-dart

appflowy avatar Mar 29 '22 03:03 appflowy

@Jam1zhu Do you still have that problem building the AppFlowy? Please feel free to DM me on Discord directly.

appflowy avatar Apr 18 '22 01:04 appflowy

Hello, I have the same error while building production version of AppFlowy. protoc-gen-dart is installed via dart pub, but error is still occuring. You say, that It should output the path of your protoc-gen-dart. e.g. .xx/pub-cache/bin/protoc-gen-dart, so what is '.xx' folder and where it located?

AlexisIndustries avatar May 19 '22 10:05 AlexisIndustries

Hey @Jam1zhu @AlexisIndustries . I've got this issue as well, and fixed it by running pub global activate protoc_plugin.

To troubleshoot, you guys can try to print the command it triggered in mod.rs line:102(as the error log describes), then run it in your shell manually to find the root cause. Here's my approach for the issues encountered:

  1. command not found: pub export your pub path or just alias it alias pub='flutter pub'/alias pub='dart pub'
  2. Can't load Kernel binary: Invalid kernel binary format version. / No active package protoc_plugin. try the following commands pub global activate protoc_plugin

Also, rm flutter_tools.stamp in your FLUTTER_ROOT/bin/cache or reinstall your flutter may be helpful in some weird cases

JaylenCoding avatar Jun 01 '22 10:06 JaylenCoding

It seems the problem is the terminal (launch by VS Code) can't find the protoc_plugin in $PATH, even though you install it. Please follow these steps to fix the issue.

  1. Pull the latest code from the Main branch
  2. Build AppFlowy.
  3. If you get some errors like this: image Make sure $HOME/.pub-cache/bin is shown in your $PATH. It should appear in .bashrc ./zshrc.

FYI, From my experience, the VS Code uses bash as default. https://github.com/microsoft/vscode/issues/69954

appflowy avatar Jun 01 '22 12:06 appflowy

This happened to me as well.

The only thing I can add is that I started with a clean machine that didn't previously have Rust, Flutter or Dart installed.

Assuming you are correct in that VS Code uses bash (instead of zsh which is configured default in new macbooks), is the solution simply to add the export to .bashrc?

I was able to get this working after making sure I had this in path by adding it to $HOME/.zshrc which is my default. Upon ensuring that it was indeed in $PATH (echo $PATH) and restarting VS Code I was able to move forward.

aarhusgregersen avatar Aug 03 '22 22:08 aarhusgregersen

protoc-gen-dart

dart pub global activate protoc_plugin run this command it will fix the issues

NOTE: DART SDK MUST BE INSTALL OR ADD flutter on top of dart

debojyoti452 avatar Mar 13 '23 17:03 debojyoti452