Skip to content

[Bug] Build error on MacOS #7776

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

Open
mjablecnik opened this issue Apr 17, 2025 · 3 comments
Open

[Bug] Build error on MacOS #7776

mjablecnik opened this issue Apr 17, 2025 · 3 comments

Comments

@mjablecnik
Copy link

Bug Description

Hello, I went step by step by manual here: https://docs.appflowy.io/docs/documentation/appflowy/from-source/environment-setup/building-on-macos

But when I run command "AF-desktop: Clean + Rebuild All" in VS Code I get this error:

   Compiling lib-dispatch v0.1.0 (/Users/martin/Projects/Applications/AppFlowy/frontend/rust-lib/lib-dispatch)
error: failed to run custom build command for `flowy-error v0.1.0 (/Users/martin/Projects/Applications/AppFlowy/frontend/rust-lib/flowy-error)`

Caused by:
  process didn't exit successfully: `/Users/martin/Projects/Applications/AppFlowy/frontend/rust-lib/target/debug/build/flowy-error-5822a68e9f40e962/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=/Users/martin/Projects/Applications/AppFlowy/frontend/rust-lib/flowy-error/src/errors.rs
  cargo:rerun-if-changed=/Users/martin/Projects/Applications/AppFlowy/frontend/rust-lib/flowy-error/src/code.rs
  cargo:rerun-if-changed=resources/proto/code.proto
  cargo:rerun-if-changed=resources/proto/errors.proto
  /Users/martin/.pub-cache/bin/protoc-gen-dart

  --- stderr
  [INFO ] Can't load Kernel binary: Invalid kernel binary format version.
  [INFO ] FINE: Pub 2.19.4
  [INFO ] ERR : protoc_plugin 22.0.1 doesn't support Dart 2.19.4.
  [INFO ] FINE: Exception type: DataException
  [INFO ] FINE: package:pub/src/utils.dart 557:36                      dataError
  [INFO ]     | package:pub/src/global_packages.dart 380:9             GlobalPackages.find.<fn>
  [INFO ]     | dart:collection                                        MapView.forEach
  [INFO ]     | package:pub/src/global_packages.dart 371:44            GlobalPackages.find
  [INFO ]     | package:pub/src/command/global_run.dart 68:44          GlobalRunCommand.runProtected
  [INFO ]     | package:pub/src/command.dart 190:45                    PubCommand.run.<fn>
  [INFO ]     | dart:async                                             new Future.sync
  [INFO ]     | package:pub/src/utils.dart 111:12                      captureErrors.wrappedCallback
  [INFO ]     | package:stack_trace                                    Chain.capture
  [INFO ]     | package:pub/src/utils.dart 124:11                      captureErrors
  [INFO ]     | package:pub/src/command.dart 190:13                    PubCommand.run
  [INFO ]     | package:args/command_runner.dart 212:27                CommandRunner.runCommand
  [INFO ]     | package:dartdev/dartdev.dart 241:30                    DartdevRunner.runCommand
  [INFO ]     | package:args/command_runner.dart 122:25                CommandRunner.run.<fn>
  [INFO ]     | dart:async                                             new Future.sync
  [INFO ]     | package:args/command_runner.dart 122:14                CommandRunner.run
  [INFO ]     | package:dartdev/dartdev.dart 65:31                     runDartdev
  [INFO ]     | /opt/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart 11:9  main
  [INFO ]     | ===== asynchronous gap ===========================
  [INFO ]     | dart:async                                             Future.catchError
  [INFO ]     | package:pub/src/utils.dart 111:52                      captureErrors.wrappedCallback
  [INFO ]     | package:stack_trace                                    Chain.capture
  [INFO ]     | package:pub/src/utils.dart 124:11                      captureErrors
  [INFO ]     | package:pub/src/command.dart 190:13                    PubCommand.run
  [INFO ]     | package:args/command_runner.dart 212:27                CommandRunner.runCommand
  [INFO ]     | package:dartdev/dartdev.dart 241:30                    DartdevRunner.runCommand
  [INFO ]     | package:args/command_runner.dart 122:25                CommandRunner.run.<fn>
  [INFO ]     | dart:async                                             new Future.sync
  [INFO ]     | package:args/command_runner.dart 122:14                CommandRunner.run
  [INFO ]     | package:dartdev/dartdev.dart 65:31                     runDartdev
  [INFO ]     | /opt/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart 11:9  main
  [INFO ] ---- Log transcript ----
  [INFO ] FINE: Pub 2.19.4
  [INFO ] ERR : protoc_plugin 22.0.1 doesn't support Dart 2.19.4.
  [INFO ] FINE: Exception type: DataException
  [INFO ] FINE: package:pub/src/utils.dart 557:36                      dataError
  [INFO ]     | package:pub/src/global_packages.dart 380:9             GlobalPackages.find.<fn>
  [INFO ]     | dart:collection                                        MapView.forEach
  [INFO ]     | package:pub/src/global_packages.dart 371:44            GlobalPackages.find
  [INFO ]     | package:pub/src/command/global_run.dart 68:44          GlobalRunCommand.runProtected
  [INFO ]     | package:pub/src/command.dart 190:45                    PubCommand.run.<fn>
  [INFO ]     | dart:async                                             new Future.sync
  [INFO ]     | package:pub/src/utils.dart 111:12                      captureErrors.wrappedCallback
  [INFO ]     | package:stack_trace                                    Chain.capture
  [INFO ]     | package:pub/src/utils.dart 124:11                      captureErrors
  [INFO ]     | package:pub/src/command.dart 190:13                    PubCommand.run
  [INFO ]     | package:args/command_runner.dart 212:27                CommandRunner.runCommand
  [INFO ]     | package:dartdev/dartdev.dart 241:30                    DartdevRunner.runCommand
  [INFO ]     | package:args/command_runner.dart 122:25                CommandRunner.run.<fn>
  [INFO ]     | dart:async                                             new Future.sync
  [INFO ]     | package:args/command_runner.dart 122:14                CommandRunner.run
  [INFO ]     | package:dartdev/dartdev.dart 65:31                     runDartdev
  [INFO ]     | /opt/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart 11:9  main
  [INFO ]     | ===== asynchronous gap ===========================
  [INFO ]     | dart:async                                             Future.catchError
  [INFO ]     | package:pub/src/utils.dart 111:52                      captureErrors.wrappedCallback
  [INFO ]     | package:stack_trace                                    Chain.capture
  [INFO ]     | package:pub/src/utils.dart 124:11                      captureErrors
  [INFO ]     | package:pub/src/command.dart 190:13                    PubCommand.run
  [INFO ]     | package:args/command_runner.dart 212:27                CommandRunner.runCommand
  [INFO ]     | package:dartdev/dartdev.dart 241:30                    DartdevRunner.runCommand
  [INFO ]     | package:args/command_runner.dart 122:25                CommandRunner.run.<fn>
  [INFO ]     | dart:async                                             new Future.sync
  [INFO ]     | package:args/command_runner.dart 122:14                CommandRunner.run
  [INFO ]     | package:dartdev/dartdev.dart 65:31                     runDartdev
  [INFO ]     | /opt/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart 11:9  main
  [INFO ] ---- End log transcript ----
  [INFO ] IO  : Writing 3072 characters to text file /Users/martin/.pub-cache/log/pub_log.txt.
  [INFO ] --dart_out: protoc-gen-dart: Plugin failed with status code 65.

  thread 'main' panicked at build-tool/flowy-codegen/src/protobuf_file/mod.rs:288:7:
  Generate dart pb file failed with: resources/proto/code.proto, Err(Custom { kind: Other, error: "Running [\"/Users/martin/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/protoc-bin-vendored-macos-aarch_64-3.1.0/bin/protoc\" \"--dart_out=/Users/martin/Projects/Applications/AppFlowy/frontend/appflowy_flutter/packages/appflowy_backend/lib/protobuf/flowy-error\" \"--proto_path=resources/proto\" \"resources/proto/code.proto\"] exited with error; status code: 1 at build-tool/flowy-codegen/src/protobuf_file/mod.rs:283" })
  stack backtrace:
     0:        0x10518cd00 - std::backtrace_rs::backtrace::libunwind::trace::h6956fa18d4ab00eb
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
     1:        0x10518cd00 - std::backtrace_rs::backtrace::trace_unsynchronized::h502bc8e06091c867
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
     2:        0x10518cd00 - std::sys::backtrace::_print_fmt::hdbae9cccec38fd54
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/sys/backtrace.rs:66:9
     3:        0x10518cd00 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h217270392019d164
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/sys/backtrace.rs:39:26
     4:        0x1051ac230 - core::fmt::rt::Argument::fmt::h03521b57b993b5fd
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/fmt/rt.rs:177:76
     5:        0x1051ac230 - core::fmt::write::he22fcab56bd3ec61
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/fmt/mod.rs:1449:21
     6:        0x105189c84 - std::io::Write::write_fmt::hb32eaafcfd249a19
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/io/mod.rs:1890:15
     7:        0x10518cbb4 - std::sys::backtrace::BacktraceLock::print::h115149c0b879e5c3
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/sys/backtrace.rs:42:9
     8:        0x10518dcc4 - std::panicking::default_hook::{{closure}}::h5c3a234feebd11a5
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:298:22
     9:        0x10518db00 - std::panicking::default_hook::ha0b223ccc4379930
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:325:9
    10:        0x10518e7f4 - std::panicking::rust_panic_with_hook::h203f96c93e7ac62d
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:831:13
    11:        0x10518e3c0 - std::panicking::begin_panic_handler::{{closure}}::hcc8f653f753c0254
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:704:13
    12:        0x10518d1b4 - std::sys::backtrace::__rust_end_short_backtrace::h911de07218b69a6c
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/sys/backtrace.rs:168:18
    13:        0x10518e078 - rust_begin_unwind
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:695:5
    14:        0x1051ce588 - core::panicking::panic_fmt::h6a4014bec58fba4f
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/panicking.rs:75:14
    15:        0x104a38250 - flowy_codegen::protobuf_file::generate_dart_protobuf_files::{{closure}}::h0f3d9dba49a225c5
                                 at /Users/martin/Projects/Applications/AppFlowy/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/mod.rs:288:7
    16:        0x104a1f088 - <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::for_each::hff3e6102b258b2a2
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/slice/iter/macros.rs:254:21
    17:        0x104a0e420 - flowy_codegen::protobuf_file::generate_dart_protobuf_files::h1469cfb224e79bc5
                                 at /Users/martin/Projects/Applications/AppFlowy/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/mod.rs:282:3
    18:        0x104a0d664 - flowy_codegen::protobuf_file::dart_gen::h15d7bc4f1a102632
                                 at /Users/martin/Projects/Applications/AppFlowy/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/mod.rs:61:5
    19:        0x1049fae10 - build_script_build::main::h76a2a1945d2c12ec
                                 at /Users/martin/Projects/Applications/AppFlowy/frontend/rust-lib/flowy-error/build.rs:3:3
    20:        0x1049fad08 - core::ops::function::FnOnce::call_once::h23a45352cea6d51e
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/ops/function.rs:250:5
    21:        0x1049fae6c - std::sys::backtrace::__rust_begin_short_backtrace::ha861928a03b76e23
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/sys/backtrace.rs:152:18
    22:        0x1049faddc - std::rt::lang_start::{{closure}}::h481f2f9651743654
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/rt.rs:199:18
    23:        0x105183f44 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::he7ba0572945420d1
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/core/src/ops/function.rs:284:13
    24:        0x105183f44 - std::panicking::try::do_call::hebe393b810f01e71
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:587:40
    25:        0x105183f44 - std::panicking::try::hb25fce0758ef422c
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:550:19
    26:        0x105183f44 - std::panic::catch_unwind::h84fa9d32cc13223f
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panic.rs:358:14
    27:        0x105183f44 - std::rt::lang_start_internal::{{closure}}::h303447aa1f5dac68
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/rt.rs:168:24
    28:        0x105183f44 - std::panicking::try::do_call::h6fee0bd35745e600
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:587:40
    29:        0x105183f44 - std::panicking::try::h8a1ab658538ac4f7
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panicking.rs:550:19
    30:        0x105183f44 - std::panic::catch_unwind::hb51538dca89efd17
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/panic.rs:358:14
    31:        0x105183f44 - std::rt::lang_start_internal::h95cf27b851151b9c
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/rt.rs:164:5
    32:        0x1049fadb4 - std::rt::lang_start::h8ebc5c1a5db3cba3
                                 at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library/std/src/rt.rs:198:5
    33:        0x1049fae3c - _main
