pythonopencvubuntucmake

Opencv2.4 compiling error on ubuntu during installation


I'm new with opencv.I'm trying to install opencv24using the script and with out it (manually building everything) and everything I get the same error even though it says done; it doesn't do anything. Could you help me? Thanks

**[ 33%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o
/home/pc/OpenCV/opencv-2.4.10/modules/core/src/system.cpp: In function ‘(static initializers for /home/pc/OpenCV/opencv-2.4.10/modules/core/src/system.cpp)’:
/home/pc/OpenCV/opencv-2.4.10/modules/core/src/system.cpp:280:10: error: inconsistent operand constraints in an ‘asm’
         );
          ^
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2**
sudo: checkinstall: command not found
OpenCV 2.4.10 ready to be used

Solution

  • Read this bug report It seems to report having the same type of error. Apparently old gcc compilers have an issue with some asembly code.

    **/home/ubuntu/opencv/opencv-2.4.10/modules/core/src/system.cpp:280:10: error: inconsistent operand constraints in an ‘asm’
    make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o] Error 1
    make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
    make: *** [all] Error 2**
    

    Could you do a gcc --version If it's something around 4.7, 4.8 That's ok. If it's not, although I would find that strange, could you do a

    sudo apt-get update
    sudo apt-get build-essentials checkinstall
    

    Like Aidana Kane recommended. You could be using old package lists, and could easily get no new software installed\updated up to date etc report. If even after you've done the sudo apt-get update it still doesn't work, try installing gcc-4.8 explicitly.

    I would recommend that solution, updating to newer gcc, rather than monkeypathching the files. However, the bug has been reported fixed in OpenCV version 2.4.11 so you could try and get that one from the git repo. Or even something "more drastic" as making sure you edit your file system.cpp to look exactly like this one.