Installing OpenCV on Ubuntu 12.04 - opencv

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

Related

Compiling OpenCV creates cuda error - recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o' failed

I'm trying to compile openCV but it doesn't seem to work somehow.
Is this a problem with cuda?
I am running this in a docker-container (nvidia-docker)
Hardware is a Jetson Nano with newest JetPack - Version
What could that problem be?
[ 32%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o
In file included from /opencv/modules/core/src/opengl.cpp:48:0:
/usr/local/cuda/include/cuda_gl_interop.h:63:2: error: #error Please include the appropriate gl headers before including cuda_gl_interop.h
#error Please include the appropriate gl headers before including cuda_gl_interop.h
^~~~~
[ 32%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/out.cpp.o
In file included from /opencv/modules/core/include/opencv2/core/private.cuda.hpp:73:0,
from /opencv/modules/core/src/precomp.hpp:56,
from /opencv/modules/core/src/opengl.cpp:43:
/opencv/modules/core/src/opengl.cpp: In function ‘void cv::cuda::setGlDevice(int)’:
/opencv/modules/core/src/opengl.cpp:118:47: warning: ‘cudaError_t cudaGLSetGLDevice(int)’ is deprecated [-Wdeprecated-declarations]
cudaSafeCall( cudaGLSetGLDevice(device) );
^
/opencv/modules/core/include/opencv2/core/cuda/common.hpp:74:58: note: in definition of macro ‘cudaSafeCall’
#define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, __FILE__, __LINE__, CV_Func)
^~~~
In file included from /opencv/modules/core/src/opengl.cpp:48:0:
/usr/local/cuda/include/cuda_gl_interop.h:305:57: note: declared here
extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaGLSetGLDevice(int device);
^~~~~~~~~~~~~~~~~
modules/core/CMakeFiles/opencv_core.dir/build.make:1368: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o' failed
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/opengl.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:2763: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
Some info:
General configuration for OpenCV 4.1.1 =====================================
-- Version control: unknown
--
-- Extra modules:
-- Location (extra): /opencv_contrib/modules
-- Version control (extra): unknown
--
-- Platform:
-- Timestamp: 2020-01-06T00:19:08Z
-- Host: Linux 4.9.140-tegra aarch64
-- CMake: 3.10.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
--
-- CPU/HW features:
-- Baseline: NEON FP16
-- required: NEON
-- disabled: VFPV3
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/bin/c++ (ver 7.4.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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -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=non-virtual-dtor -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=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 -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--gc-sections
-- Linker flags (Debug): -Wl,--gc-sections
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: m pthread /usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so cudart_static -lpthread dl rt /usr/local/cuda/lib64/stubs/libcuda.so nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda/lib64 -L/usr/lib/aarch64-linux-gnu
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv datasets dnn dnn_objdetect dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: cnn_3dobj hdf java js matlab ovis python2 sfm ts viz
-- Applications: apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI:
-- QT: YES (ver 5.9.5)
-- QT OpenGL support: YES (Qt5::OpenGL 5.9.5)
-- GTK+: NO
-- OpenGL support: YES (/usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so)
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: build (ver encoder: 0x020e)
-- PNG: /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
-- TIFF: /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: build (ver 2.3.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: YES (2.2.5)
-- FFMPEG: YES
-- avcodec: YES (57.107.100)
-- avformat: YES (57.83.100)
-- avutil: YES (55.78.100)
-- swscale: YES (4.8.100)
-- avresample: NO
-- GStreamer: YES (1.14.5)
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: TBB (ver 2017.0 interface 9107)
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Lapack: NO
-- Eigen: YES (ver 3.3.4)
-- Custom HAL: YES (carotene (ver 0.0.1))
-- Protobuf: build (3.5.1)
--
-- NVIDIA CUDA: YES (ver 10.0, CUFFT CUBLAS FAST_MATH)
-- NVIDIA GPU arch: 53
-- NVIDIA PTX archs:
--
-- cuDNN: NO
--
-- OpenCL: YES (no extra features)
-- Include path: /opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 3:
-- Interpreter: /usr/bin/python3.6 (ver 3.6.9)
-- Libraries: /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
-- numpy: /usr/local/lib/python3.6/dist-packages/numpy/core/include (ver 1.18.0)
-- install path: lib/python3.6/dist-packages/cv2/python-3.6
--
-- Python (for build): /usr/bin/python3.6
--
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
I'd really appreciate some help, i couldn't find anything on the web sadly
Big thanks!
The solution was to use the nvidia-libraries.
So i took the lib-files from the JetPack download-folder
and used them
-worked!

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.

Cmake cross compile cant find library

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

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

Resources