Skip to content
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

build error for python bindings with opencv_contrib modules #6016

Closed
avtomaton opened this issue Jan 26, 2016 · 14 comments
Closed

build error for python bindings with opencv_contrib modules #6016

avtomaton opened this issue Jan 26, 2016 · 14 comments
Labels
affected: 3.4 bug category: build/install category: contrib Target patches to **opencv_contrib** repository: https://github.com/opencv/opencv_contrib

Comments

@avtomaton
Copy link

Build from latest version (1cd3c6f) with -DOPENCV_EXTRA_MODULES_PATH=<path to my contrib modules> produces the following error:

In file included from /home/avtomaton/arbeit/sdk/cxx/opencv/build/modules/python2/pyopencv_generated_include.h:11:0,
from /home/avtomaton/arbeit/sdk/cxx/opencv/modules/python/src2/cv2.cpp:12:
/home/avtomaton/arbeit/sdk/cxx/opencv_contrib/modules/hdf/include/opencv2/hdf/hdf5.hpp:40:18: fatal error: hdf5.h: No such file or directory

I attached makefile output for this error. It seems that for python2 and python3 modules there are no include paths for HDF5, i. e. dirty hardcoding

find_package(HDF5)
include_directories(${HDF5_INCLUDE_DIRS})

into modules/python/common.cmake solves the problem. I believe that it is not nice solution, that's why I don't attach pull request.

make-verbose.txt

@alalek
Copy link
Member

alalek commented Jan 27, 2016

Thanks for report!
Public includes of modules should not depend on external 3rdparty libraries. Violation of this rule provides this problem.
Line with #include <hdf5.h> must gone into internal implementation.

@auroua
Copy link

auroua commented Jun 5, 2016

I have encountered exactly the same error in ubuntu 16.04, and have solved the problem using @avtomaton 's method

@cmdelatorre
Copy link

cmdelatorre commented Jun 26, 2016

I have encountered exactly the same error with version 3.1.0 in Ubuntu 15.10, and have solved the problem using @avtomaton 's method.

@Yaffa1607
Copy link

What steps do I have to repeat after adding these lines to common.cmake?

@rtylecek
Copy link

rtylecek commented Oct 5, 2016

I just run make once again and it compiled (U16.04).

daveselinger added a commit to daveselinger/opencv that referenced this issue Dec 13, 2016
blogle pushed a commit to blogle/opencv that referenced this issue Mar 8, 2017
@YuehChuan
Copy link

Works charm on ubuntu16.04.2 with ROS kinetic, thanks 😄

@RamitPahwa
Copy link

Where exactly do i need to add these lines ??
I am new to the area and not able to navigate to the common.cmake??
Please point me to the right direction.

@kvmanohar22
Copy link

@Ramit-Pahwa that file is located at <OpenCV_DIR>/modules/python

@NickCrews
Copy link

NickCrews commented Jun 13, 2017

@Ramit-Pahwa And I added them on like the 3rd line of the file, so that

# This file is included from a subdirectory
set(PYTHON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../")

ocv_add_module(${MODULE_NAME} BINDINGS)

became

# This file is included from a subdirectory
set(PYTHON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../")

find_package(HDF5)
include_directories(${HDF5_INCLUDE_DIRS})

ocv_add_module(${MODULE_NAME} BINDINGS)

And this worked for me, I only had to run make again (Ubuntu 16.10)

thirdeye-peter added a commit to thirdeye-labs/opencv that referenced this issue Jan 17, 2018
local fix of the issue reported here opencv#6016
@Sreekiranar
Copy link

Sreekiranar commented Sep 17, 2018

Worked like a charm. Thanks a lot !! @avtomaton

@pravin382
Copy link

Worked for me, thanks

@DronPascal
Copy link

DronPascal commented Apr 19, 2020

I made: $ sudo apt-get install -y libhdf5-dev
And it worked for me!

There's all that u need to QT and OpenCV if u need:
$ sudo apt install build-essential perl python git libx11-xcb-dev libxcb-composite0-dev libxcb-cursor-dev libxcb-damage0-dev libxcb-dpms0-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-present-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-shm0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xtest0-dev libxcb1-dev flex bison gperf libicu-dev libxslt-dev ruby libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libdbus-1-dev libfontconfig1-dev libcap-dev libxtst-dev libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libxss-dev libegl1-mesa-dev gperf bison libasound2-dev make cmake libgl1-mesa-dev libglu1-mesa-dev build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev ffmpeg libharfbuzz-dev libglib2.0-dev libpcre2-dev libgstreamer1.0-dev gstreamer1.0-tools gstreamer1.0-plugins-ugly gstreamer1.0-plugins-good gstreamer1.0-plugins-base gstreamer1.0-plugins-bad libgstreamer-plugins-base1.0-dev libdlib-dev libharfbuzz-dev libpcre3-dev libudev-dev libinput-dev libxcb-xinerama0-dev libxcb-xinerama0 libgdk3.0-cil-dev libgtk-3-dev libglib2.0-dev libglib2.0-cil-dev libglib3.0-cil-dev libegl1-mesa-dev libgles2-mesa-dev perl6 bison flex gperf python libdc1394-22-dev libdc1394-utils valgrind libhdf5-devsudo

@aismai01
Copy link

does anyone know by any chance if the procedure to install it is the same on a Raspberry Pi 3. I got the same error and I followed the recommendation that @avtomaton made but it didn't work

@Unlicensed-driver-ljx
Copy link

home/nvidia/opencv/opencv-3.4.5/build/modules/python_bindings_generator/pyopencv_generated_include.h:14:10: fatal error: opencv2/hdf/hdf5.hpp: No such file or directory
14 | #include "opencv2/hdf/hdf5.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/build.make:63: modules/python2/CMakeFiles/opencv_python2.dir//src2/cv2.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:6674: modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
In file included from /home/nvidia/opencv/opencv-3.4.5/modules/python/src2/cv2.cpp:31:
/home/nvidia/opencv/opencv-3.4.5/build/modules/python_bindings_generator/pyopencv_generated_include.h:14:10: fatal error: opencv2/hdf/hdf5.hpp: No such file or directory
14 | #include "opencv2/hdf/hdf5.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/build.make:63: modules/python3/CMakeFiles/opencv_python3.dir/
/src2/cv2.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:6719: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
在ubutnu20上面编译opencv3.4.5,硬件设备jetson nx报错,这个该如何解决?呼叫全球大佬支援

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected: 3.4 bug category: build/install category: contrib Target patches to **opencv_contrib** repository: https://github.com/opencv/opencv_contrib
Projects
None yet
Development

No branches or pull requests