-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Make error when compling with opencv_contrib-3.4.16 #3216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As a workaround you could disable hdf module (refer to OpenCV build documentation): |
I'm sorry if the comment is wrong. What is cause.I think you maybe installed only parallel hdf5(libhdf5-mpich-dev) and not installed serial hdf5(libhdf5-dev). libhdf5-mpich-dev depends MPI library. kmtr@kmtr:~/work/build$ LANG=C apt search libhdf5 | grep "\-dev"
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libhdf5-dev/impish 1.10.6+repack-5 amd64
libhdf5-mpi-dev/impish 1.10.6+repack-5 amd64
libhdf5-mpich-dev/impish,now 1.10.6+repack-5 amd64 [installed]
libhdf5-openmpi-dev/impish 1.10.6+repack-5 amd64 Currently contrib-hdf5 module supports only libhdf5-dev . It doesn't depend MPI Library. So that to compile contrib-hdf5 with libhdf5-mpich-dev is failed with missing MPI library. (Maybe same trouble with libhdf5-openmpi-dev is happend too). How to fixThere are 2 extra options.
CMake gives priority to libhdf5-dev than libhdf5-mpich-dev.
My test is not too enough to pull reqeust, which is only to run opencv_test_hdf and to check dependency library. kmtr@kmtr:~/work/opencv_contrib$ git --no-pager diff
diff --git a/modules/hdf/CMakeLists.txt b/modules/hdf/CMakeLists.txt
index 2a1ae68b..2c0bb4a5 100644
--- a/modules/hdf/CMakeLists.txt
+++ b/modules/hdf/CMakeLists.txt
@@ -25,11 +25,28 @@ if(NOT HDF5_FOUND)
ocv_module_disable(hdf) # no return
endif()
+set(HDF5_ADD_LIBRARIES "")
+set(HDF5_ADD_INCLUDE_DIRS "")
+
+if(HDF5_IS_PARALLEL)
+ status("HDF5: Parallel")
+ find_package(MPI)
+
+ if(NOT MPI_FOUND)
+ status("HDF5_IS_PARALLEL is TRUE, but MPI is NOT FOUND -> hdf is disabled,")
+ ocv_module_disable(hdf) # no return
+ endif()
+ set(HDF5_ADD_LIBRARIES ${MPI_CXX_LIBRARIES})
+ set(HDF5_ADD_INCLUDE_DIRS ${MPI_CXX_INCLUDE_DIRS})
+else()
+ status("HDF5: Serial")
+endif()
+
set(HAVE_HDF5 1)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Winvalid-offsetof)
set(the_description "Hierarchical Data Format I/O")
ocv_define_module(hdf opencv_core WRAP python)
-ocv_target_link_libraries(${the_module} ${HDF5_LIBRARIES})
-ocv_include_directories(${HDF5_INCLUDE_DIRS})
+ocv_target_link_libraries(${the_module} ${HDF5_LIBRARIES} ${HDF5_ADD_LIBRARIES})
+ocv_include_directories(${HDF5_INCLUDE_DIRS} ${HDF5_ADD_INCLUDE_DIRS}) kmtr@kmtr:~/work/build$ ldd bin/opencv_test_hdf | grep mpi
libhdf5_mpich.so.103 => /lib/x86_64-linux-gnu/libhdf5_mpich.so.103 (0x00007f200bd1e000)
libmpi.so.40 => /lib/x86_64-linux-gnu/libmpi.so.40 (0x00007f200bbf3000)
libmpich.so.12 => /lib/x86_64-linux-gnu/libmpich.so.12 (0x00007f200b127000) |
Make sure you check out the same tags for the opencv and opencv_contrib modules. For example do: |
System information (version)
Detailed description
When compiled with opencv_contrib, it failed as:
I can
make
smoothly without contrib-module. It seems like an issue with hdf5 and openmpi.... How should I fix the issue? Many thanks!!!!The text was updated successfully, but these errors were encountered: