Cmake cross compile cant find library - opencv

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 ...

Related

Installing OpenCV 3.2.0 with contrib modules in Ubuntu 14.04 LTS

The following command runs but ends with "incomplete configuring" instead of "completed configuring".
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON .. -DCMAKE_BUILD_TYPE=RELEASE -DOPENCV_EXTRA_MODULES_PATH=/home/venkatesh/opencv/opencv_contrib-3.2.0/modules ..
A few experts have given answers (not working in this case)i.e,
1. set the path for DOPENCV_EXTRA_MODULES_PATH.
2. Set "INSTALL_C_EXAMPLES" value to "OFF" instead of "ON" in cmake command.
3. Clean the build directory and create it again and run cmake command.
These three are also not working in this case.
I am getting the following stuff when I run cmake command.
-- Found VTK ver. 5.8.0 (usefile: /usr/lib/vtk-5.8/UseVTK.cmake)
CMake Error at CMakeLists.txt:706 (add_subdirectory):
add_subdirectory given source "include" which is not an existing directory.
CMake Error at CMakeLists.txt:709 (add_subdirectory):
add_subdirectory given source "modules" which is not an existing directory.
CMake Error at CMakeLists.txt:712 (add_subdirectory):
add_subdirectory given source "doc" which is not an existing directory.
CMake Error at CMakeLists.txt:724 (add_subdirectory):
add_subdirectory given source "samples" which is not an existing directory.
--
-- General configuration for OpenCV .. =====================================
-- Version control: unknown
--
-- Extra modules:
-- Location (extra): /home/venkatesh/opencv/opencv_contrib-3.2.0/modules
-- Version control (extra): unknown
--
-- Platform:
-- Timestamp: 2017-11-17T05:51:01Z
-- Host: Linux 4.4.0-100-generic x86_64
-- 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/bin/c++ (ver 4.8.4)
-- 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 -Wno-comment -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 -Wno-comment -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 -Wno-comment -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 -Wno-comment -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):
-- ccache: NO
-- Precompiled headers: YES
-- Extra dependencies:
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: -
-- Disabled: -
-- Disabled by dependency: -
-- Unavailable: -
--
-- GUI:
-- QT 4.x: YES (ver 4.8.6 EDITION = OpenSource)
-- QT OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so)
-- OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so)
-- VTK support: YES (ver 5.8.0)
--
-- 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.50)
-- 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 1.6.1)
-- GDAL: NO
-- GDCM: NO
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.1)
-- FFMPEG: YES
-- avcodec: YES (ver 54.35.1)
-- avformat: YES (ver 54.20.4)
-- avutil: YES (ver 52.3.0)
-- swscale: YES (ver 2.1.1)
-- avresample: NO
-- GStreamer: NO
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- OpenNI2: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- Aravis SDK: NO
-- UniCap: NO
-- UniCap ucil: NO
-- V4L/V4L2: NO/YES
-- XIMEA: NO
-- Xine: NO
-- gPhoto2: NO
--
-- Parallel framework: TBB (ver 4.2 interface 7000)
--
-- Other third-party libraries:
-- Use IPP: 9.0.1 [9.0.1]
-- at: /home/venkatesh/opencv/opencv-3.2.0/build/3rdparty/ippicv/ippicv_lnx
-- Use IPP Async: NO
-- Use VA: NO
-- Use Intel VA-API/OpenCL: NO
-- Use Lapack: NO
-- Use Eigen: YES (ver 3.2.0)
-- Use Cuda: NO
-- Use OpenCL: YES
-- Use OpenVX: NO
-- Use custom HAL: NO
--
-- OpenCL: <Dynamic loading of OpenCL library>
-- Include path: /home/venkatesh/opencv/opencv-3.2.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: /usr/bin/ant (ver 1.9.3)
-- JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include
-- Java wrappers: NO
-- Java tests: NO
--
-- Matlab: Matlab not found or implicitly disabled
--
-- Documentation:
-- Doxygen: NO
--
-- Tests and samples:
-- Tests: NO
-- Performance tests: NO
-- C/C++ Examples: YES
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/venkatesh/opencv/opencv-3.2.0/build
-- -----------------------------------------------------------------
--
-- Configuring incomplete, errors occurred!
See also "/home/venkatesh/opencv/opencv-3.2.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/venkatesh/opencv/opencv-3.2.0/build/CMakeFiles/CMakeError.log".
I owe you a lot if anyone can post the answer for this problem.
Thank you.
-DOPENCV_EXTRA_MODULES_PATH=/home/venkatesh/opencv/opencv_contrib-3.2.0/modules
has space between -D and OPENCV_
and please check instead with:
-D OPENCV_EXTRA_MODULES_PATH=/home/venkatesh/opencv_contrib-3.2.0/modules /home/venkatesh/opencv/
and the last thing is this will only work if
/home/venkatesh is the directory having opencv and opencv_contrib-3.2.0 files
You are in a directory in /home/venkatesh/opencv/<directory_name>
commonly the directory names people give is build or release.
I wanted to comment but am somehow unable to recover my account. So I do not have enough reputations to comment.

