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.26k stars 297 forks source link

Error[E0433]: failed to resolve: could not find `coreaudio` in `host` #2230

Closed Larpoux closed 1 month ago

Larpoux commented 2 months ago

Describe the bug

I try to build a dart interface to the cpal library When I try to compile my very simple app I get the following error, both on iOS and Android :

SEVERE:    Compiling tau_cpal v0.1.0 (/Volumes/mac-J/larpoux/projmac/tau-cpal/tau-cpal/rust)
SEVERE: error[E0433]: failed to resolve: could not find `coreaudio` in `host`
SEVERE:   --> src/frb_generated.rs:29:17
SEVERE:    |
SEVERE: 29 | use cpal::host::coreaudio::macos::enumerate::*;
SEVERE:    |                 ^^^^^^^^^ could not find `coreaudio` in `host`
SEVERE:    |
SEVERE: note: found an item that was configured out
SEVERE:   --> /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cpal-0.15.3/src/host/mod.rs:11:16
SEVERE:    |
SEVERE: 11 | pub(crate) mod coreaudio;
SEVERE:    |                ^^^^^^^^^
SEVERE: 

Steps to reproduce

Here is the cpal sources :

Screenshot 2024-08-06 at 19 00 39

Logs

`Cpal` is a layer under `web-audio-api-rs`.
I need to be able to access this layer, bypassing `web-audio-api-rs`

Expected behavior

No response

Generated binding code

No response

OS

No response

Version of flutter_rust_bridge_codegen

No response

Flutter info

No response

Version of clang++

No response

Additional context

No response

fzyzcjy commented 2 months ago

Hmm, looks like that mod is conditionally compiled -> https://github.com/RustAudio/cpal/blob/0da7ae1d426d471cf352550d0048bac91c8bac38/src/host/mod.rs#L10-L11, and we currently do not support such conditional compilation yet.

fzyzcjy commented 1 month ago

Close since inactivity, but feel free to reopen if you have any questions!

fzyzcjy commented 1 month ago

@Larpoux Hi my friend, btw how is everything going on?

Larpoux commented 1 month ago

Hi @fzyzcjy , Actually I am very busy working on Flutter Sound maintenance. Also I’m investigating if I can use lab_sound_flutter. This is pure c++ and much easier for me to work on because I master c++. But I haven’t give up with web-audio-api-rs . I just realize now that I can’t hope working on a rust project without learning first the language. I will do this.

‘Also, it is necessary to write a wrapper with dart, and can’t offer directly access to the rust or c++ library. This wrapper will have an api 100% compatible with the api offered by Google for web app. Perhaps it is possible to have a wrapper common for web-audio-api-rs and lab-audio.

Note : Flutter Rust bridge is much more powerful than the generator for C. The C generator is just C, not C++, so necessary to write an other interface in c.

All this to tell you that I have much work to do, and nothing will be published before next year. I really need to learn rust.

fzyzcjy commented 1 month ago

I see. No worries and take your time!

Btw, I wonder what is missing for a 100% web-audio-api up to now - I guess there is https://github.com/fzyzcjy/flutter_rust_bridge/issues/2193; is there anything else? (I can keep them on my list, s.t. for example later maybe I can have a check on them)

P.S. About learning rust: Besides the rust books and exercises, the Rust community is very good (https://users.rust-lang.org/). When I have Rust questions, often someone there reply quickly. So I guess asking there when learning Rust if having a question may also be helpful.

github-actions[bot] commented 1 month ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.