Bug 264231

Summary: cmakelist.txt opencv-check broken
Product: [Applications] digikam Reporter: S. Burmeister <sven.burmeister>
Component: Portability-CmakeAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, dirk.kde, mike
Priority: NOR    
Version: 2.0.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 2.0.0
Sentry Crash Report:

Description S. Burmeister 2011-01-25 09:58:39 UTC
Version:           2.0.0 (using KDE 4.5.95) 
OS:                Linux

Since a few days the opencv-check does not work anymore althought it did before. 

-- Checking GNUCXX version 3/4 to determine  OpenCV /opt/net/ path
CMake Error at extra/libkface/cmake/modules_opencv/FindOpenCV.cmake:237 
(MESSAGE):
  OpenCV required but some headers or libs not found.  Please specify it's
  location with OpenCV_ROOT_DIR env.  variable.
Call Stack (most recent call first):
  extra/libkface/CMakeLists.txt:54 (FIND_PACKAGE)

The reason is that on some distros there were issues finding opncv.

"A short notice about OpenCV: Apparently, there are two versions of
FindOpenCV.cmake in the wild. If the one shipped with this software
does not find your OpenCV installation, specify
-DKFACE_EXTERNAL_FINDOPENCV:BOOL=TRUE as an argument to cmake to use
the FindOpenCV.cmake which is installed on your system."

The question is why the finding had to be broken for those distros that got it right and where it did work before.

The result is that using scripts like the cmakekde one from techbase (which compiles more than one module at a time) is no longer possible with digikam2 because it now requires some extra options which is completely unnecessary for most distros.

Expected behaviour: force only those distros to add some extra where it did not work before.

Reproducible: Always
Comment 1 S. Burmeister 2011-01-25 12:01:39 UTC
Does somebody know which commit broke this? It would be helpful to revert it and find a better solution.
Comment 2 caulier.gilles 2011-01-25 12:05:51 UTC
This one, from Michael (he is copy) :

http://websvn.kde.org/?view=revision&revision=1201006

Gilles Caulier
Comment 3 S. Burmeister 2011-01-25 12:33:02 UTC
that commit is from november 2010. however it only started to fail building one or two weeks ago.
Comment 4 Michael G. Hansen 2011-01-25 12:44:06 UTC
Hi,

actually the commit in question should be this one:

http://websvn.kde.org/?view=revision&revision=1206536

Of course, we can change the behavior to first try the distro-provided FindOpenCV, and if that does not work, use the internally provided one.

Michael
Comment 5 S. Burmeister 2011-01-25 12:56:01 UTC
A fallback in case nothing was found makes more sense IMHO.
Comment 6 Michael G. Hansen 2011-01-25 19:04:50 UTC
Sven, which distribution and version are you on? Everyone else who is listening and also has to specify -DKFACE_EXTERNAL_FINDOPENCV:BOOL=TRUE please let me know your distribution and its version.

Michael
Comment 7 S. Burmeister 2011-01-25 21:39:37 UTC
When the compiling broke I was on openSUSE 11.3 and KDE 4.5. Compiling worked perfectly regarding opncv before the change.

In the meantime I updated to KDE 4.6.

The autoamtic packaging on opensuse's buildserver also failed because of this change.

Why not use the old way and simply fall back to the new one if it returns an empty path? Why did that working system have to be broken and not just a fallback added?
Comment 8 Michael G. Hansen 2011-01-26 14:17:21 UTC
Thanks for the info. I'll try to implement a fallback mechanism.

Michael
Comment 9 Michael G. Hansen 2011-01-27 18:53:20 UTC
SVN commit 1217507 by mghansen:

Implement a fallback mechanism for OpenCV detection: If FIND_PACKAGE(OpenCV) can not find OpenCV, try to find it again using another version of FindOpenCV.cmake which is shipped with libkface and can still find OpenCV on some systems.

Tested under debian sid:

Normal installation of OpenCV via apt-get: OpenCV is found at the first try.
Remove /usr/share/opencv/OpenCVConfig.cmake: First try fails, but the FindOpenCV.cmake shipped with libkface still finds OpenCV at the second try.
If no OpenCV is installed at all, CMake stops after the second attempt, as it should be.

CCBUG: 264231



 M  +0 -7      CMakeLists.txt  
 M  +4 -8      README  
 M  +19 -6     extra/libkface/CMakeLists.txt  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1217507
Comment 10 S. Burmeister 2011-01-27 18:57:26 UTC
Seems to work on openSUSE 11.3 as well. Thanks a lot!
Comment 11 Michael G. Hansen 2011-01-27 19:04:12 UTC
Good to hear ;-) IIRC the FindOpenCV.cmake that we ship was mostly required under Windows, so maybe somebody could give it a try there, too?

Michael
Comment 12 caulier.gilles 2011-07-03 15:38:42 UTC
Tested under windows. all work fine.

Gilles Caulier
Comment 13 Dirk Tilger 2011-07-05 13:09:55 UTC
While testing OpenCV against beta6 I discovered a bug in the OpenCV cmake build files that will is now fixed in the 2.3 branch of OpenCV and the trunk:

https://code.ros.org/trac/opencv/ticket/1168

Maybe that will improve finding OpenCV in the future.