Build of OpenCV getting errors, are these serious?

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

make error in OpenCV installation on ubuntu (ffmpeg CODEC_ID_XXXX was not declared in scope)

I am trying to install OpenCV following this tutorial. I am through cmake.(The configuration is given at the end.) However make shows error :make[2]: ***[modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o] Error 1
One link pointed out reason as different version of opencv and ffmpeg, but I found a piece of code in cap_ffmpeg_impl.hpp that appears to be handling it.
#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54,25,0)
# define CV_CODEC_ID AVCodecID
# define CV_CODEC(name) AV_##name
#else
# define CV_CODEC_ID CodecID
# define CV_CODEC(name) name
#endif
Not sure if it is ok for this to be commented.
Also, I could try installing ffmpeg seperately, but I am not sure how dependencies are handled in this installation around libav.
Would be thankful for any help in solving this problem, as well as tips/links for OpenCV installation in general.
make configuration:
-- General configuration for OpenCV 2.4.11 ====================================
Version control: unknown
--
-- Platform:
-- Host: Linux 3.16.0-32-generic i686
-- 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/bin/c++ (ver 4.9.1)
-- 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 -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -ffunction-sections -O2 -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 -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -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 -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -ffunction-sections -O2 -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 -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -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 java python stitching superres ts videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: androidcamera dynamicuda viz
--
-- GUI:
-- QT 5.x: YES (ver 5.3.0)
-- QT OpenGL support: YES (Qt5::OpenGL 5.3.0)
-- OpenGL support: YES (/usr/lib/i386-linux-gnu/libGLU.so /usr/lib/i386-linux-gnu/libGL.so /usr/lib/i386-linux-gnu/libSM.so /usr/lib/i386-linux-gnu/libICE.so /usr/lib/i386-linux-gnu/libX11.so /usr/lib/i386-linux-gnu/libXext.so)
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/i386-linux-gnu/libz.so (ver 1.2.8)
-- JPEG: /usr/lib/i386-linux-gnu/libjpeg.so (ver )
-- PNG: /usr/lib/i386-linux-gnu/libpng.so (ver 1.2.51)
-- TIFF: /usr/lib/i386-linux-gnu/libtiff.so (ver 42 - 4.0.3)
-- JPEG 2000: /usr/lib/i386-linux-gnu/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/i386-linux-gnu/libImath.so /usr/lib/i386-linux-gnu/libIlmImf.so /usr/lib/i386-linux-gnu/libIex.so /usr/lib/i386-linux-gnu/libHalf.so /usr/lib/i386-linux-gnu/libIlmThread.so (ver 1.6.1)
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.1)
-- 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: NO
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- UniCap: NO
-- UniCap ucil: NO
-- V4L/V4L2: Using libv4l1 (ver 1.2.1) / libv4l2 (ver 1.2.1)
-- XIMEA: NO
-- Xine: NO
--
-- Other third-party libraries:
-- Use IPP: NO
-- Use Eigen: YES (ver 3.2.1)
-- Use TBB: YES (ver 4.2 interface 7000)
-- Use OpenMP: NO
-- Use GCD NO
-- Use Concurrency NO
-- Use C=: NO
-- Use Cuda: NO
-- Use OpenCL: YES
--
-- OpenCL:
-- Version: dynamic
-- Include path: /home/keeda/Downloads/data_analysis/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.8)
-- Libraries: /usr/lib/i386-linux-gnu/libpython2.7.so (ver 2.7.8)
-- numpy: /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.9.1)
-- packages path: lib/python2.7/dist-packages
--
-- Java:
-- ant: /usr/bin/ant (ver 1.9.4)
-- JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include
-- Java tests: YES
--
-- Documentation:
-- Build Documentation: YES
-- Sphinx: /usr/bin/sphinx-build (ver 1.2.2)
-- PdfLaTeX compiler: /usr/bin/pdflatex
-- Doxygen: NO
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: YES
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/keeda/Downloads/data_analysis/opencv-2.4.11/build
-- -----------------------------------------------------------------

OpenCV installation in Ubuntu

