rainyl / opencv_dart

OpenCV bindings for Dart language and Flutter.
https://pub.dev/packages/opencv_dart
Apache License 2.0
78 stars 10 forks source link

Framework 'opencv_dart' not found #75

Closed arozdorozhniuk closed 3 weeks ago

arozdorozhniuk commented 3 weeks ago

Question

I'm getting this error trying to launch ios. I've tried launching example inside opencv_dart and it works almost fine. At least it launches. What can be the cause of this error?

Failed to build iOS app
Error (Xcode): Framework 'opencv_dart' not found
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

P.S. It is probably because i'm trying to use your plugin inside of another plugin, and definitely doing something wrong.

rainyl commented 3 weeks ago

Using opencv_dart inside another plugin has not been tested, please provide a minimal example to reproduce it.

arozdorozhniuk commented 3 weeks ago

Using opencv_dart inside another plugin has not been tested, please provide a minimal example to reproduce it.

I've basically created a plugin wih this command: flutter create --template=plugin --platforms=android,ios some_plugin

And added your plugin as a dependency in main pubspec.yaml like that:

dependencies:
  flutter:
    sdk: flutter
  opencv_dart: ^1.0.5
  plugin_platform_interface: ^2.0.2

Than I run example project inside plugin folder to test it. And Android downloads everything and runs well, but iOS is giving this error for some strange reasons.

I can provide full package but literally done nothing else with it.

rainyl commented 3 weeks ago

get it. may i ask that you are running on a simulator or real device ?

rainyl commented 3 weeks ago

@arozdorozhniuk Confirmed, You can run setup command manually to solve this, refer to README for detailed setup commands.

It's because the incorrect working directory in Makefile of ios, I am considering to compile locally instead of download from releases, please setup manually until it is finished.

arozdorozhniuk commented 3 weeks ago

I've tried calling dart run opencv_dart:setup ios --arch x64 or arm64 for simulator or device accordingly. But it seems that it does nothing.

Example output in terminal:

arozdorozhniuk@NB01ACCO006 example % dart run opencv_dart:setup ios --arch x64  
Building package executable... 
Built opencv_dart:setup.
opencv_dart: working for ios x64
Building with assumed project root in: /Users/arozdorozhniuk/Documents/work/some_plugin/example/
Using package:opencv_dart from /Users/arozdorozhniuk/.pub-cache/hosted/pub.dev/opencv_dart-1.0.5
Downloading https://github.com/rainyl/opencv_dart/releases/download/v1.0.5/libopencv_dart-ios-x64.tar.gz
Cached to /Users/arozdorozhniuk/.pub-cache/hosted/pub.dev/opencv_dart-1.0.5/.dart_tool/.cache/libopencv_dart-ios-x64.tar.gz
Libs already exists in /Users/arozdorozhniuk/.pub-cache/hosted/pub.dev/opencv_dart-1.0.5/ios, Skipping...
Finished

Should I refer to some other setup process in readme?

rainyl commented 3 weeks ago

/Users/arozdorozhniuk/.pub-cache/hosted/pub.dev/opencv_dart-1.0.5/ios

please take a look at /Users/arozdorozhniuk/.pub-cache/hosted/pub.dev/opencv_dart-1.0.5/ios and see whether opencv_dart.framework is there and ensure the content of opencv_dart.framework is not empty, you can manually delete it and try to re-run the setup commands.

arozdorozhniuk commented 3 weeks ago
Screenshot 2024-06-05 at 10 20 02

It becomes even stranger, because it seems that opencv_dart.framework is not empty..

rainyl commented 3 weeks ago

Try to delete the directory and re-run setup, and run the example to see whether it works

arozdorozhniuk commented 3 weeks ago

I've tried all of that, and it seems like opencv_dart exists but somehow it is not being found.

Also, i've just reilsed that 1.0.4 version is working and it is becoming even stranger now

rainyl commented 3 weeks ago

All right, please downgrade to v1.0.4 for now and waiting for #78 to be finished.

arozdorozhniuk commented 3 weeks ago

Thanks a lot, you're really helpful!

rainyl commented 3 weeks ago

You are welcome.

It almost finished, could you please test whether it works for you with the following deps:

opencv_dart:
    git:
      url: https://github.com/rainyl/opencv_dart
      ref: 96a936a

Please install the dependencies before running examples if you haven't install them, especially conan:

brew install --force --overwrite ninja ffmpeg@6 conan
brew link --overwrite ffmpeg@6
conan profile detect -f
arozdorozhniuk commented 3 weeks ago

It works now!

rainyl commented 3 weeks ago

v1.0.5+1 has been published, I have tested it on macos (x86_64) and ios simulator (x86_64), but not tested on arm64 although the workflow passed, if you are using arm64 devices please test it, if it doesn't work please open a new issue. :)