Vários errrors ao tentar compilar módulos OpenCV com cmake [closed]

0

Como posso resolver este problema?

Detected version of GNU GCC: 52 (502)
Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") 
Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
checking for module 'gtk+-3.0'
  package 'gtk+-3.0' not found
checking for module 'gstreamer-base-1.0'
  package 'gstreamer-base-1.0' not found
checking for module 'gstreamer-video-1.0'
  package 'gstreamer-video-1.0' not found
checking for module 'gstreamer-app-1.0'
  package 'gstreamer-app-1.0' not found
checking for module 'gstreamer-riff-1.0'
  package 'gstreamer-riff-1.0' not found
checking for module 'gstreamer-pbutils-1.0'
  package 'gstreamer-pbutils-1.0' not found
checking for module 'gstreamer-base-0.10'
  package 'gstreamer-base-0.10' not found
checking for module 'gstreamer-video-0.10'
  package 'gstreamer-video-0.10' not found
checking for module 'gstreamer-app-0.10'
  package 'gstreamer-app-0.10' not found
checking for module 'gstreamer-riff-0.10'
  package 'gstreamer-riff-0.10' not found
checking for module 'gstreamer-pbutils-0.10'
  package 'gstreamer-pbutils-0.10' not found
Looking for linux/videodev.h
Looking for linux/videodev.h - not found
Looking for linux/videodev2.h
Looking for linux/videodev2.h - found
Looking for sys/videoio.h
Looking for sys/videoio.h - not found
checking for module 'libavresample'
  package 'libavresample' not found
Looking for libavformat/avformat.h
Looking for libavformat/avformat.h - found
Looking for ffmpeg/avformat.h
Looking for ffmpeg/avformat.h - not found
checking for module 'libgphoto2'
  package 'libgphoto2' not found
found IPP (ICV version): 9.0.1 [9.0.1]
at: /home/foong/opencv/3rdparty/ippicv/unpack/ippicv_lnx
Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.10", minimum required is "2.7") 
Found PythonInterp: /usr/bin/python3.4 (found suitable version "3.4.3", minimum required is "3.4") 
Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.4.3")
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named 'numpy'
Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) 
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
CMake Error at cmake/OpenCVModule.cmake:295 (message):
  No extra modules found in folder: /home/foong/opencv/release/modules

  Please provide path to 'opencv_contrib/modules' folder.
Call Stack (most recent call first):
  modules/CMakeLists.txt:7 (ocv_glob_modules)



General configuration for OpenCV 3.1.0 =====================================
  Version control:               3.1.0

  Platform:
    Host:                        Linux 4.2.0-16-generic x86_64
    CMake:                       3.2.2
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               RELEASE

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                /usr/bin/c++  (ver 5.2.1)
    C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/bin/cc
    C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):
    Linker flags (Debug):
    Precompiled headers:         YES
    Extra dependencies:          /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so gtk-x11-2.0 gdk-x11-2.0 pangocairo-1.0 atk-1.0 cairo gdk_pixbuf-2.0 gio-2.0 pangoft2-1.0 pango-1.0 gobject-2.0 fontconfig freetype gthread-2.0 glib-2.0 dc1394 v4l1 v4l2 avcodec-ffmpeg avformat-ffmpeg avutil-ffmpeg swscale-ffmpeg dl m pthread rt
    3rdparty dependencies:       libwebp

  OpenCV modules:
    To be built:                 core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d stitching videostab python2
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python3 viz

  GUI: 
    QT:                          NO
    GTK+ 2.x:                    YES (ver 2.24.28)
    GThread :                    YES (ver 2.46.2)
    GtkGlExt:                    NO
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
    JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
    WEBP:                        build (ver 0.3.1)
    PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.51)
    TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.3)
    JPEG 2000:                   /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
    OpenEXR:                     /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2.2.0)
    GDAL:                        NO

  Video I/O:
    DC1394 1.x:                  NO
    DC1394 2.x:                  YES (ver 2.2.3)
    FFMPEG:                      YES
      codec:                     YES (ver 56.41.100)
      format:                    YES (ver 56.36.100)
      util:                      YES (ver 54.27.100)
      swscale:                   YES (ver 3.1.101)
      resample:                  NO
      gentoo-style:              YES
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    UniCap:                      NO
    UniCap ucil:                 NO
    V4L/V4L2:                    Using libv4l1 (ver 1.6.3) / libv4l2 (ver 1.6.3)
    XIMEA:                       NO
    Xine:                        NO
    gPhoto2:                     NO

  Parallel framework:            pthreads

  Other third-party libraries:
    Use IPP:                     9.0.1 [9.0.1]
         at:                     /home/foong/opencv/3rdparty/ippicv/unpack/ippicv_lnx
    Use IPP Async:               NO
    Use VA:                      NO
    Use Intel VA-API/OpenCL:     NO
    Use Eigen:                   NO
    Use Cuda:                    NO
    Use OpenCL:                  YES
    Use custom HAL:              NO

  OpenCL:
    Version:                     dynamic
    Include path:                /home/foong/opencv/3rdparty/include/opencl/1.2
    Use AMDFFT:                  NO
    Use AMDBLAS:                 NO

  Python 2:
    Interpreter:                 /usr/bin/python2.7 (ver 2.7.10)
    Libraries:                   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.10)
    numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.8.2)
    packages path:               lib/python2.7/dist-packages

  Python 3:
    Interpreter:                 /usr/bin/python3.4 (ver 3.4.3)

  Python (for build):            /usr/bin/python2.7

  Java:
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:                        Matlab not found or implicitly disabled

  Documentation:
    Doxygen:                     NO
    PlantUML:                    NO

  Tests and samples:
    Tests:                       YES
    Performance tests:           YES
    C/C++ Examples:              YES

  Install path:                  /usr/local

  cvconfig.h is in:              /home/foong/opencv/release
-----------------------------------------------------------------

Configuring incomplete, errors occurred!
See also "/home/foong/opencv/release/CMakeFiles/CMakeOutput.log".
See also "/home/foong/opencv/release/CMakeFiles/CMakeError.log".
    
por Kok Leong Foong 13.05.2016 / 06:41

1 resposta

2

Este erro ocorre porque o Ubuntu tem compiladores antigos ou desatualizados, e vários pacotes + dependências estão faltando. Atualize sua lista de pacotes primeiro,

sudo apt-get update

então,

sudo apt-get upgrade

Isso atualizará para versões mais recentes de todos os pacotes disponíveis. Em seguida,

sudo apt-get install build-essential

Isso instala os compiladores mais recentes disponíveis.

Em seguida, os seguintes pacotes são necessários para executar o opencv.

sudo apt-get install cmake git libgtk2.0-dev pkg-config \
libavcodec-dev libavformat-dev libswscale-dev

Os pacotes a seguir são opcionais , mas você também pode instalá-los.

sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev \
libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

Faça o download do código-fonte do OpenCV. Descompacte para uma pasta e diga OCV_source Agora use o terminal para ir dentro desta pasta,

cd /path/to/OCV_source

Aqui, crie uma pasta build e, em seguida, entre nela.

mkdir build && cd build

execute,

cmake -D CMAKE_BUILD_TYPE=Release/Debug -D CMAKE_INSTALL_PREFIX=/usr/local ..

Aqui, a pasta de instalação é /usr/local

cmake deve começar a compilar e, finalmente, deve gerar todos os arquivos make.

Depois disso, você tem que correr,

make -jn

em que n é o número de núcleos de CPU que você deseja usar para compilação. Para usar o single core, execute make

Para módulos adicionais, você deve incluir parâmetros adicionais durante a execução do cmake. Verifique a página de tutoriais da instalação openCV para mais detalhes.

    
por ankit7540 13.05.2016 / 07:42