Desdaemon / flutter_rust_bridge_template

Template for Flutter + Rust integration with flutter_rust_bridge.
https://desdaemon.github.io/flutter_rust_bridge_template/
Apache License 2.0
120 stars 63 forks source link

Pod install error on macOS when add bitsdojo_window dependency #59

Closed tommy306 closed 9 months ago

tommy306 commented 10 months ago

❯ flutter run Connected devices: macOS (desktop) • macos • darwin-arm64 • macOS 13.4.1 22F82 darwin-arm64 Chrome (web) • chrome • web-javascript • Google Chrome 118.0.5993.96

Checking for wireless devices...

Please choose one (or "q" to quit): 1 Launching lib/main.dart on macOS in debug mode... Running pod install... 411ms CocoaPods' output: ↳ Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
[!] Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`, did find `Runner`.

/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer/target_inspector.rb:108:in `compute_targets'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer/target_inspector.rb:40:in `compute_results'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1197:in `block (3 levels) in inspect_targets_to_integrate'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1195:in `each'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1195:in `block (2 levels) in inspect_targets_to_integrate'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1193:in `each'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1193:in `block in inspect_targets_to_integrate'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:1188:in `inspect_targets_to_integrate'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer/analyzer.rb:107:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:422:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:162:in `install!'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/command/install.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-1.12.1/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.12.1/libexec/bin/pod:25:in `<main>'

dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.2 ffi: ^2.0.1 flutter_rust_bridge: ^1.45.0 meta: ^1.8.0 uuid: ^4.1.0 bitsdojo_window: ^0.1.5 // add new lib

Desdaemon commented 10 months ago

Seems like this problem is not unique to bitsdojo but to all plugin packages. Since the base XCode project does not come with any scaffolding for plugins, adding such a package will add/change a few project files that break the template. The fix is to:

  1. Completely remove ios/, macos/ and build/
  2. flutter create --platforms=ios,macos .
  3. flutter pub add bitsdojo_window
  4. Follow the steps here to set up the Rust integration again

I'll add this to the documentation soon, but for now there doesn't seem to be a general solution to this short of creating a new template.

tommy306 commented 10 months ago

Thanks very much. It's worked after followed the steps above.

However, ffigen: ^9.0.1 is required to make it work. Do you know why?

Desdaemon commented 10 months ago

However, ffigen: ^9.0.1 is required to make it work. Do you know why?

I didn't notice this, could be a constraint from flutter_rust_bridge and/or bitsdojo.

tommy306 commented 10 months ago

I upgraded the flutter_rust_bridge version to 1.82.4, and there is a constraint in the the frb_codegen/src/commands.rs file. so the flutter_rust_bridge_codegen command is failing. However, this constraint is not present in version 1.45.0.

The constraint code:

lazy_static! {
    pub(crate) static ref FFI_REQUIREMENT: VersionReq =
        VersionReq::parse(">= 2.0.1, < 3.0.0").unwrap();
    pub(crate) static ref FFIGEN_REQUIREMENT: VersionReq =
        VersionReq::parse(">= 8.0.0, < 10.0.0").unwrap();
}
github-actions[bot] commented 9 months ago

This issue has been marked as stale because it has no activity recently. Please remove the 'stale' label, or comment if the issue persists.

github-actions[bot] commented 9 months ago

This issue has been closed after a period of inactivity. Please reopen this issue if the problem persists, or open a new one if you have a similar problem.