opencv: Cannot make install opencv from origin/master on ubuntu 17.10
System information (version)
- OpenCV => cloned from github origin/master
- Cuda 9.1/ CuDNN 7.0
- FFMPEG compiled from sources (cloned from github origin/master)
- OpenCV contrib : cloned from github origin/master
- Operating System / Platform => Ubuntu artful 17.10
- Compiler => gcc6
Detailed description
Error during last “sudo make install” although no problem during other phases.
[ 83%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o
/home/guilmort/INSTALLATION/opencv-3.4.0/modules/python/src2/cv2.cpp:18:40: fatal error: pyopencv_generated_include.h: No such file or directory
#include "pyopencv_generated_include.h"
^
compilation terminated.
Steps to reproduce
cmake command:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/opt/opencv
-D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF
-D OPENCV_EXTRA_MODULES_PATH=~/INSTALLATION/opencv-contrib/opencv_contrib/modules
-D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python -D BUILD_EXAMPLES=ON
-D WITH_CUDA=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1
-D CUDA_NVCC_FLAGS="--std=c++11 --expt-relaxed-constexpr" -DCMAKE_C_COMPILER=gcc-6
-DCMAKE_CXX_COMPILER=g++-6 ..
make -j4
sudo make install
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 30 (9 by maintainers)
@zapcity @Guilmort you may have to manually execute the generator script (gen2.py)
Assuming you called
cmake ..
from thebuild
directory you could do:python ./modules/python/src2/gen2.py ./build/modules/python_bindings_generator ./build/modules/python_bindings_generator/headers.txt
I think the bug arises because cmake doesn’t find the right python executable to run the script
Just got a similar issue when trying to compile OpenCV 3.4.1 with only Python3 support. Fixed passing the path to the python2 for CMake: -DPYTHON2_EXECUTABLE=/usr/bin/python2
@dbanda Worked for me as well, except I ran your commands one level up from build/, at opencv-3.4.1/. Thank you so much!
@Guilmort @StatML @zapcity
May I ask, with humility, please try
make
without-j
? One thing I realized, is that throughout the years, I have never once runmake
with-j
on OpenCV. I don’t even know if it is meant to be safe to do so. Other projects I’ve done parallel, but not on OpenCV.The purpose is purely to see if that makes a different outcome. Please try your best to clean up the folders before this experiment. Or if you can afford, try it in a virtual machine or container. Hopefully we’ll be learning a few things from it.
@dbanda thanks. this solution worked for me.
If possible, please post a nearly complete copy of the output and error logs:
CMakeFiles/CMakeOutput.log
andCMakeFiles/CMakeError.log
.You may edit these files to remove personally identifiable information from them.
However, do not try to extract just a small portion of those files, because the true issue may have happened in a build step that is much earlier than what you have found. Also, these files contain a verbatim copy of the configuration settings of your OpenCV CMake project, which is necessary for others trying to replicate your issue.
You may post the entire file anywhere online that is publicly accessible (for example, as a Github Gist), and then just post the link as a reply to this issue.
Just looking at the limited error excerpt from your post, it is some C++ code that is generated as part of the build. In other words, in an earlier build step, some python programs would be executed; these programs will write into a C++ file. This happens before the C++ project is compiled. Apparently a failure happens somewhere in between.
@Guilmort Comment by @peterbyzhang solved the same issue for me. Run your commands one level up from build i.e. at opencv-3.4.1/
I met this problem that I installed virtual environment with Python3 only that the headers generation relies on python2.7 only, 😦 It took me several days to finally figure this out.
I then switch out to non virtual env to manually generated headers using python2.7:
Then coming back to virtual env with python3 only, to continue installation opencv3.4.1, it works. 😃
Hi @kinchungwong Thanks a lot for your warm reply. I tried
make
without-j
. The results were still the same.I am getting exactly the same error. However my environment is:
When I compile my Release build with BUILD_opencv_python3 and INSTALL_PYTHON_EXAMPLES checked, I get the error:
Error: C:\opencv\opencv-3.4.1\modules\python\src2\cv2.cpp(22): fatal error C1083: Cannot open include file: ‘pyopencv_generated_include.h’: No such file or directory
I know the OP issue is from a ubuntu install perspective. Just wanted to show that its carried across to ms windows.
This target should run “gen2.py” script. Probably there is some mess with file timestamps. Try to remove “modules/python_bindings_generator/” directory, run from build directory “cmake .” and make again.
Expected output: