gliheng / flutter-app-template

Desktop flutter app template
MIT License
45 stars 7 forks source link

run script error: Library not loaded, FlutterEmbedder #3

Open canadaduane opened 5 years ago

canadaduane commented 5 years ago

I'm starting a fresh project using the latest flutter version, but when I run ./scripts/run.py I get the following error at the end of the compilation steps:

   ...
   Compiling tokio-tcp v0.1.3
   Compiling tokio v0.1.18
   Compiling cargo_toml v0.4.0
   Compiling flutter-engine v0.2.1
   Compiling shannon_editor v0.1.0 (/Users/duane/Projects/flutter-app/rust)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 01s
     Running `target/debug/shannon_editor`
dyld: Library not loaded: @rpath/FlutterEmbedder.framework/Versions/A/FlutterEmbedder
  Referenced from: /Users/duane/Projects/flutter-app/rust/target/debug/shannon_editor
  Reason: image not found

I'm not sure what @rpath should expand to, so I'm not sure where to look for this library.

Environment

Mac OS X 10.14.3

Rust:

rustc --version
rustc 1.32.0 (9fda7c223 2019-01-16)

Flutter:

~/flutter/bin/flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (7 weeks ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
AwayQu commented 5 years ago

I'm starting a fresh project using the latest flutter version, but when I run ./scripts/run.py I get the following error at the end of the compilation steps:

   ...
   Compiling tokio-tcp v0.1.3
   Compiling tokio v0.1.18
   Compiling cargo_toml v0.4.0
   Compiling flutter-engine v0.2.1
   Compiling shannon_editor v0.1.0 (/Users/duane/Projects/flutter-app/rust)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 01s
     Running `target/debug/shannon_editor`
dyld: Library not loaded: @rpath/FlutterEmbedder.framework/Versions/A/FlutterEmbedder
  Referenced from: /Users/duane/Projects/flutter-app/rust/target/debug/shannon_editor
  Reason: image not found

I'm not sure what @rpath should expand to, so I'm not sure where to look for this library.

Environment

Mac OS X 10.14.3

Rust:

rustc --version
rustc 1.32.0 (9fda7c223 2019-01-16)

Flutter:

~/flutter/bin/flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (7 weeks ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

Author's another repo has a pre-need config. Add these to .bash_profile will fix.

FLUTTER_PATH="/Users/${USER}/code/flutter_macos_v1.2.1-stable"
export PATH="$PATH:${FLUTTER_PATH}/flutter/bin"
export FLUTTER_ROOT="${FLUTTER_PATH}/flutter"
export FLUTTER_ENGINE_VERSION=`cat ${FLUTTER_PATH}/flutter/bin/internal
       │ /engine.version`
gliheng commented 5 years ago

Can you try again? This one is strange though. I usually succeed on the second try. It's like the compiler takes time to find the framework.

canadaduane commented 5 years ago

I re-installed all the latest versions of everything, and it works as you say. Fails the first time; works the second time.

First try:

   Compiling flutter-engine v0.3.2
warning: crate `DTest` should have a snake case name
  |
  = note: #[warn(non_snake_case)] on by default
  = help: convert the identifier to snake case: `dtest`

    Finished dev [unoptimized + debuginfo] target(s) in 1m 50s
     Running `target/debug/DTest`
dyld: Library not loaded: @rpath/FlutterEmbedder.framework/Versions/A/FlutterEmbedder
  Referenced from: /Users/dujohnson/tmp/flutter-app-template/rust/target/debug/DTest
  Reason: image not found

Second try:

   Compiling flutter-engine v0.3.2
warning: crate `DTest` should have a snake case name
  |
  = note: #[warn(non_snake_case)] on by default
  = help: convert the identifier to snake case: `dtest`

    Finished dev [unoptimized + debuginfo] target(s) in 1m 14s
     Running `target/debug/DTest`
[20:51:52][INFO][DTest] Running inside cargo project

Versions

$ rustc --version
rustc 1.35.0 (3c235d560 2019-05-20)
$ ~/flutter/bin/flutter --version
Flutter 1.6.3 • channel beta • https://github.com/flutter/flutter.git
Framework • revision bc7bc94083 (8 days ago) • 2019-05-23 10:29:07 -0700
Engine • revision 8dc3a4cde2
Tools • Dart 2.3.2 (build 2.3.2-dev.0.0 e3edfd36b2)
gliheng commented 5 years ago

Yes, for some reason the compiler failed to find the framework, the first time it's compiled after downloading from network.