fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.
https://fzyzcjy.github.io/flutter_rust_bridge/
MIT License
4.16k stars 288 forks source link

Run Dart build_runner never finishes running (internal loop?) #2097

Closed Larpoux closed 3 months ago

Larpoux commented 3 months ago

Describe the bug

when I code this :

use flutter_rust_bridge::frb;
use web_audio_api::node::AudioNode as XAudioNode;
pub trait AudioNode
{
        #[frb(sync)]
        fn get_x_node(&self) -> &dyn web_audio_api::node::AudioNode ;

        #[frb(sync)]
        fn connect(&self, dest:&dyn AudioNode) ->&dyn AudioNode
        {
                let toto = self.get_x_node();
                let titi = dest.get_x_node();
                toto.connect(titi);
                dest
        }
}

FRB enters an infinite internal loop (never finishes).

toto.log

Steps to reproduce

-

Logs

See attachment

Expected behavior

No response

Generated binding code

-

OS

No response

Version of flutter_rust_bridge_codegen

flutter_rust_bridge_codegen 2.0.0-dev.40

Flutter info

No response

Version of clang++

No response

Additional context

No response

fzyzcjy commented 3 months ago

Hmm that's weird. Some brainstorms:

Maybe an improvement is to stream the output of build_runner to the console, then we can see more information (e.g. whether it stucks or is outputing information saying some failure etc)

fzyzcjy commented 3 months ago

Oh I realize another thing (though seems unrelated to build_runner): Currently https://cjycode.com/flutter_rust_bridge/guides/lifetimes/overview is experimental and needs to use a flag to be enabled. (I think web-audio-api mostly does not need this but will double check.) Otherwise, its return type is translated to void.

Related: https://github.com/fzyzcjy/flutter_rust_bridge/issues/2083

Larpoux commented 3 months ago

I closed most of my other tasks (IDE, ...) because sometimes I am low on memory.

larpoux@Mac-mini:~/projmac/tau$ RUST_LOG=debug flutter_rust_bridge_codegen generate >/tmp/toto.log
[1.3s] Parse  
  └── [1.3s] Cargo expand & syn parse  
  └── [0.0s] Parse HIR  
  └── [0.0s] Parse MIR  
[0.0s] Generate  
[526.7s] Polish ⠈
  └── [526.7s] Run Dart build_runner 

Actually I don't try to generate the web-audio-api-rs lib. I just generate a very simple wrapper with less than 10 functions.

toto.log

fzyzcjy commented 3 months ago

Ok then it looks like it is just stucked. Even frb_example/pure_dart which has several thousand tests do not need this long.

Then may try

  1. flutter_rust_bridge_codegen generate --no-build-runner (skip build runner and get other outputs ready)
  2. flutter pub run build_runner build --delete-conflicting-outputs --enable-experiment=class-modifiers and see whether it stucks
Larpoux commented 3 months ago

false alarm : I cleaned up several dummy rust files in my directory and now it generates OK. Sorry, this was probably my fault..

fzyzcjy commented 3 months ago

It's OK!

Larpoux commented 3 months ago

The stuck problem is related to this fn :

        #[frb(sync)]
        fn connect(&self, dest:&dyn AudioNode) ->&dyn AudioNode
        {
                dest.clone()
        }

But my Rust knowledge is very poor.

        #[frb(sync)]
        fn connect(&self, dest:&impl AudioNode) ->&impl AudioNode
        {
                dest.clone()
        }

is better (no stuck). But I get this dart :

import '../../frb_generated.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';

// These functions have error during generation (see debug logs or enable `stop_on_error: true` for more details): `connect`, `connect`

abstract class AudioNode {
  void getXNode();
}

Where must I set this boolean : stop_on_error: true ?

fzyzcjy commented 3 months ago

Where must I set this boolean : stop_on_error: true ?

On flutter_rust_bridge.yaml

impl AudioNode

IIRC this is not supported yet (that may be why it errors?). Only &dyn is supported.

Larpoux commented 3 months ago

IT WORKS !!!! 👍 💯 👍 👍

Thank you!


