opencv_contrib icon indicating copy to clipboard operation
opencv_contrib copied to clipboard

Error while configuring CMake to build with contrib modules

Open zabsy opened this issue 1 year ago • 3 comments

  • OpenCV => 4.10.0
  • Operating System / Platform => Ubuntu 22.04.4
  • Compiler => CMake
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

zabsy avatar Aug 08 '24 18:08 zabsy

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

opencv-alalek avatar Aug 08 '24 20:08 opencv-alalek

Hello, I cannot reproduce this issue.

  • Install Ubuntu 22.04 (x86-64) on VMWare.
  • sudo apt install build-essential git ccache cmake libceres-dev
  • git clone https://github.com/opencv/opencv.git
  • git clone https://github.com/opencv/opencv_contrib.git
  • cmake -S opencv -DOPENCV_EXTRA_MODULES_PATH=./opencv_contrib/modules -B build4-main
  • It works well with 4.x branch , 4.10.0 tag from git and tar.gz packaged from releases.

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.

Kumataro avatar Aug 12 '24 00:08 Kumataro

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

limshoonkit avatar Sep 02 '24 13:09 limshoonkit