Open BrutalCoding opened 2 months ago
I will work on this issue and post an update tomorrow. I will also see if I can find and fix the issue in sherpa-onnx itself, if so, I'll open a PR of course.
Thank you!
Quick update, I've written a script that fixes this issue. Script expects 1 argument that points to the file path of the affected .xcarchive and fixes it.
I haven't had time to look into the sherpa-onnx source itself, but I'm pretty confident that I can solve this here too.
If I can't find and fix the issue in sherpa-onnx itself in the upcoming days, I'll share my script. That way, we can fix it together in sherpa-onnx.
Here's the new .xcarchive content, showing that sherpa-onnx is now a good .framework instead of being absent (none listed). This is a screenshot of mine taken from one of the confirmation dialogs in Xcode > Organizer (Archives) > Distribute App (blue button):
Update: I discovered an issue regarding missing symbols during runtime when I tested my test app from TestFlight. I'll post here once I've figured it out.
Just adding this note for reference, it's related to the issue I am facing (the error message) and the observation I made (the .dylib in the Frameworks folder): https://developer.apple.com/library/archive/technotes/tn2435/_index.html#//apple_ref/doc/uid/DTS40017543-CH1-TROUBLESHOOTING_BUNDLE_ERRORS-EMBEDDED__DYLIB_FILES
Here are some more links with valuable info:
This issue is related to the same type of issue we're facing. Link: https://github.com/flutter/flutter/issues/140544#issuecomment-1874703095
I personally faced this issue earlier too during the development of my Flutter plugin, and solved it too. Yet, I can't fully grasp the issue right now. Link: https://github.com/BrutalCoding/aub.ai/blob/b16f7e5f9d317d83b38a5814afb1556c8de8a3d3/brutalcoding_scripts/autoupdate_ios.sh#L66C3-L66C7. I looked and changed things around files such as your sherpa_onnx_ios.podspec, sherpa_onnx.dart (e.g. trying DynamicLibrary.process() instead), and I also looked at your cmake stuff at build-ios-shared.sh/build-ios.sh etc.
I'll need some more time to figure this out.
Okay, 1 hour after I placed this comment and it's fixed. What a pain to work with Apple's confusing dev requirements but here's what I did in short:
I will review my own changes over the next days and will try to keep it to a mimimum.
Update: I discovered an issue regarding missing symbols during runtime when I tested my test app from TestFlight. I'll post here once I've figured it out.
Just adding this note for reference, it's related to the issue I am facing (the error message) and the observation I made (the .dylib in the Frameworks folder): https://developer.apple.com/library/archive/technotes/tn2435/_index.html#//apple_ref/doc/uid/DTS40017543-CH1-TROUBLESHOOTING_BUNDLE_ERRORS-EMBEDDED__DYLIB_FILES
Here are some more links with valuable info:
- This issue is related to the same type of issue we're facing. Link: Native Assets should use Framework instead of dylib on iOS. flutter/flutter#140544 (comment)
- I personally faced this issue earlier too during the development of my Flutter plugin, and solved it too. Yet, I can't fully grasp the issue right now. Link: https://github.com/BrutalCoding/aub.ai/blob/b16f7e5f9d317d83b38a5814afb1556c8de8a3d3/brutalcoding_scripts/autoupdate_ios.sh#L66C3-L66C7. I looked and changed things around files such as your sherpa_onnx_ios.podspec, sherpa_onnx.dart (e.g. trying DynamicLibrary.process() instead), and I also looked at your cmake stuff at build-ios-shared.sh/build-ios.sh etc.
I'll need some more time to figure this out.
Okay, 1 hour after I placed this comment and it's fixed. What a pain to work with Apple's confusing dev requirements but here's what I did in short:
- Run the build-ios-shared.sh script
- Find and copy the libsherpa-onnx-c-api.dylib file.
- Navigate to sherpa-onnx/flutter/sherpa_onnx/sherpa_onnx_ios/ios/. Place the copied .dylib here.
- Still within this ios folder, create a SherpaOnnx.framework folder and add a proper Info.plist inside this new .framework folder.
- Now, use lipo and install_name_tool to convert libsherpa-onnx-c-api.dylib into SherpaOnnx (no file extension). Move this SherpaOnnx binary into the .framework folder.
- Update the podspec file by adding a vendored_frameworks that is referring to this new .framework. Also, remove the existing vendored_libraries line.
- Update the dart file to replace the dynamic library lookup for iOS from DynamicLibrary.open("libsherpa-onnx-c-api.dylib") to DynamicLibrary.process(), this method will be able to find all global symbols that are running along with the app.
I will review my own changes over the next days and will try to keep it to a mimimum.
Hello, I followed your method, but encountered a problem. Can you share detail steps, like screenshots
@BrutalCoding Hello, I found a problem that uploading to testFlight
any update on this? i'm trying to build for iOS and encountering same error. here are some steps i outlined based on the resources in this thread:
bash build-ios-shared.sh
cd build-ios-shared/ios-arm64-simulator/
lipo -create libsherpa-onnx-c-api.dylib -output SherpaOnnx
Heya,
First off, many thanks for working on bringing this package to Dart. I have been working with this package since several months ago in Flutter in my own way and today I tried to check out your official Dart version on pub.dev - it's great!
TTS, STT, VAD (the new v5) are all working perfect on my physical iPhone 12 Pro, so the features are not an issue here.
There is an issue though when deploying an app for App Store because sherpa-onnx bundles the dynamic library
libsherpa-onnx-c-api.dylib
in the root of the Frameworks directory and that gets automatically rejected by Apple when validating an app app for submission. It must be packaged as a framework. Note: This is an issue on at least iOS, as I haven't tried sherpa-onnx (Dart plugin) on macOS yet, but it's likely an issue there too.Misleading error message:
ITMS-90426: Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
(Doesn't help - already on latest version. See below for suspected real cause of error in this case).Here's what I've tried:
Failed submission of Runner.ipa with Transporter.app
flutter build ios
Failed submission of Runner.xcarchive via XCode
Identified issues
The error message is misleading, since I am running the latest Xcode and I have submitted it in all possible ways. This led me to investigate the contents of the Runner.xcarchive to see how sherpa-onnx is shipped with the app, and I found an issue here:
We can not ship an app with a dylib thrown in the root of the Frameworks folder, instead, it must be packaged in it's own contained "framework" (just a folder structure with a couple files for metadata e.g. info.plist).
I'm sorry to not have the specific details at hand, I just wanted to highlight this issue before I'm fixing this. A quick work-around that I will try first is not fixing any source code, but by modifying the contents of the archive and re-attempting to upload the app for submission.
Better way would be to fix this in the source code of course. Some changes are likely required where you build with CMake against the C API, after producing the the shared library (the .dylib) we could add a few more lines to produce a xcframework folder and move the .dylib in there.
If there's anything unclear, ask away.
edit: