Skip to content
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

Build error under Linux #13

Closed
dureuill opened this issue Jun 8, 2021 · 8 comments
Closed

Build error under Linux #13

dureuill opened this issue Jun 8, 2021 · 8 comments

Comments

@dureuill
Copy link

dureuill commented Jun 8, 2021

Hello!

Thanks for making nativeshell! It had me very curious, so following the README I cloned the example repository and tried to run it, only to find the following output:

examples on  main [?] is 📦 v0.1.0 via 🎯 v2.14.0-188.0.dev via 🦀 v1.50.0
🔋🔽32% ❯ cargo run                                                                                                                     [22:22:53]
   Compiling nativeshell_examples v0.1.0 (/home/dureuill/flutter/examples)
   Compiling gtk v0.9.2
error: failed to run custom build command for `nativeshell_examples v0.1.0 (/home/dureuill/flutter/examples)`

Caused by:
  process didn't exit successfully: `/home/dureuill/flutter/examples/target/debug/build/nativeshell_examples-2bba2697ebaef4c9/build-script-build` (exit code: 101)
  --- stdout

  ** Build failed with error **

  Flutter artifact location path at "/bin/cache/artifacts/engine/linux-x64" does not exist! Try running 'flutter precache'

  --- stderr
  thread 'main' panicked at 'explicit panic', build.rs:26:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

I installed flutter, enabled desktop support and switched to the master channel following the readme, here is the output of flutter doctor:

examples on  main [?] is 📦 v0.1.0 via 🎯 v2.14.0-188.0.dev via 🦀 v1.50.0 took 6s
🔋🔽32% ❯ flutter doctor                                                                                                                [22:23:01]
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.3.0-17.0.pre.265, on Manjaro Linux 5.10.36-2-MANJARO, locale fr_FR.UTF-8)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] Connected device (1 available)

! Doctor found issues in 3 categories.

Running flutter -v create hello_world followed by a flutter run -d linux does result in me seeing the flutter hello world in my linux.

I also tried flutter precache like recommended, and it did something the first time around (not on subsequent runs), but this doesn't appear to solve the problem.

Anything I can do to fix the build?

I'm running manjaro with kernel 5.10.36-2.

I'm new to flutter, so apologies if I misstepped!

@knopp
Copy link
Contributor

knopp commented Jun 8, 2021

Hi,

this part seems suspicious:

Flutter artifact location path at "/bin/cache/artifacts/engine/linux-x64" does not exist! Try running 'flutter precache'

The path should not start with /bin. It should start with wherever "flutter" executable is. But if "flutter" is not in PATH, the error message you got should have been completely different (Please make sure that flutter is in PATH).

What does your PATH look like? I'm curous why flutter location in your case resolved in empty string.

@dureuill
Copy link
Author

dureuill commented Jun 8, 2021

flutter is in PATH.

examples on  main [?] is 📦 v0.1.0 via 🎯 v2.14.0-188.0.dev via 🦀 v1.50.0
🔋🔽29% ❯ which flutter                                                                                                                 [22:37:21]
/bin/flutter

examples on  main [?] is 📦 v0.1.0 via 🎯 v2.14.0-188.0.dev via 🦀 v1.50.0
🔋🔽29% ❯ whereis flutter                                                                                                               [22:38:00]
flutter: /usr/bin/flutter /opt/flutter/bin/flutter /opt/flutter/bin/flutter.bat
examples on  main [?] is 📦 v0.1.0 via 🎯 v2.14.0-188.0.dev via 🦀 v1.50.0
🔋🔽29% ❯ ls /usr/bin/flutter -hl                                                                                                       [22:38:04]
lrwxrwxrwx 1 root root 24  7 juin  22:00 /usr/bin/flutter -> /opt/flutter/bin/flutter

It looks like flutter lives in /opt/flutter but has a symlink to /usr/bin/flutter.
I installed flutter from the AUR, it probably created that symlink.

The symlink doesn't look necessary because /opt/flutter/bin is in my PATH. I can try removing it, but I don't like removing files installed by packages.

Thanks for the quick answer.

@dureuill
Copy link
Author

dureuill commented Jun 8, 2021

Removing the symlink did the trick.

Not sure what to do with this issue then :-). Maybe the code should try to follow symlinks to resolve the path to flutter?

@knopp
Copy link
Contributor

knopp commented Jun 8, 2021

I see where the problem is. I really didn't expect that there'd be symlink to wherever flutter is installed. Normally the way to install flutter is to add [flutter_root]/bin to PATH. Apparently that's not always the case.

I think the best way to fix this should be resolve flutter if it is symlink when searching for artifacts.

@knopp
Copy link
Contributor

knopp commented Jun 8, 2021

I think this should do the trick. I'll just need to test it on all platforms before publishing updated crate.

@dureuill
Copy link
Author

dureuill commented Jun 8, 2021

Aha, I was looking at the code and just arrived at the same conclusion: adding canonicalize should do the trick.

I will test your fix and test and report if it works for me.

@dureuill
Copy link
Author

dureuill commented Jun 8, 2021

After reinstating the symlink and checking that it still fails on the previous version, I can report that commit 10ea0de indeed fixes the problem :-).

Feel free to close this issue now or when the updated crate is published.

@knopp
Copy link
Contributor

knopp commented Jun 8, 2021

Thank you for confirming this. I published updated crate so I'm closing 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

2 participants