Tuesday, September 30, 2014

OpenCV 2.4.8 Freak.cpp Error

If you encounter the following errors while trying to compile OpenCV 2.4.8 with Python 2.7.5:
OpenCV-2.4.3/modules/features2d/src/freak.cpp:437: error: unable to find a register to spill in class 'GENERAL_REGS'
OR
Generating pyopencv_generated_funcs.h, pyopencv_generated_func_tab.h, pyopencv_generated_types.h, pyopencv_generated_type_reg.h, pyopencv_generated_const_reg.h
Edit the following file using vi or any other text editor:
vi modules/features2d/CMakeFiles/opencv_features2d.dir/build.make
Search for freak.cpp and add -O0 after each $(CXX_FLAGS), it should look like this:
/usr/bin/c++   $(CXX_DEFINES) $(CXX_FLAGS) -O0 -o CMakeFiles/opencv_features2d.dir/src/freak.cpp.o -c /root/Downloads/Python_Project/opencv-2.4.8/modules/features2d/src/freak.cpp
/usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -O0 -E /root/Downloads/Python_Project/opencv-2.4.8/modules/features2d/src/freak.cpp > CMakeFiles/opencv_features2d.dir/src/freak.cpp.i
/usr/bin/c++  $(CXX_DEFINES) $(CXX_FLAGS) -O0 -S /root/Downloads/Python_Project/opencv-2.4.8/modules/features2d/src/freak.cpp -o CMakeFiles/opencv_features2d.dir/src/freak.cpp.s

1 comment:

Chris said...

I had this exact same problem and it seemed to fix me. Do you have an explanation of what the error means and why these updated flags fixes the issue?

Post a Comment