Skip to content

Got it working on simulator, issue on real device - what am I missing? #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xonaman opened this issue Aug 2, 2024 · 20 comments
Closed
Labels
question Further information is requested

Comments

@xonaman
Copy link

xonaman commented Aug 2, 2024

Hey!

I am using version 1.2.1 and got everything working on the simulator (iOS).

When building for release and running that on a real device (iOS), I encounter the following issue:

Invalid argument(s): Failed to lookup symbol 'Image_IMRead_Async': dlsym(RTLD_DEFAULT, Image_IMRead_Async): symbol not found

I have looked into #144 and can confirm that opencv_dart.xcframework exists in ~/.pub-cache/hosted/pub.dev/opencv_dart-1.2.1/ios.

I think there must be some setting that I need to enable to make the libs shipping with the release build.

Can anyone help?

@xonaman xonaman added the question Further information is requested label Aug 2, 2024
@rainyl
Copy link
Owner

rainyl commented Aug 2, 2024

@xonaman hello.

could you please take a look at whether the symbol is exists, you can refer to #24 (comment)

@xonaman
Copy link
Author

xonaman commented Aug 2, 2024

I assume you mean symbols opencv_dart | grep IMRead. Here’s the output:

~/.pub-cache/hosted/pub.dev/opencv_dart-1.2.1/ios/opencv_dart.framework % symbols opencv_dart | grep IMRead
                0x000000000009a9b0 (   0x2f0) Image_IMRead [FUNC, EXT, NameNList, MangledNameNList, Merged, NList, FunctionStarts] 
                0x000000000009c460 (   0x340) Image_IMRead_Async [FUNC, EXT, NameNList, MangledNameNList, Merged, NList, FunctionStarts]

@rainyl
Copy link
Owner

rainyl commented Aug 2, 2024

Yes, it is.

did you run setup manually? since i see 'opencv_dart.framework', it should be 'opencv_dart.xcframework', and there should be two subdirectory in it, arm64 for real device and x86_64 for simulator, cd to arm64 and run 'symbols opencv_dart | grep IMRead', and then tell me the result please.

I do not use iPhone so can't test it by myself, what i can help is give you the possible solution, hope you won't be bored.

@rainyl
Copy link
Owner

rainyl commented Aug 2, 2024

@xonaman The correct structure of ~/.pub-cache/hosted/pub.dev/opencv_dart-1.2.1/ios should be like:

image

you can try to run setup manually with dart run opencv_dart:setup ios -a os64 -f and try again

@xonaman
Copy link
Author

xonaman commented Aug 3, 2024

@rainyl After dart run opencv_dart:setup ios -a os64 -f, my ~/.pub-cache/hosted/pub.dev/opencv_dart-1.2.1/ios looks like this:

robertmainzer@MacBook-Pro-2 ios % find .                          
.
./Makefile
./opencv_dart.framework
./opencv_dart.framework/opencv_dart
./opencv_dart.framework/Info.plist
./libopencv_dart-ios-os64.tar.gz
./opencv_dart.xcframework
./opencv_dart.xcframework/ios-x86_64-simulator
./opencv_dart.xcframework/ios-x86_64-simulator/opencv_dart.framework
./opencv_dart.xcframework/ios-x86_64-simulator/opencv_dart.framework/opencv_dart
./opencv_dart.xcframework/ios-x86_64-simulator/opencv_dart.framework/Info.plist
./opencv_dart.xcframework/ios-arm64
./opencv_dart.xcframework/ios-arm64/opencv_dart.framework
./opencv_dart.xcframework/ios-arm64/opencv_dart.framework/opencv_dart
./opencv_dart.xcframework/ios-arm64/opencv_dart.framework/Info.plist
./opencv_dart.xcframework/Info.plist
./opencv_dart.podspec

I build with that again using flutter build ipa --release and still the error occurs.

@rainyl rainyl mentioned this issue Aug 6, 2024
@rainyl
Copy link
Owner

rainyl commented Aug 7, 2024

https://github.com/rainyl/opencv_dart/actions/runs/10259385478/job/28383772890?pr=204#step:5:116

I have no apple devices so can't test it, but it seems every thing is okay in the above logs.

not sure why.

@abdelaziz-mahdy
Copy link
Contributor

may that help? i found it on tflite repo
image

i see that they show in the action logs, but maybe they get stripped somehow on running on device?

@rainyl
Copy link
Owner

rainyl commented Aug 9, 2024

may that help? i found it on tflite repo
image

i see that they show in the action logs, but maybe they get stripped somehow on running on device?

I think so.

@rainyl
Copy link
Owner

rainyl commented Aug 13, 2024

No response for a long time, I am going to close this issue, feel free to reopen it again if anyone still have more problems.

For the solution, please check the advice posted by abdelaziz-mahdy #200 (comment), I cant test it.

@rainyl rainyl closed this as completed Aug 13, 2024
@kreazyme
Copy link

kreazyme commented Aug 13, 2024

I got the same problems :(

Device: Mac M1 14.4 Simulator
opencv_dart: ^1.2.1
3.24.0 Flutter SDK
symbols opencv_dart | grep IMRead
                0x000000000009a9b0 (   0x2f0) Image_IMRead [FUNC, EXT, NameNList, MangledNameNList, Merged, NList, FunctionStarts]
                0x000000000009c460 (   0x340) Image_IMRead_Async [FUNC, EXT, NameNList, MangledNameNList, Merged, NList, FunctionStarts]

Here is my pub folder
image

@rainyl
Copy link
Owner

rainyl commented Aug 13, 2024

@kreazyme
Copy link

kreazyme commented Aug 13, 2024

Finnaly, I try to run opencv_dart:setup and flutter clean && flutter pub get many of many times, and it's worked well.
Many thank to @rainyl 😄

@rainyl
Copy link
Owner

rainyl commented Aug 13, 2024

Finnaly, I try to run opencv_dart:setup and flutter clean && flutter pub get many of many times, and it's worked well. Many thank to @rainyl 😄

Great! Thanks for your solution~

@abdelaziz-mahdy
Copy link
Contributor

@kreazyme try to set the strip style, https://docs.flutter.dev/platform-integration/ios/c-interop#stripping-ios-symbols

I think that should be added to readme, to avoid the problem in the future

@rainyl
Copy link
Owner

rainyl commented Aug 13, 2024

I think that should be added to readme, to avoid the problem in the future

Agree, and a Q&A section is necessary.

@rainyl rainyl mentioned this issue Aug 13, 2024
Closed
3 tasks
@xonaman
Copy link
Author

xonaman commented Aug 22, 2024

@abdelaziz-mahdy your solution worked in my case. Thank you so much!

@abdelaziz-mahdy
Copy link
Contributor

glad to help <3

@frg-x
Copy link

frg-x commented Sep 20, 2024

I've tried all the solutions, but hadn't have success. Tried to run opencv_dart:setup and flutter clean && flutter pub get many of many times without any success. How to solve this issue? Thank you in advance!
screenshot-20-09-2024-13-40-32
screenshot-20-09-2024-13-42-17
screenshot-20-09-2024-13-42-49
screenshot-20-09-2024-13-43-13

@abdelaziz-mahdy
Copy link
Contributor

I've tried all the solutions, but hadn't have success. Tried to run opencv_dart:setup and flutter clean && flutter pub get many of many times without any success. How to solve this issue? Thank you in advance!
screenshot-20-09-2024-13-40-32
screenshot-20-09-2024-13-42-17
screenshot-20-09-2024-13-42-49
screenshot-20-09-2024-13-43-13

Your issue is different, increase your minimum os version and it should work correctly

@rainyl
Copy link
Owner

rainyl commented Sep 20, 2024

@frg-x Get it, I am working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants