Problems building OpenCV 2.0 on CentOS 5?
I tried to install the OpenCV library on my centos system, but when I type make and hit enter after setting up with cmake, I get the following error:
[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/amoments.o
[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/affine3d_estimator.o
[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/acontours.o
[100%] Building CXX object tests/cv/CMakeFiles/cvtest.dir/src/areprojectImageTo3D.o
Linking CXX executable ../../bin/cvtest
CMakeFiles/cvtest.dir/src/highguitest.o: In function `CV_HighGuiTest::run(int)':
highguitest.cpp:(.text._ZN14CV_HighGuiTest3runEi+0x15): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
[100%] Built target cvtest
make: *** [all] Error 2
and I wonder as soon as I got this error:
[ 99%] Built target mltest
[ 99%] Generating generated0.i
Traceback (most recent call last):
File "/home/proje/OpenCV-2.1.0/interfaces/python/gen.py", line 43, in ?
if True in has_init and not all(has_init[has_init.index(True):]):
NameError: name 'all' is not defined
make[2]: *** [interfaces/python/generated0.i] Error 1
make[1]: *** [interfaces/python/CMakeFiles/cvpy.dir/all] Error 2
make: *** [all] Error 2
What is the reason for these errors? I need to install opencv immediately on this computer.
a source to share
I had this problem. It's a Python frontend ... By default Python 2.4 is installed on CentOS and is not easily upgradeable to 2.6.
When OpenCV builds it gets confused by the Python version ...
So I turned off the Python interface on "cmake" and everything was fine.
cmake -D CMAKE_BUILD_TYPE = RELEASE -D CMAKE_INSTALL_PREFIX = / usr / local -D BUILD_NEW_PYTHON_SUPPORT = NO ..
But, of course, you can no longer use OpenCV with Python.
a source to share
The Python feature all()
was introduced with version 2.5. You are probably compiling a version where all()
it doesn't already exist in Python.
According to Python, List of built-in functions is all()
equivalent to:
def all(iterable):
for element in iterable:
if not element:
return False
return True
You may also need to define any()
. This is equivalent to:
def any(iterable):
for element in iterable:
if element:
return True
return False
Chances are, if the script requires Python 2.5 to install, then the rest of the shell is Python.
a source to share