islamroshan / camera-linux

BSD 3-Clause "New" or "Revised" License
1 stars 3 forks source link

OpenCV missing: failure to run/build Flutter app with camera_linux #2

Open sneurlax opened 1 month ago

sneurlax commented 1 month ago

When I flutter pub add camera_linux to a Flutter project on Ubuntu 20.04, I get the following error due to missing OpenCV:

CMake Error at flutter/ephemeral/.plugin_symlinks/camera_linux/src/CMakeLists.txt:7 (find_package):
  By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenCV", but
  CMake did not find one.

  Could not find a package configuration file provided by "OpenCV" with any
  of the following names:

    OpenCVConfig.cmake
    opencv-config.cmake

  Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
  "OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"
  provides a separate development package or SDK, be sure it has been
  installed.

Error: Unable to generate build files

Would you please document how to resolve this issue in README.md?

sneurlax commented 1 month ago

sudo apt install libopencv-dev might be enough, but this should be documented if so

sneurlax commented 1 month ago

a further issue is how we should package libopencv_wrapper.so with our apps for users ... users have to sudo apt install libopencv-dev or similar, too, or they'll get:

flutter: Invalid argument(s): Failed to load dynamic library 'libcamera_[linux.so](http://linux.so/)': libopencv_[wrapper.so](http://wrapper.so/): cannot open shared object file: No such file or directory
flutter: #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11)
flutter: #1      new [DynamicLibrary.open](http://dynamiclibrary.open/) (dart:ffi-patch/ffi_dynamic_library_patch.dart:22)
flutter: #2      new CameraLinux (package:camera_linux/camera_linux.dart:12)

so I need to build libopencv_wrapper.so and bundle it into my linux/CMakeLists.txt