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

[Linux] failed building the example #105

Closed
bus710 opened this issue Oct 15, 2021 · 4 comments
Closed

[Linux] failed building the example #105

bus710 opened this issue Oct 15, 2021 · 4 comments

Comments

@bus710
Copy link

bus710 commented Oct 15, 2021

Hi,

This is not an error or anything, but I want to share the hiccup I had because otherwise some people might give up early.

Quick solution for busy people - need to run "flutter run" first for the example.

... and the background is following.

When I followed the steps in the introduction, I got an error like below:

First cargo run - error: build failed cargo run Compiling nativeshell_examples v0.1.0 (/home/bus710/repo/examples) Compiling glib v0.14.8 Compiling gio-sys v0.14.0 Compiling pango-sys v0.14.0 Compiling atk-sys v0.14.0 Compiling nativeshell v0.1.11 error: failed to run custom build command for `nativeshell_examples v0.1.0 (/home/bus710/repo/examples)`

Caused by:
process didn't exit successfully: /home/bus710/repo/examples/target/debug/build/nativeshell_examples-d760aadebf0231c2/build-script-build (exit status: 101)
--- stdout

** Build failed with error **

JSON operation failed: $missing field packageUri at line 1 column 9839Text:
{"configVersion":2,"packages":[{"name":"async","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.8.2","packageUri":"lib/","languageVersion":"2.12"},{"name":"boolean_selector","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"characters","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"charcode","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.3.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"clock","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"collection","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"cupertino_icons","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-1.0.3","packageUri":"lib/","languageVersion":"2.12"},{"name":"fake_async","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"ffi","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-1.1.2","packageUri":"lib/","languageVersion":"2.12"},{"name":"file","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/file-6.1.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"flutter","rootUri":"file:///home/bus710/flutter/packages/flutter","packageUri":"lib/","languageVersion":"2.12"},{"name":"flutter_test","rootUri":"file:///home/bus710/flutter/packages/flutter_test","packageUri":"lib/","languageVersion":"2.12"},{"name":"flutter_web_plugins","rootUri":"file:///home/bus710/flutter/packages/flutter_web_plugins","packageUri":"lib/","languageVersion":"2.12"},{"name":"http","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.3","packageUri":"lib/","languageVersion":"2.12"},{"name":"http_parser","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-4.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"js","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3","packageUri":"lib/","languageVersion":"2.12"},{"name":"matcher","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.11","packageUri":"lib/","languageVersion":"2.12"},{"name":"meta","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.7.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"nativeshell","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/nativeshell-0.1.10","packageUri":"lib/","languageVersion":"2.13"},{"name":"package_info_plus","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.0.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"package_info_plus_linux","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/package_info_plus_linux-1.0.2","packageUri":"lib/","languageVersion":"2.12"},{"name":"package_info_plus_macos","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/package_info_plus_macos-1.1.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"package_info_plus_platform_interface","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/package_info_plus_platform_interface-1.0.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"package_info_plus_web","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/package_info_plus_web-1.0.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"package_info_plus_windows","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/package_info_plus_windows-1.0.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"path","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"path_provider","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.2","packageUri":"lib/","languageVersion":"2.12"},{"name":"path_provider_linux","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"path_provider_macos","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"path_provider_platform_interface","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_platform_interface-2.0.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"path_provider_windows","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"pedantic","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.11.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"platform","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"plugin_platform_interface","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/plugin_platform_interface-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"process","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/process-4.2.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"shared_preferences","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.6","packageUri":"lib/","languageVersion":"2.12"},{"name":"shared_preferences_linux","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"shared_preferences_macos","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"shared_preferences_platform_interface","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_platform_interface-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"shared_preferences_web","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"shared_preferences_windows","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"sky_engine","rootUri":"file:///home/bus710/flutter/bin/cache/pkg/sky_engine","packageUri":"lib/","languageVersion":"2.12"},{"name":"source_span","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"stack_trace","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"stream_channel","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"string_scanner","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"term_glyph","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"test_api","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.4.3","packageUri":"lib/","languageVersion":"2.12"},{"name":"typed_data","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"url_launcher","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.6","packageUri":"lib/","languageVersion":"2.12"},{"name":"url_launcher_linux","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"url_launcher_macos","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"url_launcher_platform_interface","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_platform_interface-2.0.3","packageUri":"lib/","languageVersion":"2.12"},{"name":"url_launcher_web","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-2.0.1","packageUri":"lib/","languageVersion":"2.12"},{"name":"url_launcher_windows","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-2.0.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"vector_math","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"win32","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.1.3","packageUri":"lib/","languageVersion":"2.13"},{"name":"xdg_directories","rootUri":"file:///home/bus710/flutter/.pub-cache/hosted/pub.dartlang.org/xdg_directories-0.2.0","packageUri":"lib/","languageVersion":"2.12"},{"name":"nativeshell_examples","rootUri":"../","packageUri":"lib/","languageVersion":"2.12"},{"name":"flutter_gen","rootUri":"flutter_gen","languageVersion":"2.12"}],"generated":"2021-10-15T16:29:46.750823Z","generator":"pub","generatorVersion":"2.15.0-82.2.beta"}

--- stderr
thread 'main' panicked at 'explicit panic', build.rs:26:9
stack backtrace:
0: std::panicking::begin_panic
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:541:12
1: build_script_build::main
at ./build.rs:26:9
2: core::ops::function::FnOnce::call_once
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed

The error just says "build.rs" panicked. I had no clue because my setup seems fine to me.

My setup

$ flutter --version
Flutter 2.6.0-12.0.pre.366 • channel master • https://github.com/flutter/flutter.git
Framework • revision a82c50f1f6 (47 minutes ago) • 2021-10-15 09:48:08 -0700
Engine • revision 8034050e78
Tools • Dart 2.15.0 (build 2.15.0-217.0.dev)

$ cargo version
cargo 1.55.0 (32da73ab1 2021-08-23)

$ rustc --version
rustc 1.55.0 (c8dfcfe04 2021-09-06)

Then I wanted to check if the example would be built without NativeShell. So I tried "flutter run" to build desktop/web app. For some reason, I couldn't see anything on the screen. At that moment I thought the flutter example might have some issue in the first place, but there is no issue in the issues. Then I just tried "cargo run" again.....

Second cargo run - example got built normally $ cargo run 1m 9s Compiling nativeshell_examples v0.1.0 (/home/bus710/repo/examples) Compiling gdk-sys v0.14.0 Compiling gdk-pixbuf v0.14.0 Compiling gtk-sys v0.14.0 Compiling gdk v0.14.3 Compiling gtk v0.14.3 Compiling nativeshell v0.1.11 Finished dev [unoptimized + debuginfo] target(s) in 48.40s Running `target/debug/nativeshell_examples`

** Help me make NativeShell and Flutter on desktop better!
** We have a long way to go: https://nativeshell.dev/roadmap

flutter: Observatory listening on http://127.0.0.1:40607/Y2oAKn1Y0iI=/
nativeshell: Writing VM Service info file into ${XDG_RUNTIME_DIR}/vmservice.nativeshell_examples

So my shallow conclusion is that, there were not sufficient flutter packages downloaded/installed when I ran "cargo run" earlier, but the "flutter run" did it for me. Then the second trial was successful.

... I know this is a silly story, but I just hope people don't give up because of this.

@myway7
Copy link

myway7 commented Oct 16, 2021

me too,on macos m1

@knopp
Copy link
Contributor

knopp commented Nov 22, 2021

I can't seem to reproduce this on fresh checkout of examples.

@bus710
Copy link
Author

bus710 commented Nov 22, 2021

I suspect that if someone never ran "flutter pub get" after fresh OS install (flutter SDK install), this can happen.
Just want people leverage this nice project. Let me close this ticket, but some people may find this is helpful.

@bus710 bus710 closed this as completed Nov 22, 2021
@knopp
Copy link
Contributor

knopp commented Nov 24, 2021

The nativeshell build system should run flutter pub get if package.json does not exist automatically.

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