warning: build failed, waiting for other jobs to finish...
Error while executing command, exit code: 101
[cargo-make] INFO - Running Task: restore-crate-type
[cargo-make] ERROR - Task error detected, exit code: 105
[cargo-make] WARN - Build Failed.

 *  The terminal process "/bin/zsh '-l', '-c', 'cargo make --profile "development-mac-$(uname -m)" appflowy-core-dev'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

And here is some additional info:

martin at Martins-MacBook-Air frontend >>> flutter --version
Flutter 3.27.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d8a9f9a52e (3 months ago) • 2025-01-31 16:07:18 -0500
Engine • revision 82bd5b7209
Tools • Dart 3.6.2 • DevTools 2.40.3

martin at Martins-MacBook-Air frontend >>> which protoc-gen-dart
/Users/martin/.pub-cache/bin/protoc-gen-dart

martin at Martins-MacBook-Air frontend >>> echo $PATH
/usr/local/texlive/2024/bin/universal-darwin:/opt/homebrew/opt/openjdk@21/bin:/Users/martin/fvm/default/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:/usr/local/texlive/2024/bin/universal-darwin:/Users/martin/.local/bin:/Users/martin/Library/Android/sdk/platform-tools:/opt/homebrew/opt/openjdk@21/bin:/Users/martin/fvm/default/bin:/Users/martin/.cargo/bin:/Users/martin/Programs/flutter/.pub-cache/bin:/Users/martin/.pub-cache/bin:/Users/martin/bin:/Users/martin/Programs/go/bin:/Users/martin/Programs/node/bin:/Users/martin/Programs/flutter/.pub-cache/bin:/Users/martin/.pub-cache/bin

