Closed tGrothmannFluffy closed 6 months ago
Hi, without more information, it seems that this is unrelated to flutter_rust_bridge, but something related to cpal, since flutter_rust_bridge does nothing special about audio. But if cpal finds no problem, feel free to ping here!
To investigate this issue I started a clean project with flutter_rust_bridge create
. There seems to have been quite a lot of changes so maybe that'll fix it, and I wanted to isolate the problem.
Here's the project: https://github.com/tGrothmannFluffy/flutter_rust_test_ios_mic
Unfortunately, I cannot get it to run, because of flutter not finding the rust library. This reminds me of https://github.com/fzyzcjy/flutter_rust_bridge/issues/1058
Unfortunately, I cannot get it to run, because of flutter not finding the rust library.
It would be great to show the errors, then I can have a look at it :)
At first I got:
ld: Undefined symbols:
_AudioComponentFindNext, referenced from:
coreaudio::audio_unit::AudioUnit::new_with_flags::hf4630a21d4507d5a in librust_lib_ios_mic.a[x86_64][193](cpal-d9d78020be790fe8.cpal.3c4241f9eb44d5fe-cgu.1.rcgu.o)
_AudioComponentInstanceDispose, referenced from:
_$LT$coreaudio..audio_unit..AudioUnit$u20$as$u20$core..ops..drop..Drop$GT$::drop::hca9ac08a097ea638 in librust_lib_ios_mic.a[x86_64][207](coreaudio-6f99948436ab866b.coreaudio.a083936386d5d26e-cgu.0.rcgu.o)
_AudioComponentInstanceNew, referenced from:
coreaudio::audio_unit::AudioUnit::new_with_flags::hf4630a21d4507d5a in librust_lib_ios_mic.a[x86_64][193](cpal-d9d78020be790fe8.cpal.3c4241f9eb44d5fe-cgu.1.rcgu.o)
_AudioOutputUnitStart, referenced from:
coreaudio::audio_unit::AudioUnit::start::ha3f6f577c1e2c9e2 in librust_lib_ios_mic.a[x86_64][207](coreaudio-6f99948436ab866b.coreaudio.a083936386d5d26e-cgu.0.rcgu.o)
_AudioOutputUnitStop, referenced from:
coreaudio::audio_unit::AudioUnit::stop::h1ffe47b7eca246c4 in librust_lib_ios_mic.a[x86_64][207](coreaudio-6f99948436ab866b.coreaudio.a083936386d5d26e-cgu.0.rcgu.o)
_AudioUnitGetProperty, referenced from:
coreaudio::audio_unit::get_property::h2798000ba6c9efac in librust_lib_ios_mic.a[x86_64][207](coreaudio-6f99948436ab866b.coreaudio.a083936386d5d26e-cgu.0.rcgu.o)
coreaudio::audio_unit::get_property::hb3df5bf4d6c13bc6 in librust_lib_ios_mic.a[x86_64][207](coreaudio-6f99948436ab866b.coreaudio.a083936386d5d26e-cgu.0.rcgu.o)
_AudioUnitInitialize, referenced from:
coreaudio::audio_unit::AudioUnit::new_with_flags::hf4630a21d4507d5a in librust_lib_ios_mic.a[x86_64][193](cpal-d9d78020be790fe8.cpal.3c4241f9eb44d5fe-cgu.1.rcgu.o)
coreaudio::audio_unit::AudioUnit::initialize::h5dfce5fca15af1cb in librust_lib_ios_mic.a[x86_64][207](coreaudio-6f99948436ab866b.coreaudio.a083936386d5d26e-cgu.0.rcgu.o)
_AudioUnitSetProperty, referenced from:
coreaudio::audio_unit::set_property::heb86782b96e8de98 in librust_lib_ios_mic.a[x86_64][193](cpal-d9d78020be790fe8.cpal.3c4241f9eb44d5fe-cgu.1.rcgu.o)
coreaudio::audio_unit::set_property::h06cbfefb4adac733 in librust_lib_ios_mic.a[x86_64][207](coreaudio-6f99948436ab866b.coreaudio.a083936386d5d26e-cgu.0.rcgu.o)
coreaudio::audio_unit::set_property::h5d287565dc79a5e7 in librust_lib_ios_mic.a[x86_64][207](coreaudio-6f99948436ab866b.coreaudio.a083936386d5d26e-cgu.0.rcgu.o)
_AudioUnitUninitialize, referenced from:
coreaudio::audio_unit::AudioUnit::uninitialize::h6d92c7b18989dec5 in librust_lib_ios_mic.a[x86_64][207](coreaudio-6f99948436ab866b.coreaudio.a083936386d5d26e-cgu.0.rcgu.o)
_$LT$coreaudio..audio_unit..AudioUnit$u20$as$u20$core..ops..drop..Drop$GT$::drop::hca9ac08a097ea638 in librust_lib_ios_mic.a[x86_64][207](coreaudio-6f99948436ab866b.coreaudio.a083936386d5d26e-cgu.0.rcgu.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
AudioToolbox
to the frameworks in thee runner xcode project.let session = AVAudioSession.sharedInstance
into AppDelegate.swift
After that the build succeeds, but I get this runtime error:
ArgumentError (Invalid argument(s): Failed to load dynamic library 'rust_lib_ios_mic.framework/rust_lib_ios_mic':
dlopen(rust_lib_ios_mic.framework/rust_lib_ios_mic, 0x0001):
tried: '/Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRootrust_lib_ios_mic.framework/rust_lib_ios_mic' (no such file),
'/Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/rust_lib_ios_mic.framework/rust_lib_ios_mic' (no such file),
'/usr/lib/swift/rust_lib_ios_mic.framework/rust_lib_ios_mic' (no such file, no dyld cache),
'/Users/fluffy/Library/Developer/CoreSimulator/Devices/A75E74E2-9876-48FB-9388-477EA4C0B6E4/data/Containers/Bundle/Application/157F1C2C-CB4E-42C9-88DB-FD309E41AA44/Runner.app/Frameworks/rust_lib_ios_mic.framework/rust_lib_ios_mic' (no such file),
'/Users/fluffy/Library/Developer/CoreSimulator/Devices/A75E74E2-9876-48FB-9388-477EA4C0B6E4/data/Containers/Bundle/Application/157F1C2C-CB4E-42C9-88DB-FD309E41AA44/Runner.app/Frameworks/rust_lib_ios_mic.framework/rust_lib_ios_mic' (no such file),
'/usr/lib/rust_lib_ios_mic.framework/rust_lib_ios_mic' (no such file, no dyld cache), 'rust_lib_ios_mic.framework/rust_lib_ios_mic' (no such file),
'/Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/rust_lib_ios_mic.framework/rust_lib_ios_mic' (no such file))
Hmm, looks like maybe something related to Cargokit. Maybe debug by, e.g.: Check the generated app - does it have that framewok? does that framework have that library file?
The issue seems to be closed by adding some code into AppDelegate. This is necessary since iOS 17. https://github.com/RustAudio/cpal/issues/842#issuecomment-1966408740
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.
Describe the bug
Hi there,
I am having this issue with cpal on iOS and I'm not sure where the problem is.
Steps to reproduce
using cpal run on iOS (simulator/device, debug/release)
Logs
The microphone is discoverable using dart, though.
Version of
clang++
15
Additional context
No response