I am trying to build OpenCV in a Python virtual environment, because some code uses Python 2.7 and wants OpenCV 3.1.0, which isn't necessarily the configuration the system has/needs. Thus, I thought a little installation script deploying a custom OpenCV in a virtual environment would be nice.
This is my CMAKE routine (indented for readability):
cmake -D BUILD_TIFF=ON
-D BUILD_opencv_java=OFF
-D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=${env_path/local}
-D PYTHON_EXECUTABLE=${env_path}/bin/python
-D PYTHON_INCLUDE_DIR=${env_path}/include/python2.7
-D PYTHON_PACKAGES_PATH=${env_path}/lib/python2.7/site-packages
-D INSTALL_PYTHON_EXAMPLES=ON
${opencv_source_dir}
${env_path}
is the path to the virtual environment and ${opencv_source_dir}
the path to the (unpacked) OpenCV source files.
When my script hits the actual building:
make -j4
make install
I always end up with this error:
/usr/include/c++/6.1.1/cstdlib:75:25: (...) stdlib.h: (...) not found
#include_next <stdlib.h>
^
However, the file actually is there:
sudo find / -type f -name "*stdlib.h"
returns:
/usr/include/stdlib.h
/usr/include/bits/stdlib.h
/usr/include/bsd/stdlib.h
/usr/include/freetype2/freetype/config/ftstdlib.h
/usr/include/c++/6.1.1/stdlib.h
/usr/include/c++/6.1.1/tr1/stdlib.h
The only link I found via Google (GCC Bugzilla – Bug 70129) isn't really helping?!
Has anyone experienced the same error?
How can I force CMAKE to use gcc/g++ 5 rather than 6? (I found some links that had no answer why this error happens...but they suggest to use gcc/g++ 5 for compilation, because the error does not occur there)