fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.

Home Page:https://fzyzcjy.github.io/flutter_rust_bridge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`flutter_rust_bridge_codegen build-web` returns `Error: program not found`

jorgenpt opened this issue · comments

Describe the bug

I cannot easily generate wasm packages on Windows.

Steps to reproduce

On Windows in my project, when I try to run build-web, I get this:

>flutter_rust_bridge_codegen build-web
Error: program not found

If instead I run dart run flutter_rust_bridge build-web --dart-root c:\dev\project_name, it succeeds.

Logs

[2024-02-09T07:38:24.249Z DEBUG C:\Users\jorgenpt\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flutter_rust_bridge_codegen-2.0.0-dev.24\src/main.rs:24] cli=Cli { verbose: false, command: BuildWeb(BuildWebCommandArgs { dart_root: None, dart_coverage: false, args: [] }) }
[2024-02-09T07:38:24.249Z DEBUG C:\Users\jorgenpt\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flutter_rust_bridge_codegen-2.0.0-dev.24\src\library\build_web\mod.rs:23] build dart_root="C:\\dev\\project_name" args=[]
[2024-02-09T07:38:24.250Z DEBUG C:\Users\jorgenpt\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flutter_rust_bridge_codegen-2.0.0-dev.24\src\library\utils\dart_repository\dart_repo.rs:22] Guessing toolchain the runner is run into
Error: program not found

Expected behavior

No response

Generated binding code

No response

OS

Windows

Version of flutter_rust_bridge_codegen

2.0.0-dev.24

Flutter info

[✓] Flutter (Channel stable, 3.16.9, on Microsoft Windows [Version 10.0.22621.3007], locale en-US)
    • Flutter version 3.16.9 on channel stable at C:\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 41456452f2 (2 weeks ago), 2024-01-25 10:06:23 -0800
    • Engine revision f40e976bed
    • Dart version 3.2.6
    • DevTools version 2.28.5

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\jorgenpt\AppData\Local\Android\sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.7.34031.279
    • Windows 10 SDK version 10.0.22621.0

[✓] Android Studio (version 2023.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)

[✓] VS Code (version 1.86.1)
    • VS Code at C:\Users\jorgenpt\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.82.0

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.3007]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 121.0.6167.161
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 121.0.2277.106

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Version of clang++

No response

Additional context

No response

Hi! Thanks for opening your first issue here! 😄

Hmm, could you use RUST_LOG=debug and see the stack trace?

@fzyzcjy The output in the "logs" block was with RUST_LOG=debug set

Oh you are windows, so could you please ensure the env variable RUST_LOG has value debug?

@fzyzcjy Yes, it is set and it produces this when it runs:

C:\dev\project_name>flutter_rust_bridge_codegen build-web
[2024-02-12T08:02:46.230Z DEBUG C:\Users\jorgenpt\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flutter_rust_bridge_codegen-2.0.0-dev.24\src/main.rs:24] cli=Cli { verbose: false, command: BuildWeb(BuildWebCommandArgs { dart_root: None, dart_coverage: false, args: [] }) }
[2024-02-12T08:02:46.231Z DEBUG C:\Users\jorgenpt\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flutter_rust_bridge_codegen-2.0.0-dev.24\src\library\build_web\mod.rs:23] build dart_root="C:\\dev\\project_name" args=[]
[2024-02-12T08:02:46.231Z DEBUG C:\Users\jorgenpt\.cargo\registry\src\index.crates.io-6f17d22bba15001f\flutter_rust_bridge_codegen-2.0.0-dev.24\src\library\utils\dart_repository\dart_repo.rs:22] Guessing toolchain the runner is run into
Error: program not found

Firstly, feel free to execute dart run directly as a workaround.

Secondly, I guess the problem lies in

let handle = Command::new("dart")
. Feel free to PR, alternatively I will fix it in the next batch (hopefully within a week).