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 · 11 comments

Comments

@avtomaton
Copy link

avtomaton commented Jan 26, 2016

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

Yaffa1607 commented Sep 13, 2016

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

@rtylecek

This comment has been minimized.

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 added a commit to blogle/opencv that referenced this issue Mar 8, 2017

@YuehChuan

This comment has been minimized.

Copy link

YuehChuan commented Apr 16, 2017

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

@RamitPahwa

This comment has been minimized.

Copy link

RamitPahwa commented May 7, 2017

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

This comment has been minimized.

Copy link

kvmanohar22 commented May 22, 2017

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

@NickCrews

This comment has been minimized.

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)

@opencv opencv deleted a comment from pearlmary Jul 19, 2017

@opencv opencv deleted a comment from pearlmary Jul 19, 2017

thirdeye-peter added a commit to thirdeye-labs/opencv that referenced this issue Jan 17, 2018

adding HDF5 references to python/common.cmake
local fix of the issue reported here opencv#6016
@Sreekiranar

This comment has been minimized.

Copy link

Sreekiranar commented Sep 17, 2018

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

@pravin382

This comment has been minimized.

Copy link

pravin382 commented Nov 1, 2018

Worked for me, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment