After buliding Qt5.5.1 for my arm board sucessfully, I am taking up to crosscompile opencv. Here are the steps:
First, I crosscompile 3rdparty:
a.libz
lmk#lmk-virtual-machine:/home/newdisk$ sudo tar -zvxf zlib-1.2.8.tar.gz
lmk#lmk-virtual-machine:/home/newdisk$ cd zlib-1.2.8
lmk#lmk-virtual-machine:/home/newdisk/zlib-1.2.8$ sudo ./configure --prefix=/home/newdisk/optnew/opencv-rely -shared
lmk#lmk-virtual-machine:/home/newdisk/zlib-1.2.8$ sudo vi Makefile
and etit Makefile in some details:
#Makefile
CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc
LDSHARED= /home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
AR=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-ar
RANLIB=arm-linux-ranlib
the last step is run make and make install:
lmk#lmk-virtual-machine:/home/newdisk/zlib-1.2.8$ sudo make
lmk#lmk-virtual-machine:/home/newdisk/zlib-1.2.8$ sudo make install
b.libjpeg
lmk#lmk-virtual-machine:/home/newdisk$ sudo tar -zvxf jpegsrc.v9.tar.gz
lmk#lmk-virtual-machine:/home/newdisk$ cd jpeg-9
lmk#lmk-virtual-machine:/home/newdisk/jpeg-9$ sudo CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc ./configure --host=arm-linux --prefix=/home/newdisk/optnew/opencv-rely --enable-shared --enable-static
lmk#lmk-virtual-machine:/home/newdisk/jpeg-9$ sudo make
lmk#lmk-virtual-machine:/home/newdisk/jpeg-9$ sudo make install
c.libpng
lmk#lmk-virtual-machine:/home/newdisk$ sudo xz -d libpng-1.6.29.tar.xz
lmk#lmk-virtual-machine:/home/newdisk$ sudo tar -xvf libpng-1.6.29.tar
lmk#lmk-virtual-machine:/home/newdisk$ cd libpng-1.6.29
lmk#lmk-virtual-machine:/home/newdisk/libpng-1.6.29$ sudo CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc ./configure --host=arm-linux --prefix=/home/newdisk/optnew/opencv-rely --enable-shared --enable-static
lmk#lmk-virtual-machine:/home/newdisk/libpng-1.6.29$ sudo make
lmk#lmk-virtual-machine:/home/newdisk/libpng-1.6.29$ sudo make install
d.yasm
lmk#lmk-virtual-machine:/home/newdisk$ sudo tar -zvxf yasm-1.3.0.tar.gz
lmk#lmk-virtual-machine:/home/newdisk$ cd yasm-1.3.0
lmk#lmk-virtual-machine:/home/newdisk/yasm-1.3.0$ sudo CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc ./configure --prefix=/home/newdisk/optnew/opencv-rely --host=arm-linux
lmk#lmk-virtual-machine:/home/newdisk/yasm-1.3.0$ sudo make
lmk#lmk-virtual-machine:/home/newdisk/yasm-1.3.0$ sudo make install
e.libx264
lmk#lmk-virtual-machine:/home/newdisk$ sudo tar -jxvf last_x264.tar.bz2
lmk#lmk-virtual-machine:/home/newdisk$ cd x264-snapshot-20170612-2245
lmk#lmk-virtual-machine:/home/newdisk/x264-snapshot-20170612-2245$ sudo CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc ./configure --enable-shared --host=arm-linux --disable-asm --prefix=/home/newdisk/optnew/opencv-rely
lmk#lmk-virtual-machine:/home/newdisk/x264-snapshot-20170612-2245$ sudo make
lmk#lmk-virtual-machine:/home/newdisk/x264-snapshot-20170612-2245$ sudo make install
f.libxvid
lmk#lmk-virtual-machine:/home/newdisk$ cd xvidcore-1.3.3
lmk#lmk-virtual-machine:/home/newdisk/xvidcore-1.3.3$ cd build/generic
lmk#lmk-virtual-machine:/home/newdisk/xvidcore-1.3.3/build/generic$ sudo CC=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc ./configure --prefix=/home/newdisk/optnew/opencv-rely --host=arm-linux --disable-assembly
lmk#lmk-virtual-machine:/home/newdisk/xvidcore-1.3.3/build/generic$ sudo make
lmk#lmk-virtual-machine:/home/newdisk/xvidcore-1.3.3/build/generic$ sudo make install
g.ffmpeg
lmk#lmk-virtual-machine:/home/newdisk$ sudo tar -jvxf ffmpeg-3.3.2.tar.bz2
lmk#lmk-virtual-machine:/home/newdisk$ cd ffmpeg-3.3.2
lmk#lmk-virtual-machine:/home/newdisk/ffmpeg-3.3.2$
sudo ./configure --prefix=/home/newdisk/optnew/opencv-rely --enable-shared --disable-static --enable-gpl --enable-cross-compile --arch=arm --disable-stripping --target-os=linux --enable-libx264 --enable-libxvid --cc=/home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-none-linux-gnueabi-gcc --enable-swscale --extra-ldflags=-L/home/newdisk/optnew/opencv-rely/lib --extra-cflags=-I/home/newdisk/optnew/opencv-rely/include
lmk#lmk-virtual-machine:/home/newdisk/ffmpeg-3.3.2$ sudo make
lmk#lmk-virtual-machine:/home/newdisk/ffmpeg-3.3.2$ sudo make install
There is no problem in 3rdparty crosscompile.
Next, opencv crosscompile:
lmk#lmk-virtual-machine:/home/newdisk$ sudo unzip opencv-3.1.0.zip
lmk#lmk-virtual-machine:/home/newdisk$ cd opencv-3.1.0
lmk#lmk-virtual-machine:/home/newdisk/opencv-3.1.0$ sudo mkdir BuildOpencv
lmk#lmk-virtual-machine:/home/newdisk/opencv-3.1.0$ cd BuildOpencv
lmk#lmk-virtual-machine:/home/newdisk/opencv-3.1.0/BuildOpencv$ sudo vim toolchain.cmake
#toolchain.cmake
###########user defined#############
set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_SYSTEM_PROCESSOR arm )
set( CMAKE_C_COMPILER /home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc )
set( CMAKE_CXX_COMPILER /home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ )
###########user defined#############
set( CMAKE_FIND_ROOT_PATH /home/newdisk/optnew/opencv-rely)
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
######################################
Then I run cmake:
lmk#lmk-virtual-machine:/home/newdisk/opencv-3.1.0/BuildOpencv$ sudo cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ../
Here is the result:
-- Detected version of GNU GCC: 45 (405)
-- Found ZLIB: /home/newdisk/optnew/opencv-rely/lib/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
-- Could NOT find Jasper (missing: JASPER_LIBRARIES) (found version "1.900.1")
-- Found ZLIB: /home/newdisk/optnew/opencv-rely/lib/libz.so (found version "1.2.8")
-- 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 - 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 - not found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- checking for module 'libgphoto2'
-- package 'libgphoto2' not found
-- 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.6", minimum required is "2.7")
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES) (found suitable version "2.7.6", minimum required is "2.7")
-- Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)
-- If you want to enable Python/Numpy support, set the following variables:
-- PYTHON2_INCLUDE_PATH
-- PYTHON2_LIBRARIES
-- PYTHON2_NUMPY_INCLUDE_DIRS
-- PYTHON3_INCLUDE_PATH
-- PYTHON3_LIBRARIES
-- PYTHON3_NUMPY_INCLUDE_DIRS
-- Found PythonInterp: /usr/bin/python3.4 (found suitable version "3.4.3", minimum required is "3.4")
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES) (Required is at least version "3.4")
-- Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)
-- If you want to enable Python/Numpy support, set the following variables:
-- PYTHON2_INCLUDE_PATH
-- PYTHON2_LIBRARIES
-- PYTHON2_NUMPY_INCLUDE_DIRS
-- PYTHON3_INCLUDE_PATH
-- PYTHON3_LIBRARIES
-- PYTHON3_NUMPY_INCLUDE_DIRS
-- 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)
--
-- General configuration for OpenCV 3.1.0
=====================================
-- Version control: unknown
--
-- Platform:
-- Host: Linux 3.16.0-77-generic i686
-- Target: Linux arm
-- CMake: 2.8.12.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: Release
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ (ver 4.5.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 -fdiagnostics-show-option -pthread -fomit-frame-pointer -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 -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /home/newdisk/optnew/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc
-- 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 -fdiagnostics-show-option -pthread -fomit-frame-pointer -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 -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
-- Precompiled headers: YES
-- Extra dependencies: /home/newdisk/optnew/opencv-rely/lib/libjpeg.so /home/newdisk/optnew/opencv-rely/lib/libpng.so /home/newdisk/optnew/opencv-rely/lib/libz.so gtk-x11-2.0 gdk-x11-2.0 atk-1.0 gio-2.0 pangoft2-1.0 pangocairo-1.0 gdk_pixbuf-2.0 cairo pango-1.0 fontconfig gobject-2.0 freetype gthread-2.0 glib-2.0 dc1394 v4l1 v4l2 avcodec avformat avutil swscale dl m pthread rt
-- 3rdparty dependencies: libwebp libtiff libjasper IlmImf
--
-- OpenCV modules:
-- To be built: core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d stitching videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 viz
--
-- GUI:
-- QT: NO
-- GTK+ 2.x: YES (ver 2.24.23)
-- GThread : YES (ver 2.40.2)
-- GtkGlExt: NO
-- OpenGL support: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /home/newdisk/optnew/opencv-rely/lib/libz.so (ver 1.2.8)
-- JPEG: /home/newdisk/optnew/opencv-rely/lib/libjpeg.so (ver 90)
-- WEBP: build (ver 0.3.1)
-- PNG: /home/newdisk/optnew/opencv-rely/lib/libpng.so (ver 1.6.29)
-- TIFF: build (ver 42 - 4.0.2)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: build (ver 1.7.1)
-- GDAL: NO
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.1)
-- FFMPEG: YES
-- codec: YES (ver 54.35.1)
-- format: YES (ver 54.20.4)
-- util: YES (ver 52.3.0)
-- swscale: YES (ver 2.1.1)
-- 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 0.8.8) / libv4l2 (ver 0.8.8)
-- XIMEA: NO
-- Xine: NO
-- gPhoto2: NO
--
-- Parallel framework: pthreads
--
-- Other third-party libraries:
-- Use IPP: 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/newdisk/opencv-3.1.0/3rdparty/include/opencl/1.2
-- Use AMDFFT: NO
-- Use AMDBLAS: NO
--
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.6)
--
-- 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: NO
--
-- Install path: /home/newdisk/opencv-3.1.0/BuildOpencv/install
--
-- cvconfig.h is in: /home/newdisk/opencv-3.1.0/BuildOpencv
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/newdisk/opencv-3.1.0/BuildOpencv
After configuring and generating, run cmake-gui:
lmk#lmk-virtual-machine:/home/newdisk/opencv-3.1.0/BuildOpencv$ sudo cmake-gui
Src:/home/newdisk/opencv-3.1.0
Build:/home/newdisk/opencv-3.1.0/BuildOpencv
CMAKE_INSTALL_PREFIX:/home/newdisk/optnew/opencv-arm
Don't choose these items:
WITH_CUDA
WITH_GTK
WITH_1394
WITH_GSTREAMER
WITH_LIBV4L
WITH_TIFF
BUILD_OPENEXR
WITH_OPENEXR
WITH_OPENCL
Configure and generate.
lmk#lmk-virtual-machine:/home/newdisk/opencv-3.1.0/BuildOpencv$ sudo vi CMakeCache.txt
#CMakeCache.txt
//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING=-lpthread -lrt
lmk#lmk-virtual-machine:/home/newdisk/opencv-3.1.0/BuildOpencv$ sudo make
Fianlly,I got these errors:
[ 27%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_mjpeg_decoder.cpp.o
[ 27%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_v4l.cpp.o
[ 27%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o
In file included from /home/newdisk/opencv-3.1.0/modules/videoio/src/cap_ffmpeg_impl.hpp:65:0,
from /home/newdisk/opencv-3.1.0/modules/videoio/src/cap_ffmpeg.cpp:45:
/home/newdisk/opencv-3.1.0/modules/videoio/src/ffmpeg_codecs.hpp:77:36: fatal error: libavformat/avformat.h: No such file or directory
compilation terminated.
make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2
While the file libavformat/avformat.h does exits in my directory
/home/newdisk/optnew/opencv-rely/include
Why can cmake find lib directory
-- Found ZLIB: /home/newdisk/optnew/opencv-rely/lib/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
but cannot find include directory?
/home/newdisk/optnew/opencv-rely/include
Do you have any idea?
I have solved the problem by adding extra two lines to file toolchain.cmake
INCLUDE_DIRECTORIES( /home/newdisk/optnew/opencv-rely/include ),LINK_DIRECTORIES( /home/newdisk/optnew/opencv-rely/lib ). Sincerely hope that anyone will explain it more clearly
Related
Here is the error I am getting when I am compiling OpenCV on ubuntu 20.04 with cuda 10.1.
-- Detected processor: x86_64
CMake Warning at cmake/OpenCVUtils.cmake:721 (message):
Unexpected option: WITH_CUBLAS (=ON)
Condition: IF (WITH_CUDA)
Call Stack (most recent call first):
CMakeLists.txt:249 (OCV_OPTION)
CMake Warning at cmake/OpenCVUtils.cmake:721 (message):
Unexpected option: WITH_CUDNN (=ON)
Condition: IF (WITH_CUDA)
Call Stack (most recent call first):
CMakeLists.txt:252 (OCV_OPTION)
-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
-- Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1)
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
-- found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
-- at: /home/murat/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
-- found Intel IPP Integration Wrappers sources: 2020.0.0
-- at: /home/murat/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
-- A library with LAPACK API found.
-- OpenCV Python: during development append to PYTHONPATH: /home/murat/opencv/build/python_loader
-- Caffe: NO
-- Protobuf: NO
-- Glog: YES
-- freetype2: YES (ver 23.1.17)
-- harfbuzz: YES (ver 2.6.4)
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Julia not found. Not compiling Julia Bindings.
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.2
-- Checking SFM deps... TRUE
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
-- Checking for module 'tesseract'
-- No package 'tesseract' found
-- Tesseract: NO
-- Allocator metrics storage type: 'long long'
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
CMake Error at modules/dnn/CMakeLists.txt:35 (message):
DNN: CUDA backend requires CUDA Toolkit. Please resolve dependency or
disable OPENCV_DNN_CUDA=OFF
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /home/murat/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out cuda4dnn source code
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.2
-- Checking SFM deps... TRUE
-- CERES support is disabled. Ceres Solver for reconstruction API is required.
--
-- General configuration for OpenCV 4.4.0 =====================================
-- Version control: unknown
--
-- Extra modules:
-- Location (extra): /home/murat/opencv_contrib/modules
-- Version control (extra): unknown
--
-- Platform:
-- Timestamp: 2021-02-18T12:05:50Z
-- Host: Linux 5.8.0-43-generic x86_64
-- CMake: 3.16.3
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
--
-- CPU/HW features:
-- Baseline: SSE SSE2 SSE3
-- requested: SSE3
-- Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
-- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
-- SSE4_1 (15 files): + SSSE3 SSE4_1
-- SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
-- FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
-- AVX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
-- AVX2 (29 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- AVX512_SKX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ standard: 11
-- C++ Compiler: /usr/bin/c++ (ver 9.3.0)
-- C++ flags (Release): -fsigned-char -ffast-math -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 -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -ffast-math -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 -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed
-- Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: dl m pthread rt
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv java js julia matlab ovis python2 viz
-- Applications: perf_tests apps
-- Documentation: NO
-- Non-free algorithms: YES
--
-- GUI:
-- GTK+: YES (ver 3.24.20)
-- GThread : YES (ver 2.64.6)
-- GtkGlExt: NO
-- OpenGL support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: build (ver encoder: 0x020f)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
-- TIFF: build (ver 42 - 4.0.10)
-- JPEG 2000: build Jasper (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_3)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: YES (2.2.5)
-- FFMPEG: YES
-- avcodec: YES (58.54.100)
-- avformat: YES (58.29.100)
-- avutil: YES (56.31.100)
-- swscale: YES (5.5.100)
-- avresample: YES (4.0.0)
-- GStreamer: YES (1.16.2)
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: TBB (ver 2020.2 interface 11102)
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Intel IPP: 2020.0.0 Gold [2020.0.0]
-- at: /home/murat/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
-- Intel IPP IW: sources (2020.0.0)
-- at: /home/murat/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
-- Lapack: NO
-- Eigen: YES (ver 3.3.7)
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
--
-- cuDNN: NO
--
-- OpenCL: YES (no extra features)
-- Include path: /home/murat/opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 3:
-- Interpreter: /usr/bin/python3 (ver 3.8.5)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython3.8.so (ver 3.8.5)
-- numpy: /home/murat/.local/lib/python3.8/site-packages/numpy/core/include (ver 1.18.5)
-- install path: lib/python3.8/dist-packages/cv2/python-3.8
--
-- Python (for build): /usr/bin/python3
--
-- Java:
-- ant: NO
-- JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include/linux /usr/lib/jvm/default-java/include
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring incomplete, errors occurred!
See also "/home/murat/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/home/murat/opencv/build/CMakeFiles/CMakeError.log".
Here are my cmake flags:
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules
-D BUILD_TIFF=ON
-D WITH_FFMPEG=ON
-D WITH_GSTREAMER=ON
-D WITH_TBB=ON
-D BUILD_TBB=ON
-D WITH_EIGEN=ON
-D WITH_V4L=ON
-D WITH_LIBV4L=ON
-D WITH_VTK=OFF
-D WITH_QT=OFF
-D WITH_OPENGL=ON
-D OPENCV_ENABLE_NONFREE=ON
-D INSTALL_C_EXAMPLES=OFF
-D INSTALL_PYTHON_EXAMPLES=OFF
-D BUILD_NEW_PYTHON_SUPPORT=ON
-D OPENCV_GENERATE_PKGCONFIG=ON
-D BUILD_TESTS=OFF
-D OPENCV_DNN_CUDA=ON
-D ENABLE_FAST_MATH=ON
-D CUDA_FAST_MATH=ON
-D CUDA_ARCH_BIN=7.0
-D WITH_CUBLAS=ON
-D WITH_CUDNN=ON
-D CUDNN_LIBRARY=/usr/lib/cuda/lib64/libcudnn.so.7.6.5
-D CUDNN_INCLUDE_DIR=/usr/lib/cuda/include
-D BUILD_EXAMPLES=OFF
-D PYTHON_DEFAULT_EXECUTABLE=$(which python3) ..
It works perfectly with the option -D OPENCV_DNN_CUDA=OFF. But I need CUDA libraries. My CUDA and CUDNN paths are correct, so I have no idea what is wrong with the cmake compilation. Did anyone face with a similar problem when installing opencv?
Note: I am following this link to finally install caffe.
$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
(Version OpenCV 4.5.3.) The OpenCV "DNN" module's cmake file opencv/modules/dnn/CMakeLists.txt is checking variable HAVE_CUDA, but this variable appears to never be set by a Performing Test by the time the DNN module is examined. Worse, at the beginning there's also a
CMake Warning at cmake/OpenCVUtils.cmake:758 (message):
Unexpected option: WITH_CUDNN (=ON)
message. CUDNN_FOUND appears to be set, but not finding HAVE_CUDA. Perhaps a name got changed.
The twelfth-hour night-before-demo workaround is to remove the dnn folder from the opencv/modules directory. This wipes out usage of downstream modules: barcode; dnn_objdetect; dnn_superres; mcc; text; and wechat_qrcode, but the system cmakes.
Specifying -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.4 may help but did not fix it. Note the system adds on /bin or also /bin64 to this internally, in order to verify the toolkit location based on nvcc or nvcc.exe at some point.
libcudnn.so is at the specified place, and does not seem to be the problem.
While things could be going wrong in a couple different directions, I believe there could be a flaw with the .deb archive file. It doesn't prepare a libcudnn.so where the OpenCV installation checks.
Because of this, I think it's necessary to use the generic Linux tarball installation. (https://developer.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.2_20191118/cudnn-10.2-linux-x64-v7.6.5.32.tgz)
I'm new to Raspberry Pi (and command-line build etc..). Here's the output I got from building OpenCV:
pi#SamPi:~/opencv-3.1.0/build $ cmake -D CMAKE_BUILD_TYPE=RELEASE \
> -D CMAKE_INSTALL_PREFIX=/usr/local \
> -D INSTALL_PYTHON_EXAMPLES=ON \
> -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules \
> -D BUILD_EXAMPLES=ON ..
-- The CXX compiler identification is GNU 4.9.2
-- The C compiler identification is GNU 4.9.2
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Failed
-- Performing Test HAVE_C_WSIGN_PROMO
-- Performing Test HAVE_C_WSIGN_PROMO - Failed
-- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR
-- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR - Failed
-- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
-- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
-- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN
-- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN - Failed
-- Looking for io.h
-- Looking for io.h - not found
-- Looking for jbg_newlen
-- Looking for jbg_newlen - not found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Checking for module 'libgphoto2'
-- No package 'libgphoto2' found
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
-- 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
-- Caffe: NO
-- Protobuf: NO
-- Glog: NO
-- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS HDF5_HL_LIBRARIES)
-- Checking SFM deps... FALSE
-- Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
-- Tesseract: NO
-- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES
-- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES - Failed
-- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE
-- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE - Failed
-- Tesseract: NO
--
-- General configuration for OpenCV 3.1.0 =====================================
-- Version control: unknown
--
-- Platform:
-- Host: Linux 4.9.35-v7+ armv7l
-- CMake: 3.6.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 4.9.2)
-- 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 -pthread -fomit-frame-pointer -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 -pthread -fomit-frame-pointer -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 -pthread -fomit-frame-pointer -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 -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
-- Precompiled headers: YES
-- Extra dependencies: /usr/lib/arm-linux-gnueabihf/libpng.so /usr/lib/arm-linux-gnueabihf/libz.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 v4l1 v4l2 avcodec avformat avutil swscale avresample dl m pthread rt
-- 3rdparty dependencies: libjpeg libwebp libtiff libjasper IlmImf libprotobuf
--
-- OpenCV modules:
-- To be built: core flann imgproc ml photo reg surface_matching video dnn fuzzy imgcodecs shape videoio highgui objdetect plot superres ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching python2 python3
-- Disabled: world contrib_world
-- Disabled by dependency: -
-- Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java viz cvv hdf matlab sfm
--
-- GUI:
-- QT: NO
-- GTK+ 2.x: YES (ver 2.24.25)
-- GThread : YES (ver 2.42.1)
-- GtkGlExt: NO
-- OpenGL support: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
-- JPEG: libjpeg (ver 90)
-- WEBP: build (ver 0.3.1)
-- PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.2.50)
-- TIFF: build (ver 42 - 4.0.2)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: build (ver 1.7.1)
-- GDAL: NO
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: NO
-- FFMPEG: YES
-- codec: YES (ver 56.1.0)
-- format: YES (ver 56.1.0)
-- util: YES (ver 54.3.0)
-- swscale: YES (ver 3.0.0)
-- resample: YES (ver 2.1.0)
-- 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.0) / libv4l2 (ver 1.6.0)
-- XIMEA: NO
-- Xine: NO
-- gPhoto2: NO
--
-- Parallel framework: pthreads
--
-- Other third-party libraries:
-- Use IPP: 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/pi/opencv-3.1.0/3rdparty/include/opencl/1.2
-- Use AMDFFT: NO
-- Use AMDBLAS: NO
--
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.9)
-- Libraries: /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.9)
-- 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.2)
-- Libraries: /usr/lib/arm-linux-gnueabihf/libpython3.4m.so (ver 3.4.2)
-- numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.8.2)
-- packages path: lib/python3.4/dist-packages
--
-- 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/pi/opencv-3.1.0/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/opencv-3.1.0/build
A lot of these errors seem weird because I went through 1.5hrs of downloading and upgrading files specifically for this install (see tutorial
https://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/
It's for sure I downloaded Java but it says missing. And I downloaded a bunch of stuff for image file formats but it says bu it seems i'm missing basic videoio even just regular io!!! What's going on? I've gone ahead and did the make, will I be able to get these missing files into OpenCV later?
you need to work on virtual enviroment restart with
$ mkvirtualenv cv -p python2
i am tring to compile OpenCV on BeagleBone Black with CMake, but it can't find some libraries like gstream. I run cmake natively on BBB and it showed
that rootfs has gstream. how can i tell CMake to search in Correct path ?
My toolchane.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 4.4.9-ti-r25)
set(CMAKE_SYSTEM_PROCESSOR armv7l)
set(GCC_COMPILER_VERSION "4.7" CACHE STRING "GCC Compiler version")
####### Architecture ################
set(FLOAT_ABI_SUFFIX "hf")
set(ENABLE_NEON TRUE)
###### Link Compile Path ##############
set(ARM_SYS_ROOT_PATH /mnt/BBB)
set(ARM_STD_USR_PATH ${ARM_SYS_ROOT_PATH}/usr )
set(ARM_STD_LIB_PATH ${ARM_SYS_ROOT_PATH}/usr/lib )
set(ARM_SYS_LIB_PATH ${ARM_SYS_ROOT_PATH}/lib )
set(ARM_STD_INC_PATH ${ARM_SYS_ROOT_PATH}/usr/include )
set(GCC_MACHINE_DUMP arm-linux-gnueabihf)
set(CMAKE_INSTALL_PREFIX ${ARM_SYS_ROOT_PATH}/usr/local/OpenCV ) ## install Path
set(CMAKE_SYSROOT ${ARM_LINUX_SYSROOT})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) ##searchs in X/lib and X/usr/lib
set(CMAKE_INCLUDE_PATH ${ARM_STD_INC_PATH} ; ${ARM_STD_INC_PATH}/${GCC_MACHINE_DUMP} )
set(CMAKE_LIBRARY_PATH ${ARM_STD_LIB_PATH} ; ${ARM_STD_LIB_PATH}/${GCC_MACHINE_DUMP} ; ${ARM_SYS_LIB_PATH} ; ${ARM_SYS_LIB_PATH}/${GCC_MACHINE_DUMP})
set(CMAKE_PROGRAM_PATH ${ARM_SYS_ROOT_PATH}/usr/bin})
##### Install path ##############
set(CMAKE_INSTALL_PREFIX ${ARM_STD_USR_PATH})
##### Other ###########
set(CMAKE_COLOR_MAKEFILE ON)
set(PKG_CONFIG_EXECUTABLE /usr/bin/pkg-config)
################# Compiler ##########
set(CMAKE_C_COMPILER "/usr/gcc-linaro-arm-linux-gnueabihf-4.7/bin/arm-linux-gnueabihf-gcc")
set(CMAKE_CXX_COMPILER "/usr/gcc-linaro-arm-linux-gnueabihf-4.7/bin/arm-linux-gnueabihf-g++")
set(CMAKE_AR "/usr/gcc-linaro-arm-linux-gnueabihf-4.7/bin/arm-linux-gnueabihf-ar")
set(CMAKE_RANLIB "/usr/gcc-linaro-arm-linux-gnueabihf-4.7/bin/arm-linux-gnueabihf-ranlib")
set(CMAKE_LINKER "/usr/gcc-linaro-arm-linux-gnueabihf-4.7/bin/arm-linux-gnueabihf-ld")
### C and Cxx Flags ########################
set(DCMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "-isystem /mnt/BBB/lib:/mnt/BBB/lib/arm-linux-gnueabihf:/mnt/BBB/usr/lib/arm-linux-gnueabihf" CACHE STRING "c++ flags")
set(CMAKE_C_FLAGS "-isystem /mnt/BBB/lib:/mnt/BBB/lib/arm-linux-gnueabihf:/mnt/BBB/usr/lib/arm-linux-gnueabihf" CACHE STRING "c flags")
set(CMAKE_SHARED_LINKER_FLAGS "-isystem /mnt/BBB/lib:/mnt/BBB/lib/arm-linux-gnueabihf:/mnt/BBB/usr/lib/arm-linux-gnueabihf" CACHE STRING "shared linker flags")
set(CMAKE_MODULE_LINKER_FLAGS "-isystem /mnt/BBB/lib:/mnt/BBB/lib/arm-linux-gnueabihf:/mnt/BBB/usr/lib/arm-linux-gnueabihf" CACHE STRING "module linker flags")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,-rpath-link" CACHE STRING "executable linker flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthumb -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthumb -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now ${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now ${CMAKE_EXE_LINKER_FLAGS}")
########### Macro to Limit Find path in host and targert ###################
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Result of Cross Compile CMake
General configuration for OpenCV 2.4.11 =====================================
Version control: unknown
Platform:
Host: Linux 3.16.0-38-generic x86_64
Target: Linux 4.4.9-ti-r25 armv7l
CMake: 2.8.12.2
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: Release
C/C++:
Built as dynamic libs?: YES
C++ Compiler: /usr/gcc-linaro-arm-linux-gnueabihf-4.7/bin/arm-linux-gnueabihf-g++ (ver 4.7.3)
C++ flags (Release): -isystem /mnt/BBB/lib:/mnt/BBB/lib/arm-linux-gnueabihf:/mnt/BBB/usr/lib/arm-linux-gnueabihf -mthumb -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -isystem /mnt/BBB/lib:/mnt/BBB/lib/arm-linux-gnueabihf:/mnt/BBB/usr/lib/arm-linux-gnueabihf -mthumb -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/gcc-linaro-arm-linux-gnueabihf-4.7/bin/arm-linux-gnueabihf-gcc
C flags (Release): -isystem /mnt/BBB/lib:/mnt/BBB/lib/arm-linux-gnueabihf:/mnt/BBB/usr/lib/arm-linux-gnueabihf -mthumb -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -isystem /mnt/BBB/lib:/mnt/BBB/lib/arm-linux-gnueabihf:/mnt/BBB/usr/lib/arm-linux-gnueabihf -mthumb -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -isystem /mnt/BBB/lib:/mnt/BBB/lib/arm-linux-gnueabihf:/mnt/BBB/usr/lib/arm-linux-gnueabihf
Linker flags (Debug): -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -isystem /mnt/BBB/lib:/mnt/BBB/lib/arm-linux-gnueabihf:/mnt/BBB/usr/lib/arm-linux-gnueabihf
Precompiled headers: YES
OpenCV modules:
To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib stitching superres ts videostab
Disabled: world
Disabled by dependency: -
Unavailable: androidcamera dynamicuda java python viz
GUI:
QT: NO
GTK+ 2.x: YES (ver 2.24.23)
GThread : YES (ver 2.40.2)
GtkGlExt: NO
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: /mnt/BBB/usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
JPEG: /mnt/BBB/usr/lib/arm-linux-gnueabihf/libjpeg.so (ver )
PNG: /mnt/BBB/usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.2.50)
TIFF: /mnt/BBB/usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 - 4.0.3)
JPEG 2000: /mnt/BBB/usr/lib/arm-linux-gnueabihf/libjasper.so (ver 1.900.1)
OpenEXR: /mnt/BBB/usr/lib/arm-linux-gnueabihf/libImath.so /mnt/BBB/usr/lib/arm-linux-gnueabihf/libIlmImf.so /mnt/BBB/usr/lib/arm-linux-gnueabihf/libIex.so /mnt/BBB/usr/lib/arm-linux-gnueabihf/libHalf.so /mnt/BBB/usr/lib/arm-linux-gnueabihf/libIlmThread.so (ver 1.6.1)
Video I/O:
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES
codec: YES (ver 54.35.0)
format: YES (ver 54.20.4)
util: YES (ver 52.3.0)
swscale: YES (ver 2.1.1)
gentoo-style: YES
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
PvAPI: NO
GigEVisionSDK: NO
UniCap: NO
UniCap ucil: NO
V4L/V4L2: NO/YES
XIMEA: NO
Xine: NO
Other third-party libraries:
Use IPP: NO
Use Eigen: NO
Use TBB: NO
Use OpenMP: NO
Use GCD NO
Use Concurrency NO
Use C=: NO
Use Cuda: NO
Use OpenCL: YES
OpenCL:
Version: dynamic
Include path: /home/arash/Desktop/opencv-2.4.11/3rdparty/include/opencl/1.2
Use AMD FFT: NO
Use AMD BLAS: NO
Python:
Interpreter: /usr/bin/python2 (ver 2.7.6)
Java:
ant: NO
JNI: NO
Java tests: NO
Documentation:
Build Documentation: NO
Sphinx: NO
PdfLaTeX compiler: NO
Doxygen: NO
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: NO
Install path: /mnt/BBB/usr
cvconfig.h is in: /home/arash/Desktop/opencv-2.4.11/buildBBBnew
Result of Native CMake On BBB Target
-- General configuration for OpenCV 2.4.11 =====================================
-- Version control: unknown
--
-- Platform:
-- Host: Linux 4.4.9-ti-r25 armv7l
-- CMake: 3.4.1
-- 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 4.9.2)
-- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -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 -pthread -fomit-frame-pointer -ffunction-sections -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -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 -pthread -fomit-frame-pointer -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -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 -pthread -fomit-frame-pointer -ffunction-sections -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -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 -pthread -fomit-frame-pointer -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
-- Precompiled headers: YES
--
-- OpenCV modules:
-- To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib python stitching superres ts videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: androidcamera dynamicuda java viz
--
-- GUI:
-- QT: NO
-- GTK+ 2.x: YES (ver 2.24.25)
-- GThread : YES (ver 2.42.1)
-- GtkGlExt: NO
-- OpenGL support: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
-- JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver )
-- PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.2.50)
-- TIFF: /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 - 4.0.3)
-- JPEG 2000: /usr/lib/arm-linux-gnueabihf/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/arm-linux-gnueabihf/libImath.so /usr/lib/arm-linux-gnueabihf/libIlmImf.so /usr/lib/arm-linux-gnueabihf/libIex.so /usr/lib/arm-linux-gnueabihf/libHalf.so /usr/lib/arm-linux-gnueabihf/libIlmThread.so (ver 1.6.1)
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.3)
-- FFMPEG: YES
-- codec: YES (ver 56.1.0)
-- format: YES (ver 56.1.0)
-- util: YES (ver 54.3.0)
-- swscale: YES (ver 3.0.0)
-- gentoo-style: YES
-- GStreamer:
-- base: YES (ver 1.4.4)
-- video: YES (ver 1.4.4)
-- app: YES (ver 1.4.4)
-- riff: YES (ver 1.4.4)
-- pbutils: YES (ver 1.4.4)
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- UniCap: NO
-- UniCap ucil: NO
-- V4L/V4L2: Using libv4l1 (ver 1.6.0) / libv4l2 (ver 1.6.0)
-- XIMEA: NO
-- Xine: NO
--
-- Other third-party libraries:
-- Use IPP: NO
-- Use Eigen: NO
-- Use TBB: NO
-- Use OpenMP: NO
-- Use GCD NO /mnt/BBB/usr/lib/mnt/BBB/usr/lib/arm-linux-gnueabihf/mnt/BBB/lib/mnt/BBB/lib/arm-linux-gnueabihf
-- Use Concurrency NO
-- Use C=: NO
-- Use Cuda: NO
-- Use OpenCL: YES
--
-- OpenCL:
-- Version: dynamic
-- Include path: /home/debian/Desktop/opencv-2.4.11/3rdparty/include/opencl/1.2
-- Use AMD FFT: NO
-- Use AMD BLAS: NO
--
-- Python:
-- Interpreter: /usr/bin/python2 (ver 2.7.9)
-- Libraries: /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.9)
-- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.8.2)
-- packages path: lib/python2.7/dist-packages
--
-- Java:
-- ant: NO
-- JNI: NO
-- Java tests: NO
--
-- Documentation:
-- Build Documentation: NO
-- Sphinx: NO
-- PdfLaTeX compiler: NO
-- Doxygen: NO
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: NO
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/debian/Desktop/opencv-2.4.11/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/debian/Desktop/opencv-2.4.11/build
Thanks to #Tsyvarev, The problem was pkg-config. in host i have:
myPC:~$ pkg-config --libs gstreamer-1.0
Package gstreamer-1.0 was not found in the pkg-config search path.
but in target BeagleBone :
beaglebone:~# pkg-config --modversion gstreamer-1.0
1.4.4
and the path for .pc files in target are :
beaglebone:~# pkg-config --variable pc_path pkg-config
/usr/local/lib/arm-linux-gnueabihf/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
[Wrong Way !]
so i simply added these path with prefix of /mnt/BBB (my target rootfs) to pkg-config environment of host and run cmake, everything well recognized :
myPC:~$ export PKG_CONFIG_PATH=/mnt/BBB/usr/local/lib/arm-linux-gnueabihf/pkgconfig:/mnt/BBB/usr/local/lib/pkgconfig:/mnt/BBB/usr/local/share/pkgconfig:/mnt/BBB/usr/lib/arm-linux-gnueabihf/pkgconfig:/mnt/BBB/usr/lib/pkgconfig:/mnt/BBB/usr/share/pkgconfig
myPC:~$ cmake-gui
[Edited: Correct way]
According to This link, i need to create pkg-config wrapper script.
in my toolchain Directory i have arm-linux-gnueabihf-pkg-config-real and then i should modify its script to this:
#!/bin/sh
#
# Wrapper script that calls the real pkg-config with the relocated
# sysroot location
#
set -e
GCC="${0%%-pkg-config}-gcc"
MACHINE=`"$GCC" -dumpmachine`
SYSROOT=`"$GCC" -print-sysroot`
SYSROOT=/mnt/BBB #My modification
export PKG_CONFIG_DIR=
export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/lib/${MACHINE}/pkgconfig":"${SYSROOT}/usr/lib/pkgconfig":"${SYSROOT}/usr/share/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="${SYSROOT}"
exec "$0-real" "$#"
then set this script path in toolchain.cmake
set(PKG_CONFIG_EXECUTABLE /usr/gcc-linaro-arm-linux-gnueabihf-4.7/bin/arm-linux-gnueabihf-pkg-config)
and everything works fine ...
I am using an OpenSUSE 13.2-X86-64 and a Geforce 940M GPU. I want to work with it on the Qt5 IDE.
For this purpose, i have installed my GPU Driver with the Cuda7.5 toolkit rpm from the cudazone. Everything is nearly fine.
It detects everything I have made and executed a couple of the cuda samples.
As next step, i have installed the current FFmpeg version with nvenc and other libraries like Xvid and many of
the other usefull stuff which would be to much to list it here. After that i have downloaded the current
OpenCV-3.0.0 source code and ran cmake-gui where i have added cuda, ffmpeg, Qt5 etc and maked it.
On different points of the make session (make -j4) i get this kind of mistake from my console (The list of the Multiple definition
error is much longer). This is the first one.
.
.
.
.
.
.
nvlink error : Multiple definition of '_ZN2cv5cudev16color_cvt_detail15c_HlsSectorDataE' in '/home/peter/Programme/opencv/build/modules/cudev/test/CMakeFiles/opencv_test_cudev.dir//./opencv_test_cudev_generated_test_arithm_func.cu.o', first defined in '/home/peter/Programme/opencv/build/modules/cudev/test/CMakeFiles/opencv_test_cudev.dir//./opencv_test_cudev_generated_test_lut.cu.o'
nvlink error : Multiple definition of '_ZN2cv5cudev16color_cvt_detail16c_sRGBGammaTab_bE' in '/home/peter/Programme/opencv/build/modules/cudev/test/CMakeFiles/opencv_test_cudev.dir//./opencv_test_cudev_generated_test_arithm_func.cu.o', first defined in '/home/peter/Programme/opencv/build/modules/cudev/test/CMakeFiles/opencv_test_cudev.dir//./opencv_test_cudev_generated_test_lut.cu.o'
nvlink error : Multiple definition of '_ZN2cv5cudev16color_cvt_detail14c_sRGBGammaTabE' in '/home/peter/Programme/opencv/build/modules/cudev/test/CMakeFiles/opencv_test_cudev.dir//./opencv_test_cudev_generated_test_arithm_func.cu.o', first defined in '/home/peter/Programme/opencv/build/modules/cudev/test/CMakeFiles/opencv_test_cudev.dir//./opencv_test_cudev_generated_test_lut.cu.o'
nvlink error : Multiple definition of '_ZN2cv5cudev16color_cvt_detail17c_sRGBInvGammaTabE' in '/home/peter/Programme/opencv/build/modules/cudev/test/CMakeFiles/opencv_test_cudev.dir//./opencv_test_cudev_generated_test_arithm_func.cu.o', first defined in '/home/peter/Programme/opencv/build/modules/cudev/test/CMakeFiles/opencv_test_cudev.dir//./opencv_test_cudev_generated_test_lut.cu.o'
nvlink error : Multiple definition of '_ZN2cv5cudev16color_cvt_detail12c_LabCbrtTabE' in '/home/peter/Programme/opencv/build/modules/cudev/test/CMakeFiles/opencv_test_cudev.dir//./opencv_test_cudev_generated_test_arithm_func.cu.o', first defined in '/home/peter/Programme/opencv/build/modules/cudev/test/CMakeFiles/opencv_test_cudev.dir//./opencv_test_cudev_generated_test_lut.cu.o'
modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/build.make:5302: recipe for target 'modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/./opencv_test_cudev_intermediate_link.o' failed
make[2]: *** [modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/./opencv_test_cudev_intermediate_link.o] Error 255
CMakeFiles/Makefile2:1182: recipe for target 'modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/all' failed
make[1]: *** [modules/cudev/test/CMakeFiles/opencv_test_cudev.dir/all] Error 2
Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2
And I have no idea how to fix that.
Thx!
Edit: added cmake configuration
~/Programme/opencv/build> cmake /home/peter/Programme/opencv-3.0.0
CMake Error: The source "/home/peter/Programme/opencv-3.0.0/CMakeLists.txt" does not match the source "/home/peter/Programme/opencv/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.
peter#linux-3mgc:~/Programme/opencv/build> cmake /home/peter/Programme/opencv
-- Detected version of GNU GCC: 48 (408)
-- Found ZLIB: /usr/lib64/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.8")
-- 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
-- found IPP (ICV version): 8.2.1 [8.2.1]
-- at: /home/peter/Programme/opencv/3rdparty/ippicv/unpack/ippicv_lnx
-- CUDA detected: 7.5
-- CUDA NVCC target flags: -gencode;arch=compute_50,code=sm_50
-- 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.8", minimum required is "2.7")
-- Found PythonLibs: /usr/lib64/libpython2.7.so (found suitable exact version "2.7.8")
-- Found PythonInterp: /usr/bin/python3.4 (found suitable version "3.4.1", minimum required is "3.4")
-- Found PythonLibs: /usr/lib64/libpython3.4m.so (found suitable exact version "3.4.1")
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'numpy'
-- Found apache ant 1.8.0: /usr/bin/ant
-- Could NOT find JNI (missing: 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 support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.6.1.0 + Qt4
--
-- General configuration for OpenCV 3.0.0-dev =====================================
-- Version control: 3.0.0-528-g3a3f403-dirty
--
-- Platform:
-- Host: Linux 3.16.7-24-desktop x86_64
-- CMake: 3.0.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/gmake
-- Configuration: Release
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/bin/c++ (ver 4.8.3)
-- 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 -fopenmp -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 -fopenmp -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 -fopenmp -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 -fopenmp -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
-- Precompiled headers: YES
-- Extra dependencies: /usr/lib64/libcuda.so /usr/lib64/libnvcuvid.so Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent Qt5::OpenGL /usr/lib64/libwebp.so /usr/lib64/libpng.so /usr/lib64/libz.so /usr/lib64/libtiff.so /usr/lib64/libjasper.so /usr/lib64/libjpeg.so gstbase-0.10 gstreamer-0.10 gobject-2.0 gmodule-2.0 gthread-2.0 xml2 ucil glib-2.0 unicap dc1394 xine v4l1 v4l2 avcodec avformat avutil swscale gphoto2 gphoto2_port exif /usr/lib64/libbz2.so dl m pthread rt /usr/lib64/libGLU.so /usr/lib64/libGL.so /usr/lib64/libSM.so /usr/lib64/libICE.so /usr/lib64/libX11.so /usr/lib64/libXext.so cudart nppc nppi npps cublas cufft
-- 3rdparty dependencies: IlmImf ippicv
--
-- OpenCV modules:
-- To be built: cudev hal core cudaarithm flann imgproc ml video cudabgsegm cudafilters cudaimgproc cudawarping imgcodecs photo shape videoio cudacodec highgui objdetect ts features2d calib3d cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo stitching superres videostab python2
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: java python3 viz
--
-- GUI:
-- QT 5.x: YES (ver 5.4.2)
-- QT OpenGL support: YES (Qt5::OpenGL 5.4.2)
-- OpenGL support: YES (/usr/lib64/libGLU.so /usr/lib64/libGL.so /usr/lib64/libSM.so /usr/lib64/libICE.so /usr/lib64/libX11.so /usr/lib64/libXext.so)
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib64/libz.so (ver 1.2.8)
-- JPEG: /usr/lib64/libjpeg.so (ver )
-- WEBP: /usr/lib64/libwebp.so (ver encoder: 0x0202)
-- PNG: /usr/lib64/libpng.so (ver 1.2.51)
-- TIFF: /usr/lib64/libtiff.so (ver 42 - 4.0.4)
-- JPEG 2000: /usr/lib64/libjasper.so (ver 1.900.1)
-- OpenEXR: build (ver 1.7.1)
-- GDAL: NO
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.2)
-- FFMPEG: YES
-- codec: YES (ver 57.3.100)
-- format: YES (ver 57.2.100)
-- util: YES (ver 55.2.100)
-- swscale: YES (ver 4.0.100)
-- resample: NO
-- gentoo-style: YES
-- GStreamer: NO
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- OpenNI2: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- UniCap: YES (ver 0.9.12)
-- UniCap ucil: YES (ver 0.9.10)
-- V4L/V4L2: Using libv4l1 (ver 1.2.1) / libv4l2 (ver 1.2.1)
-- XIMEA: NO
-- Xine: YES (ver 1.2.6)
-- gPhoto2: YES
--
-- Parallel framework: OpenMP
--
-- Other third-party libraries:
-- Use IPP: 8.2.1 [8.2.1]
-- at: /home/peter/Programme/opencv/3rdparty/ippicv/unpack/ippicv_lnx
-- Use IPP Async: NO
-- Use VA: NO
-- Use Intel VA-API/OpenCL: NO
-- Use Eigen: YES (ver 3.2.2)
-- Use Cuda: YES (ver 7.5)
-- Use OpenCL: YES
--
-- NVIDIA CUDA
-- Use CUFFT: YES
-- Use CUBLAS: YES
-- USE NVCUVID: YES
-- NVIDIA GPU arch: 50
-- NVIDIA PTX archs:
-- Use fast math: YES
--
-- OpenCL:
-- Version: dynamic
-- Include path: /home/peter/Programme/opencv/3rdparty/include/opencl/1.2
-- Use AMDFFT: NO
-- Use AMDBLAS: NO
--
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.8)
-- Libraries: /usr/lib64/libpython2.7.so (ver 2.7.8)
-- numpy: /usr/lib64/python2.7/site-packages/numpy/core/include (ver 1.9.0)
-- packages path: lib/python2.7/site-packages
--
-- Python 3:
-- Interpreter: /usr/bin/python3.4 (ver 3.4.1)
--
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: /usr/bin/ant (ver 1.8.0)
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Matlab:
-- mex: NO
--
-- Documentation:
-- Doxygen: /usr/bin/doxygen (ver 1.8.8)
-- PlantUML: NO
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: NO
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/peter/Programme/opencv/build
--
-----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/peter/Programme/opencv/build
So after trying and trying again i have solved the problem on a different way. I stepped back from opencv3 to 2.4.11, i stepped back from the latest ffmpeg (this solved a lot of issues). Another problem was that an installed openv-2.4.9 version always wanted to be used and not my cuda compiled libraries. I am not a guy who wants to read in cmakefiles. OpenCV has a whole bunch of that so more than the cmake would definitly a big land of confusion for me.
Nevertheless i have solved my issues. Not with OpenCV3 but with opencv-2.4.11, Cuda-5.0 and which would be enough for my purposes. To get run this combination i wrote some shell scripts to feed back my self and analyse for issues. This file you should run as superuser and replace the name of the user of course or install the files maybe in your custom system.
-- Please not that you maybe have to restart bumbleed daemon,to use mkinitrd and to reboot another time. The second forced installation was done because of the instruction like here --> https://en.opensuse.org/SDB:NVIDIA_Bumblebee
in the endsection. It is proposed if you want to use cuda development.
After this you have to reboot to get it done.
mkdir /home/peter/programs
cd /home/peter/programs
# 3rd part library and qt library packages installed. Not even sure that everyone is needed
zypper --non-interactive in gcc git libwebp-devel vtk vtk-devel eigen3-devel libeigen2-devel python-numpy-devel python python3-numpy python3-numpy-devel ant java-1_7_0-openjdk-devel java-1_7_0-openjdk-src python-Sphinx openexr openexr-devel libpng12-devel openjpeg openjpeg-devel tiff jasper libjasper-devel pbzip2 python3-cairo python3-cairo-devel ilmbase-devel cmake-gui gtk2-devel libdc1394 libdc1394-devel libv4l-devel libxine-devel gstreamer-0_10-devel gstreamer-devel openmpi openmpi-devel openmpi-libs VirtualGL-devel Mesa-libGLESv3-devel ftgl-devel glew glproto-devel gltt gltt-devel gtkglext-devel libGLw1 libftgl2 libglfw-devel libgltf-devel python-opengl gluegen2 gluegen2-devel libjnidispatch gphoto libgphoto2-devel libunicap2 libunicap-devel libucil-devel libucil2 zypper libbz2-devel doxygen jna zypper libQt5Bluetooth5 libQt5Bootstrap-devel-static libQt5Concurrent-devel libQt5Concurrent5 libQt5Core-devel libQt5Core-private-headers-devel libQt5Designer5 libQt5DesignerComponents5 libQt5Gui-devel libQt5Gui-private-headers-devel libQt5Help5 libQt5Network-devel libQt5Network-private-headers-devel libQt5Network5 libQt5OpenGL-devel libQt5OpenGL-private-headers-devel libQt5OpenGL5 libQt5OpenGLExtensions-devel-static libQt5PlatformHeaders-devel libQt5PlatformSupport-devel-static libQt5PlatformSupport-private-headers-devel libQt5Widgets-devel libqt5-creator libqt5-qtdoc libqt5-qttools libqt5-qttools-devel python-qt5 python-qt5-devel python-qt5-utils freetype freetype-devel freetype2-devel dpic libvpx1 libvpx-devel nasm yasm libopus-devel autoconf automake libass-devel libfreetype6 libSDL-devel libSDL2-devel libtheora-devel libtool libva1 libva-devel libtool libvdpau-devel libvorbis-devel libxcb-devel libxcb-shm0 libxcb-xfixes0 pkg-config latex2html zlib zlib-devel
# downloading and preparing libs that should be installed form the scratch
wget http://developer.download.nvidia.com/compute/cuda/repos/opensuse132/x86_64/cuda-repo-opensuse132-7.5-18.x86_64.rpm
mkdir SDK
cd SDK
wget http://developer.download.nvidia.com/compute/nvenc/v5.0/nvenc_5.0.1_sdk.zip -O nvenc-sdk.zip
unzip nvenc-sdk.zip
cd nvenc_5.0.1_sdk
cd /home/peter/programs
wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xjvf last_x264.tar.bz2
wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
unzip fdk-aac.zip
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
wget http://downloads.xvid.org/downloads/xvidcore-1.3.4.tar.gz
tar xzvf xvidcore-1.3.4.tar.gz
wget http://ffmpeg.org/releases/ffmpeg-2.6.1.tar.bz2
tar xjvf ffmpeg-2.6.1.tar.bz2
wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.11/opencv-2.4.11.zip/download --output-document=opencv.zip
unzip opencv.zip
cd opencv-2.4.11
mkdir build
cd /home/peter/programs
rpm -i cuda-repo-opensuse132-7.5-18.x86_64.rpm
zypper --gpg-auto-import-keys refresh
zypper addrepo http://download.opensuse.org/repositories/X11:Bumblebee/openSUSE_13.2/X11:Bumblebee.repo
zypper --gpg-auto-import-keys refresh
zypper --non-interactive --gpg-auto-import-keys in bumblebee
usermod -G video,bumblebee peter
systemctl enable bumblebeed
mkinitrd
zypper --gpg-auto-import-keys --non-interactive in cuda
systemctl enable dkms
zypper --non-interactive in nvidia-bumblebee-32bit
zypper --gpg-auto-import-keys --non-interactive in cuda
zypper --non-interactive in cuda-gdb-src-7-5
zypper --gpg-auto-import-keys --non-interactive in -f nvidia-bumblebee
cd /etc/ld.so.conf.d
echo -e "/usr/local/cuda-7.5/lib64" > cudald.conf
ldconfig
cd /home/peter
echo -e "export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH\nexport PATH=/usr/local/cuda-7.5/bin:$PATH" >> .bashrc
chmod 777 -R programs
reboot
I am not sure whether it is a source of issues but after rebooting you maybe open a new shell and run this file. Again don't forget to customize the shell script. Before starting you should extend your sudo session or run it as superuser again.
Remove any other opencv-libs that maybe comes with the rpms. Then you can start this snippet to install it.
-- Note the optirun commands are needed at the end to have at all steps the correct architecture. The configuration sometimes restarts with make or make install. To keep the configuration let it run with optimus.
cd /home/peter/programs/SDK/nvenc_5.0.1_sdk
sudo cp Samples/common/inc/* /usr/include/
cd /home/peter/programs/x264-snapshot*
./configure --enable-static --enable-shared --enable-pic
make
sudo make install
make distclean
cd /home/peter/programs/mstorsjo-fdk-aac*
autoreconf -fiv
./configure
make
sudo make install
make distclean
cd /home/peter/programs/lame-3.99.5
./configure --enable-nasm
make
sudo make install
make distclean
cd /home/peter/programs/xvidcore/build/generic
./configure
make
sudo make install
make distclean
cd /home/peter/programs/ffmpeg-2.6.1
./configure \
--enable-shared \
--enable-gpl \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libxvid \
--enable-nonfree \
--enable-nvenc
make -j8
sudo make install
make distclean
hash -r
echo "Complete!"
cd /home/peter/programs/opencv-2.4.11/build
optirun cmake -D BUILD_EXAMPLES:BOOL=TRUE -D CUDA_ARCH_BIN:STRING=5.0 -D CUDA_ARCH_PTX:STRING=5.0 -D CUDA_BUILD_CUBIN:BOOL=TRUE -D CUDA_FAST_MATH:BOOL=TRUE -D CUDA_GENERATION:STRING=Auto -D INSTALL_C_EXAMPLES:BOOL=TRUE -D INSTALL_PYTHON_EXAMPLES:BOOL=TRUE -D WITH_CUDA:BOOL=ON -D INSTALL_TESTS:BOOL=TRUE -D WITH_CUBLAS:BOOL=TRUE -D WITH_NVCUVID:BOOL=TRUE -D WITH_OPENCLAMDBLAS:BOOL=FALSE -D WITH_OPENCLAMDFFT:BOOL=FALSE -D WITH_OPENGL:BOOL=TRUE -D WITH_UNICAP:BOOL=TRUE -D WITH_XINE:BOOL=TRUE -D WITH_QT:BOOL=TRUE -D CUDA_nvcuvid_LIBRARY:FILEPATH=/usr/lib64/libnvcuvid.so.1 /home/peter/programs/opencv-2.4.11/
optirun make -j8
sudo optirun make install
With starting qtcreator with optirun iyou should be able to compile and run opencv_gpu files like every other opencv program.
Thx peter
I am trying to install OpenCV 2.4.2 on Ubuntu and am running into errors as below:
[ 11%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_gtk.cpp.o
In file included from /usr/local/include/glib-2.0/glib/gasyncqueue.h:30:0,
from /usr/local/include/glib-2.0/glib.h:32,
from /usr/local/include/gtk-2.0/gdk/gdktypes.h:32,
from /usr/local/include/gtk-2.0/gdk/gdkcolor.h:4,
from /usr/local/include/gtk-2.0/gdk/gdk.h:30,
from /usr/local/include/gtk-2.0/gtk/gtk.h:31,
from /opt/opencv/OpenCV-2.4.2/modules/highgui/src/window_gtk.cpp:48:
/usr/local/include/glib-2.0/glib/gthread.h:233:27: error: variable or field 'g_static_mutex_init' declared void
/usr/local/include/glib-2.0/glib/gthread.h:233:27: error: 'GStaticMutex' was not declared in this scope
/usr/local/include/glib-2.0/glib/gthread.h:233:41: error: 'mutex' was not declared in this scope
/usr/local/include/glib-2.0/glib/gthread.h:233:41: note: suggested alternative:
/usr/include/tbb/mutex.h:48:7: note: 'tbb::mutex'
I checked all dependencies and installed them as below:
sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev
I also added the following paths to CMakeCache.txt
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG -I/usr/lib/x86_64-linux-gnu/glib-2.0/include/ -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include/
Any help is appreciated.
Thanks,
Sid
Edit : I switched to QT as per comment and that allowed me to get rid of the gtk include that I had to manually insert into CMakeCache.txt. But I was still getting an installation error (maybe due to the glib include) so I turned GSTREAMER off in CMAKE and now I am able to install opencv. Is this work around feasible?
Curious that you need v2.4.2 when v2.4.9 is the latest release. In any case when following the build steps a configuration report is output before the make step that looks like:
--
-- General configuration for OpenCV 2.4.2 =====================================
--
-- Platform:
-- Host: Linux 3.8.0-29-generic x86_64
-- CMake: 2.8.7
-- 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 4.6.3)
-- C++ flags (Release): -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -ffunction-sections -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG -ggdb3
-- C Compiler: /usr/bin/gcc
-- C flags (Release): -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -ffunction-sections -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG -ggdb3
-- Linker flags (Release):
-- Linker flags (Debug):
-- Precompiled headers: NO
--
-- OpenCV modules:
-- To be built: core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree gpu legacy photo python stitching ts videostab
-- Disabled: -
-- Disabled by dependency: -
-- Unavailable: androidcamera java world
--
-- GUI:
-- QT 4.x: NO
-- GTK+ 2.x: YES (ver 2.24.10)
-- GThread : YES (ver 2.32.4)
-- GtkGlExt: NO
-- OpenGL support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.3.4)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.46)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 3.9.5)
-- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/libImath.so /usr/lib/libIlmImf.so /usr/lib/libIex.so /usr/lib/libHalf.so /usr/lib/libIlmThread.so (ver 1.6.1)
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.0)
-- FFMPEG: YES
-- codec: YES (ver 53.35.0)
-- format: YES (ver 53.21.1)
-- util: YES (ver 51.22.2)
-- swscale: YES (ver 2.1.0)
-- gentoo-style: YES
-- GStreamer: NO
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- PvAPI: NO
-- UniCap: NO
-- UniCap ucil: NO
-- V4L/V4L2: Using libv4l (ver 0.8.6)
-- XIMEA: NO
-- Xine: NO
--
-- Other third-party libraries:
-- Use IPP: NO
-- Use TBB: NO
-- Use Cuda: NO
-- Use Eigen: YES (ver 2.0.17)
--
-- Python:
-- Interpreter: /usr/bin/python (ver 2.7.3)
-- Libraries: /usr/lib/libpython2.7.so
-- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.6.1)
-- packages path: lib/python2.7/dist-packages
--
-- Documentation:
-- Build Documentation: YES
-- Sphinx: /usr/bin/sphinx-build (ver 1.1.3)
-- PdfLaTeX compiler: /usr/bin/pdflatex
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- Examples: NO
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/vagrant/OpenCV-2.4.2/release
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vagrant/OpenCV-2.4.2/release
Check this report for any missing libraries and install those dependencies.
I was able to build from source and get past your error on ubuntu 12.04 installing the dependencies you listed:
...
[ 13%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.cpp.o
[ 13%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_gtk.cpp.o
[ 13%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_dc1394_v2.cpp.o
[ 13%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_libv4l.cpp.o
[ 14%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_sunras.cpp.o
[ 14%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_pxm.cpp.o
[ 14%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg2000.cpp.o
[ 14%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_exr.cpp.o
[ 14%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_imageio.cpp.o
[ 15%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg.cpp.o
[ 15%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_base.cpp.o
[ 15%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_png.cpp.o
[ 15%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_bmp.cpp.o
[ 15%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_tiff.cpp.o
[ 15%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/bitstrm.cpp.o
Linking CXX shared library ../../lib/libopencv_highgui.so
...
Unless you need some specific compilation options, you should be able to install OpenCV right from Synaptic (version 2.3.1); the libraries are already in the default repository.
If you need a newer version, you should also be able to find some PPAs with OpenCV precompiled, such as https://launchpad.net/~yjwong/+archive/opencv2 or https://launchpad.net/~limparissoft/+archive/opencv-ppa
You can find more PPAs in https://launchpad.net/ubuntu/+ppas?name_filter=opencv