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

Auto setup from remote #76

Closed rainyl closed 2 weeks ago

rainyl commented 3 weeks ago

Is your feature request related to a problem? Please describe.

Current auto setup will still download libs from releases, using setup commands, but the command needs correct working directory, i.e., user project directory, and now the parent directory is the cached package directory of opencv_dart, which is not correct, BUT I didn't find any approaches to get user project directory, it seems Flutter didn't expose it although I see such SRCROOT=.... in build logs.

Describe the solution you'd like

  1. let users to install conan
  2. call conan build in cached opencv_dart package directory to build libs
  3. copy build libs to corresponding platform directory (already implemented in conanfile.py)

Additional context

abdelaziz-mahdy commented 3 weeks ago

i am confused, does you auto build opencv? that takes alot of time if understand correctly? or you build the c++ wrappers for this package, also may explain the difference to me?

also i would like to note weird behavior that happened to me, i was running ios but it kept saying

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)

Could not build the application for the simulator.
Error launching application on iPhone 15 Pro.

going to ios and running pod install fixed the problem, but i dont understand why it was not ran automatically

i can confirm this still happens

Failed to build iOS app
Error (Xcode): Building for 'iOS-simulator', but linking in dylib (/Users/AbdelazizMahdy/.pub-cache/hosted/pub.dev/opencv_dart-1.0.5+1/ios/opencv_dart.framework/opencv_dart) built for 'iOS'

Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

Could not build the application for the simulator.
Error launching application on iPhone 15 Pro.

i will add a ci for running on simulator to be sure if it got fixed

rainyl commented 3 weeks ago
  1. yes, only wrappers will be built. allow me to explain it later. As you said, building opencv itself is time consuming, that's why I moved it to opencv.full to prebuild it, but building wrappers is fast, so I think build them locally is better, and in this way it will be convenient to add more atchtectures like linux aarch64, because it doesn't need a prebuild.

  2. have you set OPENCV_DART_ARCH environment variable? by default arm64 will be built, I have no apple devices so not sure whether arm64 or x64 simulator will be used on arm64 macos? I will test it on x64 hackintosh, thanks~

rainyl commented 3 weeks ago

Well, maybe we should make the default ARCH=x64 instead of arm64?

abdelaziz-mahdy commented 3 weeks ago

Well, maybe we should make the default ARCH=x64 instead of arm64?

Let me test it , can't we make it a universal framework? Where are the framework built for iOS.to try to do so

abdelaziz-mahdy commented 3 weeks ago
  1. yes, only wrappers will be built. allow me to explain it later. As you said, building opencv itself is time consuming, that's why I moved it to opencv.full to prebuild it, but building wrappers is fast, so I think build them locally is better, and in this way it will be convenient to add more atchtectures like linux aarch64, because it doesn't need a prebuild.

  2. have you set OPENCV_DART_ARCH environment variable? by default arm64 will be built, I have no apple devices so not sure whether arm64 or x64 simulator will be used on arm64 macos? I will test it on x64 hackintosh, thanks~

I think the simulation is arm too but will check again

rainyl commented 3 weeks ago

Well, maybe we should make the default ARCH=x64 instead of arm64?

Let me test it , can't we make it a universal framework? Where are the framework built for iOS.to try to do so

Will a universal framework produce a large app after distribution? If not I think we can try to make it universal.

I think the simulation is arm too but will check again

Thanks~

rainyl commented 3 weeks ago

It's so annoying to process native libs distribution for dart, especially for ios, x64, arm64, arm64 simulator...., enough! I do not use iphone even not an apple user, so not expert in apple developement, and I have waste several days on solving ios releated problems.

So I decide to revert to download from releases, just as #66 but with fixed working directory.

abdelaziz-mahdy commented 3 weeks ago

It's so annoying to process native libs distribution for dart, especially for ios, x64, arm64, arm64 simulator...., enough! I do not use iphone even not an apple user, so not expert in apple developement, and I have waste several days on solving ios releated problems.

So I decide to revert to download from releases, just as #66 but with fixed working directory.

note: the problem with simualtor does happen using setup command too without the local build, just to be clear https://github.com/rainyl/opencv_dart/pull/66#issuecomment-2137153646 so the ios covering all archs option will be the best bet

rainyl commented 3 weeks ago

so the ios covering all archs option will be the best bet

Yes, it is in consideration too, almost finished :)