martin at Martins-MacBook-Air frontend >>> dart pub global activate protoc_plugin
Package protoc_plugin is currently active at version 21.1.2.
Downloading packages... . 
> protobuf 4.0.0 (was 3.1.0)
> protoc_plugin 22.0.1 (was 21.1.2)
Building package executables... 
Built protoc_plugin:protoc_plugin.
Built protoc_plugin:protoc_plugin_bazel.
Installed executable protoc-gen-dart.
Activated protoc_plugin 22.0.1.

martin at Martins-MacBook-Air frontend >>> which protoc-gen-dart
/Users/martin/.pub-cache/bin/protoc-gen-dart
martin at Martins-MacBook-Air frontend >>> 

I tried run dart pub global activate protoc_plugin by this fix: #413 (comment)
but it doesn't work..

How to Reproduce

Go by manual here: https://docs.appflowy.io/docs/documentation/appflowy/from-source/environment-setup/building-on-macos
And run "AF-desktop: Clean + Rebuild All" in VS Code

Expected Behavior

Successfully build AppFlowy app.

Operating System

macOS 15.3.1 with Apple M1

AppFlowy Version(s)

v0.8.9

Screenshots

Image

Additional Context

No response

@richardshiue
Copy link
Collaborator

Hi @mjablecnik, thanks for raising this issue and the detailed logs. It seems like the latest version of protoc plugin doesn't work. Can you try intstalling the older version? dart pub global run protoc_plugin 21.1.2

@mjablecnik
Copy link
Author

@richardshiue Hello, I ran this command:

martin at Martins-MacBook-Air frontend >>> dart pub global activate protoc_plugin 21.1.2
Package protoc_plugin is currently active at version 22.0.1.
Downloading packages... . 
< protobuf 3.1.0 (was 4.0.0) (4.0.0 available)
< protoc_plugin 21.1.2 (was 22.0.1) (22.0.1 available)
Building package executables... 
Built protoc_plugin:protoc_plugin.
Built protoc_plugin:protoc_plugin_bazel.
Installed executable protoc-gen-dart.
Activated protoc_plugin 21.1.2.

But build is still failing..

@LucasXu0
Copy link
Collaborator

It's a Dart SDK or Flutter SDK path configuration issue.

You can try running the project using flutter run -d macos directly to verify it. If it works, I'll close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants