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

Dependencies related issue (Could not find a file named "pubspec.yaml" in cache) #205

Closed
Roms1383 opened this issue Jul 28, 2022 · 2 comments

Comments

@Roms1383
Copy link

Hi everybody,
I have a small question related to dependencies, as far as I can guess.
I've installed ffigen like dart pub global activate ffigen to use it with flutter_rust_bridge crate.
My LLVM is supposed to be correctly setup, at least no error in this direction :

brew info llvm

llvm: stable 14.0.6 (bottled), HEAD [keg-only]
Next-gen compiler infrastructure
https://llvm.org/
/opt/homebrew/Cellar/llvm/14.0.6_1 (5,851 files, 983.5MB)

Everytime I run the codegenerator lately (a.k.a flutter_rust_bridge_codegen), I end up with this error :

click for the details

export REPO_DIR="$PWD"; cd /; flutter_rust_bridge_codegen --rust-input "$REPO_DIR/native/src/api.rs" --dart-output "$REPO_DIR/lib/bridge_generated.dart" --c-output "$REPO_DIR/ios/Runner/bridge_generated.h" --c-output "$REPO_DIR/macos/Runner/bridge_generated.h"
[2022-07-28T06:42:31Z INFO lib_flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "/Users/romain/Development/lab/cerclo-app/native/src/api.rs", dart_output_path: "/Users/romain/Development/lab/cerclo-app/lib/bridge_generated.dart", dart_decl_output_path: None, c_output_path: ["/Users/romain/Development/lab/cerclo-app/ios/Runner/bridge_generated.h", "/Users/romain/Development/lab/cerclo-app/macos/Runner/bridge_generated.h"], rust_crate_dir: "/Users/romain/Development/lab/cerclo-app/native", rust_output_path: "/Users/romain/Development/lab/cerclo-app/native/src/bridge_generated.rs", class_name: "Native", dart_format_line_length: 80, skip_add_mod_to_lib: false, llvm_path: ["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/Program Files/LLVM", "C:/msys64/mingw64"], llvm_compiler_opts: "", manifest_path: "/Users/romain/Development/lab/cerclo-app/native/Cargo.toml", dart_root: Some("/Users/romain/Development/lab/cerclo-app"), build_runner: true, block_index: BlockIndex(0) }
[2022-07-28T06:42:31Z INFO lib_flutter_rust_bridge_codegen] Phase: Parse source code to AST, then to IR
[2022-07-28T06:42:31Z INFO lib_flutter_rust_bridge_codegen] Phase: Transform IR
[2022-07-28T06:42:31Z INFO lib_flutter_rust_bridge_codegen] Phase: Generate Rust code
[2022-07-28T06:42:31Z INFO lib_flutter_rust_bridge_codegen] Phase: Generate Dart code
[2022-07-28T06:42:31Z INFO lib_flutter_rust_bridge_codegen] Phase: Other things
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::Platform - opaque (Enum is not marked with a valid #[repr(prim)] or #[repr(C)].).
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::KilometerPoint.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::API.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::Geolocation - opaque (Struct is not marked #[repr(C)] or #[repr(transparent)].).
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::wire_platform.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::wire_rust_release_mode.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::wire_get_event_stream.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::wire_update_known_location.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::wire_dispose.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::wire_Geolocation.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::new_box_autoadd_geolocation_0.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::free_WireSyncReturnStruct.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::DartPort.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::DartPostCObjectFnType.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::store_dart_post_cobject.
[2022-07-28T06:42:32Z INFO cbindgen::bindgen::parser] Take native::WireSyncReturnStruct.
[2022-07-28T06:42:32Z INFO lib_flutter_rust_bridge_codegen::commands] Running build_runner at /Users/romain/Development/lab/cerclo-app
[2022-07-28T06:42:33Z WARN lib_flutter_rust_bridge_codegen::commands] command="sh" "-c" "cd "/Users/romain/Development/lab/cerclo-app" && dart run build_runner build --delete-conflicting-outputs" stdout= stderr=Could not find a file named "pubspec.yaml" in "/Users/romain/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-43.0.0".
#0 new Pubspec.load (package:pub/src/pubspec.dart:307:7)
dart-archive/ffigen#1 new Package.load (package:pub/src/package.dart:128:29)
dart-archive/ffigen#2 SystemCache.load (package:pub/src/system_cache.dart:105:20)
#540 Entrypoint._createPackageGraph (package:pub/src/entrypoint.dart:119:63)
#541 Entrypoint.packageGraph (package:pub/src/entrypoint.dart:114:54)
#542 getExecutableForCommand (package:pub/src/executable.dart:338:19)
#543 RunCommand.run (package:dartdev/src/commands/run.dart:250:32)
#530 CommandRunner.runCommand (package:args/command_runner.dart:209:27)
dart-lang/ffigen#8 DartdevRunner.runCommand (package:dartdev/dartdev.dart:231:30)
dart-archive/ffigen#9 CommandRunner.run. (package:args/command_runner.dart:119:25)
#532 new Future.sync (dart:async/future.dart:301:31)
#533 CommandRunner.run (package:args/command_runner.dart:119:14)
#534 runDartdev (package:dartdev/dartdev.dart:66:29)
#535 main (file:///opt/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:11:9)
#536 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:293:32)
dart-archive/ffigen#15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

thread 'main' panicked at 'called Result::unwrap() on an Err value: Failed to run build_runner for /Users/romain/Development/lab/cerclo-app: ', /Users/romain/.cargo/registry/src/github.com-1ecc6299db9ec823/flutter_rust_bridge_codegen-1.38.1/src/main.rs:24:43
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
error: Recipe gen failed on line 8 with exit code 101

What especially caught my attention is stderr=Could not find a file named "pubspec.yaml" in "/Users/romain/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-43.0.0". I've raised an issue in flutter_rust_bridge but indeed it seems more related to ffigen.
So I ended up trying dart pub global activate _fe_analyzer_shared 43.0.0 but then another dependency is missing, then another one, then another one, etc.

I'm very new to Flutter/Dart ecosystem, so could someone explain me what happens here ?

Thanks :)

@liamappelbe
Copy link
Contributor

I'm not familiar with flutter_rust_bridge. It looks like you've opened a PR related to that issue after posting this issue. Is there anything for us to do in ffigen, or does your PR fix the problem?

@Roms1383
Copy link
Author

Roms1383 commented Aug 6, 2022

Yes @liamappelbe it's actually fixed in this PR : turns out historically dart run ... was used, which caused this output whenever flutter pub run ... should be used instead.
Closing it, thanks for your reply !

@Roms1383 Roms1383 closed this as completed Aug 6, 2022
@liamappelbe liamappelbe transferred this issue from dart-archive/ffigen Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants