opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.46k stars 5.77k forks source link

Error while configuring CMake to build with contrib modules #3775

Open zabsy opened 3 months ago

zabsy commented 3 months ago
Detailed description

Building OpenCV from source in order to use the SFM module, following the instructions here exactly, except replacing "4.x" with "4.10.0"

Steps to reproduce

After getting to the configuration step and running cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.10.0/modules ../opencv-4.10.0 I get these errors:

CMake Error at cmake/OpenCVUtils.cmake:1582 (add_library):
  Target "opencv_sfm" links to target "absl::log" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  cmake/OpenCVModule.cmake:989 (ocv_add_library)
  cmake/OpenCVModule.cmake:905 (_ocv_create_module)
  /home/zabsy/opencv_build/opencv_contrib-4.10.0/modules/sfm/CMakeLists.txt:150 (ocv_create_module)

CMake Error at cmake/OpenCVUtils.cmake:1582 (add_library):
  Target "opencv_sfm" links to target "absl::check" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  cmake/OpenCVModule.cmake:989 (ocv_add_library)
  cmake/OpenCVModule.cmake:905 (_ocv_create_module)
  /home/zabsy/opencv_build/opencv_contrib-4.10.0/modules/sfm/CMakeLists.txt:150 (ocv_create_module)

CMake Error at cmake/OpenCVUtils.cmake:1582 (add_library):
  Target "opencv_sfm" links to target "absl::fixed_array" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  cmake/OpenCVModule.cmake:989 (ocv_add_library)
  cmake/OpenCVModule.cmake:905 (_ocv_create_module)
  /home/zabsy/opencv_build/opencv_contrib-4.10.0/modules/sfm/CMakeLists.txt:150 (ocv_create_module)

CMake Error at /home/zabsy/opencv_build/opencv_contrib-4.10.0/modules/sfm/src/libmv_light/libmv/correspondence/CMakeLists.txt:9 (ADD_LIBRARY):
  Target "opencv.sfm.correspondence" links to target "absl::log" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?

CMake Error at /home/zabsy/opencv_build/opencv_contrib-4.10.0/modules/sfm/src/libmv_light/libmv/correspondence/CMakeLists.txt:9 (ADD_LIBRARY):
  Target "opencv.sfm.correspondence" links to target "absl::check" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?

CMake Error at /home/zabsy/opencv_build/opencv_contrib-4.10.0/modules/sfm/src/libmv_light/libmv/correspondence/CMakeLists.txt:9 (ADD_LIBRARY):
  Target "opencv.sfm.correspondence" links to target "absl::fixed_array" but
  the target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?

CMake Error at /home/zabsy/opencv_build/opencv_contrib-4.10.0/modules/sfm/src/libmv_light/libmv/multiview/CMakeLists.txt:19 (ADD_LIBRARY):
  Target "opencv.sfm.multiview" links to target "absl::log" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

CMake Error at /home/zabsy/opencv_build/opencv_contrib-4.10.0/modules/sfm/src/libmv_light/libmv/multiview/CMakeLists.txt:19 (ADD_LIBRARY):
  Target "opencv.sfm.multiview" links to target "absl::check" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

CMake Error at /home/zabsy/opencv_build/opencv_contrib-4.10.0/modules/sfm/src/libmv_light/libmv/multiview/CMakeLists.txt:19 (ADD_LIBRARY):
  Target "opencv.sfm.multiview" links to target "absl::fixed_array" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?

I tried to fix it by running sudo apt-get install libabsl-dev but I get the same errors.

Does anyone know how to fix this?

Thanks

opencv-alalek commented 3 months ago

OpenCV don't use abseil explicitly. Need to investigate which dependency is adding it to the project. Check ceres / glog / gflags and their versions.

Kumataro commented 3 months ago

Hello, I cannot reproduce this issue.

OpenCV 4.x branch from git

-- General configuration for OpenCV 4.10.0-dev =====================================
--   Version control:               4.10.0-196-gda3debda6d
--
--   Extra modules:
--     Location (extra):            /home/kmtr/work/opencv_contrib/modules
--     Version control (extra):     4.10.0-11-g2413f864
--
--   Platform:
--     Timestamp:                   2024-08-12T00:37:25Z
--     Host:                        Linux 6.5.0-45-generic x86_64
--     CMake:                       3.22.1
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/gmake
--     Configuration:               Release
--     Algorithm Hint:              ALGO_HINT_ACCURATE

--   OpenCV modules:
--     To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency sfm shape signal stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 cannops cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java julia matlab ovis python2 python3 viz
--     Applications:                tests perf_tests apps
--     Documentation:               NO
--     Non-free algorithms:         NO

-> sfm is included.

OpenCV 4.10.0 tag from git

-- General configuration for OpenCV 4.10.0 =====================================
--   Version control:               4.10.0
--
--   Extra modules:
--     Location (extra):            /home/kmtr/work/opencv_contrib/modules
--     Version control (extra):     4.10.0
--
--   Platform:
--     Timestamp:                   2024-08-12T00:42:53Z
--     Host:                        Linux 6.5.0-45-generic x86_64
--     CMake:                       3.22.1
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/gmake
--     Configuration:               Release

--   OpenCV modules:
--     To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency sfm shape signal stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 cannops cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java julia matlab ovis python2 python3 viz
--     Applications:                tests perf_tests apps
--     Documentation:               NO
--     Non-free algorithms:         NO

-> sfm is included.

OpenCV 4.10.0 tar.gz from tar.gz

-- General configuration for OpenCV 4.10.0 =====================================
--   Version control:               unknown
--
--   Extra modules:
--     Location (extra):            /home/kmtr/work/opencv_contrib-4.10.0/modules
--     Version control (extra):     unknown
--

--   OpenCV modules:
--     To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency sfm shape signal stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 cannops cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java julia matlab ovis python2 python3 viz
--     Applications:                tests perf_tests apps
--     Documentation:               NO
--     Non-free algorithms:         NO

-> sfm is included.

limshoonkit commented 3 months ago

probably related to this. @zabsy is your ceres built from source and version >=2.0?