I am trying to install OpenCV in Xubuntu 4.10. I have tried every possible ways I could find on the web. I have updated my ubuntu and installed all dependencies specified in official documentation. But I keep getting this error message while executing make command.
/home/bipin/Desktop/opencv/opencv-2.4.10/modules/core/src/system.cpp: In function ‘(static initializers for /home/bipin/Desktop/opencv/opencv-2.4.10/modules/core/src/system.cpp)’:
/home/bipin/Desktop/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
Here `-- General configuration for OpenCV 2.4.10
=====================================
-- Version control: unknown
--
-- Platform:
-- Host: Linux 3.13.0-45-generic i686
-- 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/bin/c++ (ver 4.8.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 -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -ffunction-sections -O2 -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 -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -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 -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -ffunction-sections -O2 -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 -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -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 java python stitching superres ts videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: androidcamera dynamicuda viz
--
-- GUI:
-- QT 5.x: YES (ver 5.2.1)
-- QT OpenGL support: YES (Qt5::OpenGL 5.2.1)
-- OpenGL support: YES (/usr/lib/i386-linux-gnu/libGLU.so /usr/lib/i386-linux-gnu/libGL.so /usr/lib/i386-linux-gnu/libSM.so /usr/lib/i386-linux-gnu/libICE.so /usr/lib/i386-linux-gnu/libX11.so /usr/lib/i386-linux-gnu/libXext.so)
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/i386-linux-gnu/libz.so (ver 1.2.8)
-- JPEG: /usr/lib/i386-linux-gnu/libjpeg.so (ver )
-- PNG: /usr/lib/i386-linux-gnu/libpng.so (ver 1.2.50)
-- TIFF: /usr/lib/i386-linux-gnu/libtiff.so (ver 42 - 4.0.3)
-- JPEG 2000: /usr/lib/i386-linux-gnu/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/i386-linux-gnu/libImath.so /usr/lib/i386-linux-gnu/libIlmImf.so /usr/lib/i386-linux-gnu/libIex.so /usr/lib/i386-linux-gnu/libHalf.so /usr/lib/i386-linux-gnu/libIlmThread.so (ver 1.6.1)
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.1)
-- 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:
-- base: YES (ver 0.10.36)
-- video: YES (ver 0.10.36)
-- app: YES (ver 0.10.36)
-- riff: YES (ver 0.10.36)
-- pbutils: YES (ver 0.10.36)
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- UniCap: NO
-- UniCap ucil: NO
-- V4L/V4L2: Using libv4l1 (ver 1.0.1) / libv4l2 (ver 1.0.1)
-- XIMEA: NO
-- Xine: NO
--
-- Other third-party libraries:
-- Use IPP: NO
-- Use Eigen: YES (ver 3.2.0)
-- Use TBB: YES (ver 4.2 interface 7000)
-- Use OpenMP: NO
-- Use GCD NO
-- Use Concurrency NO
-- Use C=: NO
-- Use Cuda: NO
-- Use OpenCL: YES
--
-- OpenCL:
-- Version: dynamic
-- Include path: /home/bipin/Desktop/opencv/opencv-2.4.10/3rdparty/include/opencl/1.2
-- Use AMD FFT: NO
-- Use AMD BLAS: NO
--
-- Python:
-- Interpreter: /usr/bin/python2 (ver 2.7.6)
-- Libraries: /usr/lib/i386-linux-gnu/libpython2.7.so (ver 2.7.6)
-- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.8.2)
-- packages path: lib/python2.7/dist-packages
--
-- Java:
-- ant: /usr/bin/ant (ver 1.9.3)
-- JNI: /usr/local/java/jdk1.7.0_25/include /usr/local/java/jdk1.7.0_25/include/linux /usr/local/java/jdk1.7.0_25/include
-- Java tests: YES
--
-- Documentation:
-- Build Documentation: YES
-- Sphinx: /usr/local/bin/sphinx-build (ver 1.2.1)
-- PdfLaTeX compiler: /usr/bin/pdflatex
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: YES
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/bipin/Desktop/opencv/opencv-2.4.10/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bipin/Desktop/opencv/opencv-2.4.10/build
`
It seems your GCC compiler is unable to treat inline assembly code.
Could you try update your GCC and check it?
I think this is a known issue reported here
Okay its done! I was there was a problem in system.cpp in base folder. I copied the latest code from github and build it and it worked perfectly. Thank you everyone for your concern.
Here is the commit that helped me https://github.com/Itseez/opencv/commit/ea50be0529c248961e1b66293f8a9e4b807294a6

Installing OpenCV on Ubuntu 12.04

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

Resources