FS#50111 - [opencv] CMake error with HDF5
Attached to Project:
Arch Linux
Opened by Leonardo B (leonardo) - Wednesday, 20 July 2016, 14:03 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 30 March 2018, 13:39 GMT
Opened by Leonardo B (leonardo) - Wednesday, 20 July 2016, 14:03 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 30 March 2018, 13:39 GMT
|
Details
Description:
Updated CMake package (3.6.0-1), and now it bugs when I try to compile OpenCV. When I downgraded to 3.5.2-2 it got to work again. The error is: ################# CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: HDF5_hdf5_cpp_LIBRARY linked by target "opencv_hdf" in directory /home/leonardo/OpenCV/OpenCV3/opencv_contrib/modules/hdf -- Configuring incomplete, errors occurred! See also "/home/user/OpenCV/OpenCV3/build/CMakeFiles/CMakeOutput.log". See also "/home/user/OpenCV/OpenCV3/build/CMakeFiles/CMakeError.log". ################# Steps to reproduce: #Download git OpenCV.# OPTIONS="-DWITH_OPENCL=ON -DWITH_OPENGL=ON -DWITH_TBB=ON -DWITH_XINE=ON -DWITH_OPENNI=ON -DWITH_GSTREAMER=OFF -DBUILD_WITH_DEBUG_INFO=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=ON -DINSTALL_C_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=ON -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules -DCMAKE_INSTALL_PREFIX=/usr/local" cd build cmake $OPTIONS ../opencv make -j7 |
This task depends upon
If I downgrade to 3.5.2-2 there is no problem.
a bug report in upstream may be useful
My first guess is that you have the package hdf5 installed and not hdf5-cpp-fortran. It would probably work with the latter package installed. Your logs suggest that the regular HDF5 C library was found, but not the C++ version.
My second guess is that the following change might have made cmake fail in this scenario:
https://cmake.org/gitweb?p=cmake.git;a=blobdiff;f=Modules/FindHDF5.cmake;h=a81ba13d9df3ae48380436143006c9f2bfe8b794;hp=46c8896eb0325a46b7e4edb87c6d49472398b61e;hb=4ece8bdd0fa36d8e69dabf8c620f9e50170000e8;hpb=87c1cd9c517bb57a537ba1f75548e6c20966553d
There were a few changes related to the HDF5 library detection in cmake recently:
https://cmake.org/gitweb?p=cmake.git;a=history;f=Modules/FindHDF5.cmake;h=50e18922ee45494eb04aa1bc991cd4070f7ec52d;hb=HEAD
I do not know what the package dependency situation is, where the HDF5 dependency comes from, and whether the C++ libraries are required. Maybe this check silently failed previously and it was not really a problem?
test.c: [empty]
CMakeLists.txt:
cmake_minimum_required (VERSION 2.6)
project (Test)
find_package (HDF5)
add_executable(Test test.c)
target_link_libraries(Test ${HDF5_LIBRARIES})
With hdf5, cmake then looks for the C++ libraries and fails:
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Found HDF5: /usr/lib64/libz.so;/usr/lib64/libdl.so;/usr/lib64/libm.so;HDF5_hdf5_cpp_LIBRARY-NOTFOUND;/usr/lib64/libhdf5.so (found version "1.10.0")
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
HDF5_hdf5_cpp_LIBRARY
linked by target "Test" in directory /home/andreas/Downloads/tmp
-- Configuring incomplete, errors occurred!
Installing the C++ libraries (in hdf5-openmpi or hdf5-cpp-fortran) makes the cmake command work. That should probably not happen.
# pacman -S hdf5-cpp-fortran
hdf5-cpp-fortran and hdf5 are in conflict. Remove hdf5? [y/N]
# pacman -S hdf5-openmpi
:: hdf5-openmpi and hdf5 are in conflict. Remove hdf5? [y/N]
is it safe to do the switch to hdf5-openmpi version ?
On the other hand, hdf5-openmpi pulls in Open MPI and has the C++ bindings enabled. This configuration is "unsupported". If you do not need the MPI support, you should probably go for hdf5-cpp-fortran, in my opinion.
I do not know if that is a workaround to your initial problem, but I strongly suspect it is.
so a quick workaround would be to modify PKGBUILD file, by adding "hdf5-cpp-fortran" in "makedepends" section
Compiling with hdf5-cpp-fortran installed makes makepkg to throw this error:
fatal error: stdlib.h: No such file or directory
Here is the full output of makepkg:
-- Build files have been written to: /home/borche/opencvarch/src/opencv-3.1.0
[ 0%] Generating opencv_core_pch_dephelp.cxx
Scanning dependencies of target opencv_core_pch_dephelp
[ 0%] Building CXX object modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/opencv_core_pch_dephelp.cxx.o
[ 0%] Linking CXX static library ../../lib/libopencv_core_pch_dephelp.a
[ 0%] Built target opencv_core_pch_dephelp
Scanning dependencies of target pch_Generate_opencv_core
[ 1%] Generating precomp.hpp
[ 1%] Generating precomp.hpp.gch/opencv_core_Release.gch
In file included from /usr/include/c++/6.1.1/bits/stl_algo.h:59:0,
from /usr/include/c++/6.1.1/algorithm:62,
from /home/borche/opencvarch/src/opencv-3.1.0/modules/core/include/opencv2/core/base.hpp:53,
from /home/borche/opencvarch/src/opencv-3.1.0/modules/core/include/opencv2/core.hpp:54,
from /home/borche/opencvarch/src/opencv-3.1.0/modules/core/include/opencv2/core/utility.hpp:52,
from /home/borche/opencvarch/src/opencv-3.1.0/modules/core/precomp.hpp:49:
/usr/include/c++/6.1.1/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^
compilation terminated.
make[2]: *** [modules/core/CMakeFiles/pch_Generate_opencv_core.dir/build.make:64: modules/core/precomp.hpp.gch/opencv_core_Release.gch] Error 1
make[1]: *** [CMakeFiles/Makefile2:1796: modules/core/CMakeFiles/pch_Generate_opencv_core.dir/all] Error 2
make: *** [Makefile:161: all] Error 2
==> ERROR: A failure occurred in build().
Aborting...
[borche@manjaro opencvarch]$