Ask Your Question

Revision history [back]

Compilation error while building from source

Dependencies installed:

$ apt install -y libboost-all-dev libeigen3-dev ffmpeg jasper libatlas-base-dev libfreetype-dev libgoogle-glog-dev libgstreamer1.0-dev libharfbuzz-dev libhdf5-mpich-dev liblapack-dev libmpich-dev libopenmpi-dev libprotobuf-dev
$ pip3 install numpy

CMake args:

-DCMAKE_BUILD_TYPE=Release -DOPENCV_ENABLE_NONFREE=ON \
-DOPENCV_GENERATE_PKGCONFIG=YES  \
-DOPENCV_EXTRA_MODULES_PATH=`pwd`/opencv_contrib/modules \
-DHAVE_opencv_python3=ON

OpenCV's output: Version 4.5.0-openvino, Contrib: 4.4.0

HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.4") 
...
To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs  ...

Error:

In file included from /usr/include/hdf5/openmpi/hdf5.h:22,
           from <REDACTED>/opencv_contrib/modules/hdf/src/hdf5.cpp:37:
/usr/include/hdf5/openmpi/H5public.h:60:13: fatal error: mpi.h: No such file or directory
    60 | #   include <mpi.h>
         |             ^~~~~~~
   compilation terminated.
make[2]: *** [modules/hdf/CMakeFiles/opencv_hdf.dir/build.make:63: modules/hdf/CMakeFiles/opencv_hdf.dir/src/hdf5.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4397: modules/hdf/CMakeFiles/opencv_hdf.dir/all] Error 2