larpoux@Mac-mini:~/projmac/tau$ flutter pub run build_runner build --delete-conflicting-outputs --enable-experiment=class-modifiers
Deprecated. Use `dart run` instead.
Building package executable... (1.7s)
Built build_runner:build_runner.
[INFO] Generating build script completed, took 616ms
[WARNING] Invalidated precompiled build script due to missing asset graph.
[INFO] Precompiling build script... completed, took 1.0s
[INFO] Building new asset graph completed, took 27.1s
[INFO] Checking for unexpected pre-existing outputs. completed, took 0ms
[INFO] Running build completed, took 3m 59s
[WARNING] No actions completed for 15.0s, waiting on:

[INFO] Caching finalized dependency graph completed, took 15.2s
[INFO] Succeeded after 4m 14s with 79 outputs (23560 actions)
larpoux@Mac-mini:~/projmac/tau$ 
fzyzcjy commented 3 months ago

You are welcome and happy to see it works!

Larpoux commented 3 months ago

The stuck problem is solved with build_runner: false. This problem is probably because my flutter project is a plugin and not an app. Probably a note in the documentation is enough

Larpoux commented 3 months ago

I am trying to run frb on the real web-audio-api-rs (writing my own wrapper was not doable for me)

When I compile my dart, I have problems :

When I remove those two lines :

Error (Xcode): ../lib/src/rust/frb_generated.dart:26895:40: Error: Type '_$AudioNodeImplementor' not found.

Could not build the application for the simulator.
Error launching application on iPhone 15.

Is this because I do not run build_runner ?

UPDATE:

larpoux@Mac-mini:~/projmac/tau$ flutter pub run build_runner build --delete-conflicting-outputs --enable-experiment=class-modifiers
Deprecated. Use `dart run` instead.
Building package executable... 
Built build_runner:build_runner.
[INFO] Generating build script completed, took 164ms
[INFO] Reading cached asset graph completed, took 6.1s
[INFO] Checking for updates since last build...

This is where the generation stuck .

fzyzcjy commented 3 months ago

This problem is probably because my flutter project is a plugin and not an app.

Hmm that should not have difference - we should support it imho.

Is this because I do not run build_runner ?

Yes, .freezed.dart and .g.dart is generated by build_runner.

This is where the generation stuck .

Hmm, what if trying

Larpoux commented 3 months ago

This morning, no stuck anymore. I am able to run build_runner without problem. This is better, even if I don't understand why yesterday it stucked. 👀

Yes, .freezed.dart and .g.dart is generated by build_runner.

This is where the generation stuck .

The files are still not there. When I remove the two instructions part 'XXXX.freezed.dart I have still this error during flutter compilation:

Failed to build iOS app
Error (Xcode): ../lib/src/rust/frb_generated.dart:26895:40: Error: Type '_$AudioNodeImplementor' not found.

Could not build the application for the simulator.
Error launching application on iPhone 15.
fzyzcjy commented 3 months ago

Hmm, could you please provide the code that errors (https://github.com/Canardoux/tau or another place?), then I can try to run it locally to see what is going on.

Larpoux commented 3 months ago

https://github.com/Canardoux/tau

Larpoux commented 3 months ago

Sorry, there is a problem with github. Please wait a little bit

fzyzcjy commented 3 months ago

Take your time!

Larpoux commented 3 months ago

OK now : https://github.com/Canardoux/tau

fzyzcjy commented 3 months ago

Hmm it runs well in my machine:

image

But maybe this is related:

When I firstly run flutter pub get, it complains freezed 2.5.3 it too high, thus I lower it to 2.5.2. In other words, modify pubspec.yaml from freezed: ^2.5.3 to freezed: ^2.5.2


EDIT: Oops I forget to check the generated .freezed.dart, wait a minute.

EDIT 2: I modified flutter_rust_bridge.yaml to remove build_runner: false, then run codegen again.

image

It seems that the freezed files are there:

image

Larpoux commented 3 months ago

This is weird those two files are note generated on my machine 🙄

Larpoux commented 3 months ago

There is something bad on my environment machine : the Run Dart build_runner stucks again when I remove build_runner: false

Larpoux commented 3 months ago

It stucks, and I cannot interrupt with Control-C :

larpoux@Mac-mini:~/projmac/tau$ dart run  build_runner build --delete-conflicting-outputs --enable-experiment=class-modifiers --verbose
Building package executable... 
Built build_runner:build_runner.
[INFO] Entrypoint:Generating build script...
[INFO] Entrypoint:Generating build script completed, took 253ms

[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Reading cached asset graph...
[INFO] BuildDefinition:Reading cached asset graph completed, took 9.6s

[INFO] BuildDefinition:Checking for updates since last build...
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
Larpoux commented 3 months ago

And when I run frb generate without doing build_runner I get very few files :

Screenshot 2024-06-18 at 15 45 06
Larpoux commented 3 months ago
Screenshot 2024-06-18 at 16 58 33
fzyzcjy commented 3 months ago

Hmm, if a standalone dart run build_runner build --delete-conflicting-outputs --enable-experiment=class-modifiers --verbose stucks, then maybe we can create an issue in Dart/Flutter. Since that is a normal and commonly used Dart command!

Larpoux commented 3 months ago

Forget the problem of stuck: I can run the generation under your project: flutter_rust_bridge/frb_example/integrate_third_party. No stuck with your project. I will try to understand later why it stucks some time in my project . But as I told you, the main problem is that the files generated cannot be compiled by dart. Even with your example.

part 'context.freezed.dart';

but the file does not exist. in frb_generated.dart :

part 'frb_generated.freezed.dart';

But the file doesn’t exist

fzyzcjy commented 3 months ago

That .freezed.dart is generated by build_runner (which calls Dart package freezed). So if it is not generated (that's a problem!), then things will not compile.

Larpoux commented 3 months ago

When I use your example, after a git clone without any modification, the files are not generated. But the files are there before running flutter_rust_bridge generate

fzyzcjy commented 3 months ago

Hmm, then maybe delete many files and see whether they are re-generated. If not, then this looks like a problem.

Again, as suggested above, if running a standard dart run build_runner build command on a standard Flutter/Dart project results in files not generated or stuck or something like that, then maybe we need to ask on Flutter repo / freezed package repo.

Larpoux commented 3 months ago
larpoux@Mac-mini:~/projmac$ git clone https://github.com/fzyzcjy/flutter_rust_bridge.git
Cloning into 'flutter_rust_bridge'...
remote: Enumerating objects: 285706, done.
remote: Counting objects: 100% (32877/32877), done.
remote: Compressing objects: 100% (7686/7686), done.
remote: Total 285706 (delta 24485), reused 32304 (delta 24310), pack-reused 252829
Receiving objects: 100% (285706/285706), 243.41 MiB | 28.92 MiB/s, done.
Resolving deltas: 100% (217015/217015), done.
larpoux@Mac-mini:~/projmac$ cd flutter_rust_bridge/frb_example/
larpoux@Mac-mini:~/projmac/flutter_rust_bridge/frb_example$ cd integrate_third_party/
larpoux@Mac-mini:~/projmac/flutter_rust_bridge/frb_example/integrate_third_party$ ls -l lib/src/rust
total 6264
drwxr-xr-x  8 larpoux  staff      256 Jun 19 10:47 .
drwxr-xr-x  3 larpoux  staff       96 Jun 19 10:47 ..
drwxr-xr-x  5 larpoux  staff      160 Jun 19 10:47 api
-rw-r--r--  1 larpoux  staff  1528438 Jun 19 10:47 frb_generated.dart
-rw-r--r--  1 larpoux  staff  1261698 Jun 19 10:47 frb_generated.freezed.dart
-rw-r--r--  1 larpoux  staff   226541 Jun 19 10:47 frb_generated.io.dart
-rw-r--r--  1 larpoux  staff   179909 Jun 19 10:47 frb_generated.web.dart
drwxr-xr-x  4 larpoux  staff      128 Jun 19 10:47 third_party
larpoux@Mac-mini:~/projmac/flutter_rust_bridge/frb_example/integrate_third_party$ vi flutter_rust_bridge.yaml 
larpoux@Mac-mini:~/projmac/flutter_rust_bridge/frb_example/integrate_third_party$ flutter_rust_bridge_codegen generate
[2024-06-19T08:58:09.448Z WARN /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.40/src/library/codegen/parser/hir/flat/transformer/merge_duplicate_transformer/mod.rs:72] There are still multiple objects with same key after merging, thus randomly pick one (key=("AudioParamValues < 'a >", "get"), objects={"namespace":"web_audio_api::render::processor","owner":{"StructOrEnum":{"impl_ty":"AudioParamValues < 'a >","trait_def_name":null}},"sources":["Normal"],"item_fn":"GeneralizedItemFn(name=get, vis=Some(Visibility::Public(Pub)), attrs=[# [doc = \" Get the computed values for the given [`crate::param::AudioParam`]\"], # [doc = \"\"], # [doc = \" For k-rate params or if the (a-rate) parameter is constant for this block, it will provide\"], # [doc = \" a slice of length 1. In other cases, i.e. a-rate param with scheduled automations it will\"], # [doc = \" provide a slice of length equal to the render quantum size (default: 128)\"], # [allow (clippy :: missing_panics_doc)]])"}, {"namespace":"web_audio_api::worklet","owner":{"StructOrEnum":{"impl_ty":"AudioParamValues < 'a >","trait_def_name":null}},"sources":["Normal"],"item_fn":"GeneralizedItemFn(name=get, vis=Some(Visibility::Public(Pub)), attrs=[# [doc = \" Get the computed values for the given [`AudioParam`]\"], # [doc = \"\"], # [doc = \" For k-rate params or if the (a-rate) parameter is constant for this block, it will provide\"], # [doc = \" a slice of length 1. In other cases, i.e. a-rate param with scheduled automations it will\"], # [doc = \" provide a slice of length equal to the render quantum size (default: 128)\"], # [allow (clippy :: missing_panics_doc)]])"})
[2024-06-19T08:58:09.468Z INFO /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.40/src/library/codegen/parser/mir/parser/ty/lifetimeable.rs:51] To handle some types, `enable_lifetime: true` may need to be set. Please visit https://fzyzcjy.github.io/flutter_rust_bridge/guides/lifetimes for more details
[2024-06-19T08:58:09.529Z WARN /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.40/src/library/codegen/parser/mir/sanity_checker/auto_accessor_checker.rs:21] To use the automatically generated getters of the following fields of opaque types, it is suggested to read https://fzyzcjy.github.io/flutter_rust_bridge/guides/types/arbitrary/rust-auto-opaque/properties to know more details. (Related fields: web_audio_api::media_recorder::BlobEvent.blob, web_audio_api::media_recorder::BlobEvent.blob, web_audio_api::media_recorder::BlobEvent.event, web_audio_api::media_recorder::BlobEvent.event, web_audio_api::OfflineAudioCompletionEvent.rendered_buffer, web_audio_api::OfflineAudioCompletionEvent.rendered_buffer, web_audio_api::OfflineAudioCompletionEvent.event, web_audio_api::OfflineAudioCompletionEvent.event, web_audio_api::AudioProcessingEvent.input_buffer, web_audio_api::AudioProcessingEvent.input_buffer, web_audio_api::AudioProcessingEvent.output_buffer, web_audio_api::AudioProcessingEvent.output_buffer, web_audio_api::AudioRenderCapacityEvent.event, web_audio_api::AudioRenderCapacityEvent.event)
[2024-06-19T08:58:09.645Z INFO /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.40/src/library/codegen/parser/mir/parser/ty/lifetimeable.rs:51] To handle some types, `enable_lifetime: true` may need to be set. Please visit https://fzyzcjy.github.io/flutter_rust_bridge/guides/lifetimes for more details
[2024-06-19T08:58:09.705Z WARN /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.40/src/library/codegen/parser/mir/sanity_checker/auto_accessor_checker.rs:21] To use the automatically generated getters of the following fields of opaque types, it is suggested to read https://fzyzcjy.github.io/flutter_rust_bridge/guides/types/arbitrary/rust-auto-opaque/properties to know more details. (Related fields: web_audio_api::AudioProcessingEvent.input_buffer, web_audio_api::AudioProcessingEvent.input_buffer, web_audio_api::AudioProcessingEvent.output_buffer, web_audio_api::AudioProcessingEvent.output_buffer, web_audio_api::media_recorder::BlobEvent.blob, web_audio_api::media_recorder::BlobEvent.blob, web_audio_api::media_recorder::BlobEvent.event, web_audio_api::media_recorder::BlobEvent.event, web_audio_api::OfflineAudioCompletionEvent.rendered_buffer, web_audio_api::OfflineAudioCompletionEvent.rendered_buffer, web_audio_api::OfflineAudioCompletionEvent.event, web_audio_api::OfflineAudioCompletionEvent.event, web_audio_api::AudioRenderCapacityEvent.event, web_audio_api::AudioRenderCapacityEvent.event)
[2024-06-19T08:58:14.103Z WARN /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.40/src/library/commands/command_runner.rs:153] command=cd "/Volumes/mac-J/larpoux/projmac/flutter_rust_bridge/frb_example/integrate_third_party" && FRB_SIMPLE_BUILD_SKIP="1" "sh" "-c" "\"flutter\" \"pub\" \"run\" \"build_runner\" \"build\" \"--delete-conflicting-outputs\" \"--enable-experiment=class-modifiers\"" stdout= stderr=Cannot open file, path = '.dart_tool/package_config.json' (OS Error: No such file or directory, errno = 2)

[2024-06-19T08:58:14.103Z WARN /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.40/src/library/codegen/polisher/mod.rs:89] Fail to execute_build_runner, but continue to run.
Error details: Err(Failed to run build_runner for "/Volumes/mac-J/larpoux/projmac/flutter_rust_bridge/frb_example/integrate_third_party": )
[2.6s] Parse  
  └── [2.1s] Cargo expand & syn parse  
  └── [0.3s] Parse HIR  
  └── [0.2s] Parse MIR  
[3.9s] Generate  
[1.8s] Polish  
  └── [0.4s] Run Dart build_runner  
  └── [1.0s] Run Dart formatter  
  └── [0.4s] Run Rust formatter                                                                                                                                                                                                                                                              Done!
larpoux@Mac-mini:~/projmac/flutter_rust_bridge/frb_example/integrate_third_party$ ls -l lib/src/rust
total 3792
drwxr-xr-x  7 larpoux  staff      224 Jun 19 10:51 .
drwxr-xr-x  3 larpoux  staff       96 Jun 19 10:47 ..
drwxr-xr-x  5 larpoux  staff      160 Jun 19 10:47 api
-rw-r--r--  1 larpoux  staff  1528187 Jun 19 10:58 frb_generated.dart
-rw-r--r--  1 larpoux  staff   226292 Jun 19 10:58 frb_generated.io.dart
-rw-r--r--  1 larpoux  staff   179660 Jun 19 10:58 frb_generated.web.dart
drwxr-xr-x  4 larpoux  staff      128 Jun 19 10:51 third_party
larpoux@Mac-mini:~/projmac/flutter_rust_bridge/frb_example/integrate_third_party$ ls -l lib/src/rust/third_party/web_audio_api
total 248
drwxr-xr-x  8 larpoux  staff    256 Jun 19 10:51 .
drwxr-xr-x  4 larpoux  staff    128 Jun 19 10:51 ..
-rw-r--r--  1 larpoux  staff  32059 Jun 19 10:58 context.dart
-rw-r--r--  1 larpoux  staff   2540 Jun 19 10:58 media_devices.dart
-rw-r--r--  1 larpoux  staff   1756 Jun 19 10:58 media_recorder.dart
-rw-r--r--  1 larpoux  staff   1811 Jun 19 10:58 media_streams.dart
-rw-r--r--  1 larpoux  staff  73785 Jun 19 10:58 node.dart
-rw-r--r--  1 larpoux  staff   3224 Jun 19 10:58 worklet.dart
larpoux@Mac-mini:~/projmac/flutter_rust_bridge/frb_example/integrate_third_party$ 
fzyzcjy commented 3 months ago
Error details: Err(Failed to run build_runner for "/Volumes/mac-J/larpoux/projmac/flutter_rust_bridge/frb_example/integrate_third_party": )

Hmm there is an error!

Larpoux commented 3 months ago
[2024-06-19T08:58:14.103Z WARN /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.40/src/library/codegen/polisher/mod.rs:89] Fail to execute_build_runner, but continue to run.
Error details: Err(Failed to run build_runner for "/Volumes/mac-J/larpoux/projmac/flutter_rust_bridge/frb_example/integrate_third_party": )

This is perhaps the reason

fzyzcjy commented 3 months ago

Yes I think so. Try to run RUST_LOG=debug flutter_rust_bridge_codegen generate and look at the sections related to build_runner

Larpoux commented 3 months ago
larpoux@Mac-mini:~/projmac/flutter_rust_bridge/frb_example/integrate_third_party$ RUST_LOG=debug flutter_rust_bridge_codegen generate >/tmp/frb.log
[2.5s] Parse  
  └── [1.9s] Cargo expand & syn parse  
  └── [0.4s] Parse HIR  
  └── [0.2s] Parse MIR  
[3.9s] Generate  
[1.8s] Polish  
  └── [0.4s] Run Dart build_runner  
  └── [1.0s] Run Dart formatter  
  └── [0.4s] Run Rust formatter                                                                                                                                                                                                                                                              larpoux@Mac-mini:~/projmac/flutter_rust_bridge/frb_example/integrate_third_party$ 

frb.log

fzyzcjy commented 3 months ago
[2024-06-19T09:05:36.947Z WARN /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.40/src/library/commands/command_runner.rs:153] command=cd "/Volumes/mac-J/larpoux/projmac/flutter_rust_bridge/frb_example/integrate_third_party" && FRB_SIMPLE_BUILD_SKIP="1" "sh" "-c" "\"flutter\" \"pub\" \"run\" \"build_runner\" \"build\" \"--delete-conflicting-outputs\" \"--enable-experiment=class-modifiers\"" stdout= stderr=Cannot open file, path = '.dart_tool/package_config.json' (OS Error: No such file or directory, errno = 2)

Looks like you need a dart pub get or flutter pub get

(Hmm it was also on the last log, I should have seen it...)

Larpoux commented 3 months ago

YEAH! It's much better. Now I am going to try to compile the dart stuff and I will let you know how everything is going. Thank you.

fzyzcjy commented 3 months ago

You are welcome!

Larpoux commented 3 months ago

Enclosed files

What do I do wrongly ?

simple.rs.txt simple.dart.txt simple.dart.txt

fzyzcjy commented 3 months ago

Hi, could you please provide a minimal reproducible sample (probably as a github repo)? Then I can download and have a check.

Larpoux commented 3 months ago

This repo : this is just a fork from your own repo, and I replaced simple.rs by mine. (frb_example/integrate_third_party).

fzyzcjy commented 3 months ago

Get it, will check later!

Larpoux commented 3 months ago

@fzyzcjy : forget this issue : it was my fault. I forgot to add some dependencies in Cargo.toml. Everything OK now. I am going to let you know how things are going ...

Larpoux commented 3 months ago

I have a dart compilation error :

Launching lib/main.dart on iPhone 15 in debug mode...
Running Xcode build...
Xcode build done.                                           13.7s
Failed to build iOS app
Error (Xcode): ../lib/src/rust/third_party/web_audio_api/media_recorder.dart:41:54: Error: Type 'MediaStream' not found.

Could not build the application for the simulator.
Error launching application on iPhone 15.

Just for your info : I just add the missing import by hand, myself.

fzyzcjy commented 3 months ago

No worries, happy to see it is solved!

I just add the missing import by hand, myself.

Hmm that looks like a bug. Do you mean everything is correctly generated, except that one import is missing?

Larpoux commented 3 months ago

could someone (@fzyzcjy ?) tell me briefly where is the code building the .dylib for iOS ?

Update : I thing I found : rust_builder/cargokit

fzyzcjy commented 3 months ago

where is the code building the .dylib for iOS ?

It is using Cargokit under the hood (rust_builder folder indeed), so I guess just check their docs.

However, if you are going to publish it as a package instead of an app, https://cjycode.com/flutter_rust_bridge/manual/integrate/cargokit (e.g. example package https://github.com/fzyzcjy/flutter_rust_bridge/tree/master/frb_example/flutter_package) will be helpful.

Larpoux commented 3 months ago

Thank you for the links

fzyzcjy commented 3 months ago

You are welcome!

Larpoux commented 3 months ago

Y E H ! ! ! I am able to play a resource asset (RAW PCM) with rust-audio-api-rs called directly by a dart function, using FRB. I am happy. This is a great day. This is for me an important milestone. Now I am going to add a gain node and a panner node. I will let you know the result.

BTW: I had many various problems. One of those problems was with the .dart_tool directory. I have never been very interested by this directory. I don't save it in git and I very often delete this directory when I get problems during compilation. But FRB seems to really need this directory.