Bug 360017 - build error: opencv_contrib is required but was not found
Summary: build error: opencv_contrib is required but was not found
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Portability-Cmake (show other bugs)
Version: 5.0.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-03 06:48 UTC by Thomas Eschenbacher
Modified: 2022-01-02 13:10 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Eschenbacher 2016-03-03 06:48:28 UTC
I tried to build yesterday's git version, but it does stop in cmake while checking for opencv.

Reproducible: Always

Steps to Reproduce:
1. ./bootstrap.local


Actual Results:  
[...]
-- First try at finding OpenCV...
CMake Error at /usr/share/OpenCV/OpenCVConfig.cmake:232 (message):
  opencv_contrib is required but was not found
Call Stack (most recent call first):
  core/cmake/modules/MacroOpenCV.cmake:27 (find_package)
  core/CMakeLists.txt:229 (DETECT_OPENCV)
[...]


I am currently using media-libs/opencv-3.1.0-r2 (Gentoo Linux),
and also tried after downgrading to media-libs/opencv-3.1.0-r1, media-libs/opencv-3.0.0, but with no luck. Also setting ADDITIONAL_CMAKE_FLAGS='-DENABLE_OPENCV3:BOOL=ON', as suggested by a bug report on redhat bugtracker made no difference.

Seems that digikam is not aware of the new opencv-3.x at all, I searched my backups about anything related to "opencv_contrib" and I only found things like /usr/lib64/libopencv_contrib.so.2.4.10 - so I conclude that this library does no longer exist in opencv >= v3.0.

My current version of "core" is: commit 41b97ecec0703c61bf25e2a8d700908c5da37850
(Date:   Wed Mar 2 22:48:15 2016 +0100)
Comment 1 caulier.gilles 2016-03-03 06:57:15 UTC
Not reproducible. digiKam compile fine with OpenCV 3.1.

If Contrib component is require by Cmake config script installed by OpenCV itself, well install the necessary package on your computer.

(/usr/share/OpenCV/OpenCVConfig.cmake)

It sound like a packaging problem as well.

Gilles Caulier
Comment 2 Thomas Eschenbacher 2016-03-03 21:08:19 UTC
ok, thanks for the information! You mean that opencv_contrib stuff is really still included in the "opencv" package? (I thougt that stuff has been removed)

In that case I will file a bug report against the gentoo package...

Just for reference:
https://bugs.gentoo.org/show_bug.cgi?id=576384
Comment 3 caulier.gilles 2016-03-03 21:49:35 UTC
The contrib package is download at compilation time than OpenCV if i remember. Check Cmake config trace when you process OpenCV tarball...

So i suspect that opencv have been compiled with it but packager forget to include contrib content in packaging process, or something like that.

Note : OpenCV is a big puzzle.

Gilles Caulier
Comment 4 Thomas Eschenbacher 2016-03-05 23:25:14 UTC
I have to re-open that topic.
I found out that all that trouble was caused by digikam itself!

The big bug is that the bootstrap.linux script contains the parameter -DENABLE_OPENCV3=OFF in the cmake command line, _HARD CODED_ !!!  and _after_ including the user defineable parameter list ADDITIONAL_CMAKE_FLAGS. So adding -DENABLE_OPENCV3=ON to ADDITIONAL_CMAKE_FLAGS in bootstrap.local is pretty useless!

Please fix the bootstrap.linux script to allow overriding _all_ the hardcoded settings and adjust the comments in bootstrap.local !
Comment 5 caulier.gilles 2016-03-06 10:02:25 UTC
Propose a patch to use ADDITIONAL_CMAKE_FLAGS in bootstrap.linux. For ex, check if ADDITIONAL_CMAKE_FLAGS is empty. In this case use hardcoded flags, else use ADDITIONAL_CMAKE_FLAGS instead.

Gilles Caulier
Comment 6 caulier.gilles 2016-06-29 14:18:02 UTC
Thomas,

Did you seen my previous comment ?

Gilles Caulier
Comment 7 caulier.gilles 2016-06-30 12:49:31 UTC
No response.

If you want to disable ENABLE_OPENCV3 while configuring, just use sed to edit in packaging scripts the default value, as i do for OSX and Windows packaging.

sed -e "s/ENABLE_OPENCV3=OFF/ENABLE_OPENCV3=ON/g" ./bootstrap.linux

It's enough and work perfectly. There is no plan to extend bootstrap script as well. If you want this kind of feature, propose a patch as well.

Gilles Caulier
Comment 8 Thomas Eschenbacher 2016-06-30 16:19:13 UTC
No response within one day?
You guy seem to be really busy and impatient...

Yes, I have seen your comment, but I have neither time nor motivation anymore to use a git version of digikam or to propose a path for that. Instead I  will wait until digikam is in the official stable repo of my distribution and use that one.
Comment 9 swatilodha27 2016-08-24 13:37:40 UTC
I'm able to reproduce this error. (Using KUbuntu 16.04)
opencv and opencv_contrib are both installed on my system, yet I received this error while running bootstrap.linux file.

-- First try at finding OpenCV...
CMake Error at /usr/local/share/OpenCV/OpenCVConfig.cmake:232 (message):
  opencv_contrib is required but was not found
Call Stack (most recent call first):
  core/cmake/modules/MacroOpenCV.cmake:27 (find_package)
  core/CMakeLists.txt:246 (DETECT_OPENCV)


-- Configuring incomplete, errors occurred!
See also "/home/swati/digikam-software-compilation/build/CMakeFiles/CMakeOutput.log".
See also "/home/swati/digikam-software-compilation/build/CMakeFiles/CMakeError.log".
Comment 10 caulier.gilles 2016-08-24 13:49:56 UTC
OpenCV 2 or 3 is installed.

There is a switch in bootstrap to use OpenCV 2 or 3

Gilles
Comment 11 caulier.gilles 2016-08-25 12:31:54 UTC
Use bootstrap opencv option to switch between 2 or 3. It work fine here...

Gilles Caulier