When cross-comipile the OpenCV 4.0.1 got Error:
/home/atmark/opencv-4.0.1/modules/core/src/parallel.cpp:267:14: error:
‘exception_ptr’ in namespace ‘std’ does not name a type
std::exception_ptr pException;
But I already enabled C++11.
CMake:
sizeof(void) = 4 on x86 / x86_64 processor. Assume 32-bit compilation mode (X86=1)
Looking for ccache - not found
SSE is not supported by C++ compiler
SSE2 is not supported by C++ compiler
SSE3 is not supported by C++ compiler
SSSE3 is not supported by C++ compiler
SSE4_1 is not supported by C++ compiler
POPCNT is not supported by C++ compiler
SSE4_2 is not supported by C++ compiler
FP16 is not supported by C++ compiler
AVX is not supported by C++ compiler
Optimization SSE2 is not available, skipped
Dispatch optimization SSE4_1 is not available, skipped
Dispatch optimization SSE4_2 is not available, skipped
Dispatch optimization AVX is not available, skipped
Dispatch optimization FP16 is not available, skipped
Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) (Required is at least version "1.2.3")
Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
libjpeg-turbo: VERSION = 1.5.3, BUILD = opencv-4.0.1-libjpeg-turbo
Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
Could NOT find ZLIB (missing: ZLIB_INCLUDE_DIR) (found version "1.2.11")
Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
math lib 'libm' not found; floating point support disabled
Checking for module 'gtk+-3.0'
No package 'gtk+-3.0' found
Checking for module 'gtk+-2.0'
No package 'gtk+-2.0' found
Checking for module 'gthread-2.0'
No package 'gthread-2.0' found
Checking for module 'gstreamer-base-1.0'
No package 'gstreamer-base-1.0' found
Checking for module 'gstreamer-video-1.0'
No package 'gstreamer-video-1.0' found
Checking for module 'gstreamer-app-1.0'
No package 'gstreamer-app-1.0' found
Checking for module 'gstreamer-riff-1.0'
No package 'gstreamer-riff-1.0' found
Checking for module 'gstreamer-pbutils-1.0'
No package 'gstreamer-pbutils-1.0' found
Checking for module 'gstreamer-base-0.10'
No package 'gstreamer-base-0.10' found
Checking for module 'gstreamer-video-0.10'
No package 'gstreamer-video-0.10' found
Checking for module 'gstreamer-app-0.10'
No package 'gstreamer-app-0.10' found
Checking for module 'gstreamer-riff-0.10'
No package 'gstreamer-riff-0.10' found
Checking for module 'gstreamer-pbutils-0.10'
No package 'gstreamer-pbutils-0.10' found
Checking for module 'libdc1394-2'
No package 'libdc1394-2' found
Checking for module 'libdc1394'
No package 'libdc1394' found
Looking for linux/videodev2.h
Looking for linux/videodev2.h - found
Looking for sys/videoio.h
Looking for sys/videoio.h - not found
Checking for modules 'libavcodec;libavformat;libavutil;libswscale'
No package 'libavcodec' found
No package 'libavformat' found
No package 'libavutil' found
No package 'libswscale' found
Checking for module 'libavresample'
No package 'libavresample' found
On 32-bit Linux Intel IPP can not currently be used with dynamic libs because of linker errors. Set BUILD_SHARED_LIBS=OFF
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
Could NOT find Atlas (missing: Atlas_CBLAS_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY)
A library with BLAS API not found. Please specify library location.
LAPACK requires BLAS
A library with LAPACK API not found. Please specify library location.
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
OpenCV Python: during development append to PYTHONPATH: /home/atmark/opencv-4.0.1/build/python_loader
Excluding from source files list: <BUILD>/modules/core/mathfuncs_core.avx.cpp
Excluding from source files list: <BUILD>/modules/core/stat.sse4_2.cpp
Excluding from source files list: <BUILD>/modules/core/arithm.sse4_1.cpp
Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse2.cpp
Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse3.cpp
Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.ssse3.cpp
Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse4_1.cpp
Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.sse4_2.cpp
Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.avx.cpp
Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.fp16.cpp
Excluding from source files list: <BUILD>/modules/core/test/test_intrin128.avx2.cpp
Excluding from source files list: <BUILD>/modules/core/test/test_intrin256.avx2.cpp
Excluding from source files list: modules/imgproc/src/resize.sse4_1.cpp
Excluding from source files list: modules/imgproc/src/corner.avx.cpp
Excluding from source files list: modules/imgproc/src/imgwarp.sse4_1.cpp
Excluding from source files list: modules/imgproc/src/filter.avx2.cpp
Excluding from source files list: modules/imgproc/src/imgwarp.avx2.cpp
Excluding from source files list: modules/imgproc/src/resize.avx2.cpp
Excluding from source files list: <BUILD>/modules/imgproc/accum.sse4_1.cpp
Excluding from source files list: <BUILD>/modules/imgproc/accum.avx.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx2.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
Excluding from source files list: <BUILD>/modules/gapi/backends/fluid/gfluidimgproc_func.sse4_1.cpp
Excluding from source files list: modules/features2d/src/fast.avx2.cpp
Excluding from source files list: modules/calib3d/src/undistort.avx2.cpp
General configuration for OpenCV 4.0.1 =====================================
Version control: unknown
Platform:
Timestamp: 2019-04-15T07:25:55Z
Host: Linux 3.2.0-4-amd64 x86_64
CMake: 3.5.1
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: Release
CPU/HW features:
Baseline:
requested: SSE2
Dispatched code generation:
requested: SSE4_1 SSE4_2 AVX FP16
C/C++:
Built as dynamic libs?: YES
C++ Compiler: /usr/bin/arm-linux-gnueabi-g++-4.9 (ver 4.9.2)
C++ flags (Release): -std=c++11 -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 -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -std=c++11 -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 -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-missing-field-initializers -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/arm-linux-gnueabi-gcc-4.9
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 -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-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 -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
ccache: NO
Precompiled headers: YES
Extra dependencies: dl m pthread rt
3rdparty dependencies:
OpenCV modules:
To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc java_bindings_generator ml objdetect photo python_bindings_generator stitching ts video videoio
Disabled: world
Disabled by dependency: -
Unavailable: java js python2 python3
Applications: tests perf_tests apps
Documentation: NO
Non-free algorithms: NO
GUI:
GTK+: NO
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.11)
JPEG: libjpeg-turbo (ver 1.5.3-62)
WEBP: build (ver encoder: 0x020e)
PNG: build (ver 1.6.35)
TIFF: build (ver 42 - 4.0.9)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: NO
FFMPEG: NO
avcodec: NO
avformat: NO
avutil: NO
swscale: NO
avresample: NO
GStreamer: NO
v4l/v4l2: linux/videodev2.h
Parallel framework: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries:
Lapack: NO
Eigen: NO
Custom HAL: NO
Protobuf: build (3.5.1)
OpenCL: YES (no extra features)
Include path: /home/atmark/opencv-4.0.1/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python (for build): /usr/bin/python2.7
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Install to: /usr/local
-----------------------------------------------------------------
Configuring done
Generating done
If you have a better solution please share it, here is my current way...
#undef CV__EXCEPTION_PTR // Add this line, disable the EXCEPTION_PTR
#ifndef CV__EXCEPTION_PTR
# define CV__EXCEPTION_PTR 0
#elif CV__EXCEPTION_PTR
# include <exception> // std::exception_ptr
#endif
Related
I am trying to get orb_slam2_ros to compile and it needed an OpenCV version higher than 2.3. I have 4.2.0 but it doesn't work but according to ROS, it has been tested to work on 2.4.11. Here is what I did:
Download the source zip file.
Extract it.
Go into the directory and create a build folder.
Go into the build folder and run cmake ...
There is gives me this:
CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:85 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:84 (include)
CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:86 (list):
list GET given empty list
Call Stack (most recent call first):
CMakeLists.txt:84 (include)
CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:89 (math):
math cannot parse the expression: "*100 + ": syntax error, unexpected
exp_TIMES (1).
Call Stack (most recent call first):
CMakeLists.txt:84 (include)
-- Detected version of GNU GCC: (ERROR)
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
-- checking for module 'gstreamer-video-1.0'
-- package 'gstreamer-video-1.0' not found
-- checking for module 'gstreamer-app-1.0'
-- package 'gstreamer-app-1.0' not found
-- checking for module 'gstreamer-riff-1.0'
-- package 'gstreamer-riff-1.0' not found
-- checking for module 'gstreamer-pbutils-1.0'
-- package 'gstreamer-pbutils-1.0' not found
-- checking for module 'gstreamer-base-0.10'
-- package 'gstreamer-base-0.10' not found
-- checking for module 'gstreamer-video-0.10'
-- package 'gstreamer-video-0.10' not found
-- checking for module 'gstreamer-app-0.10'
-- package 'gstreamer-app-0.10' not found
-- checking for module 'gstreamer-riff-0.10'
-- package 'gstreamer-riff-0.10' not found
-- checking for module 'gstreamer-pbutils-0.10'
-- package 'gstreamer-pbutils-0.10' not found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
--
-- General configuration for OpenCV 2.4.11 =====================================
-- Version control: unknown
--
-- Platform:
-- Host: Linux 5.8.0-41-generic x86_64
-- CMake: 3.16.3
-- 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 9.3.0)
-- 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 -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -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 -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -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 -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -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 -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -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 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.32)
-- GThread : YES (ver 2.64.6)
-- GtkGlExt: NO
-- OpenGL support: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.1.0)
-- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
-- OpenEXR: /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2.3.0)
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.5)
-- FFMPEG: YES
-- codec: YES (ver 58.54.100)
-- format: YES (ver 58.29.100)
-- util: YES (ver 56.31.100)
-- swscale: YES (ver 5.5.100)
-- 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.18.0) / libv4l2 (ver 1.18.0)
-- XIMEA: NO
-- Xine: NO
--
-- Other third-party libraries:
-- Use IPP: NO
-- Use Eigen: YES (ver 3.3.7)
-- 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/dragonros/Downloads/SLAM_DEPS/opencv-2.4.11/3rdparty/include/opencl/1.2
-- Use AMD FFT: NO
-- Use AMD BLAS: NO
--
-- Python:
-- Interpreter: /usr/bin/python2 (ver )
--
-- Java:
-- ant: NO
-- JNI: /usr/lib/jvm/java-8-openjdk-amd64/include /usr/lib/jvm/java-8-openjdk-amd64/include/linux /usr/lib/jvm/java-8-openjdk-amd64/include
-- 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/dragonros/Downloads/SLAM_DEPS/build
-- -----------------------------------------------------------------
--
-- Configuring incomplete, errors occurred!
See also "/home/dragonros/Downloads/SLAM_DEPS/build/CMakeFiles/CMakeOutput.log".
See also "/home/dragonros/Downloads/SLAM_DEPS/build/CMakeFiles/CMakeError.log".
Am I compiling it wrong? If not, how can I resolve this error?
You need to change opencv2.4.13/cmake/OpenCVDetectCXXCompiler.cmake (not sure which line) dumpversion to dumpfullversion
Explanation is that
In gcc with higher version, dumpversion function can't get true full
version number of compiler so that cmake progress will fail
Recommendation: On github, there plenty of refactored versions for both 4.2.0 and others. I recommend to upgrade to newer OpenCV versions for orb_slam_ros. Cmake lists and source files should be changed respectively.
I configured OpenCV 3.4.11 according to this post.
I am using MingGW as my compiler.
Here is what CMake GUI told me:
Detected processor: AMD64
sizeof(void) = 4 on 64 bit processor. Assume 32-bit compilation mode
libjpeg-turbo: VERSION = 2.0.5, BUILD = opencv-3.4.11-libjpeg-turbo
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
Could NOT find BLAS (missing: BLAS_LIBRARIES)
LAPACK requires BLAS
A library with LAPACK API not found. Please specify library location.
Found apache ant: C:/apache-ant-1.10.8/bin/ant.bat (1.8.0)
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
OpenCV Python: during development append to PYTHONPATH: D:/mingw-build-3.4.11/python_loader
Caffe: NO
Protobuf: NO
Glog: NO
freetype2: NO
harfbuzz: NO
Module opencv_ovis disabled because OGRE3D was not found
No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Allocator metrics storage type: 'int'
Excluding from source files list: modules/imgproc/src/imgwarp.avx2.cpp
Excluding from source files list: modules/imgproc/src/resize.avx2.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx2.cpp
Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.avx512_skx.cpp
Excluding from source files list: modules/features2d/src/fast.avx2.cpp
General configuration for OpenCV 3.4.11 =====================================
Version control: unknown
Extra modules:
Location (extra): D:/opencv_contrib-3.4.11/modules
Version control (extra): unknown
Platform:
Timestamp: 2020-08-15T06:52:46Z
Host: Windows 10.0.18363 AMD64
CMake: 3.18.1
CMake generator: MinGW Makefiles
CMake build tool: C:/MinGW/bin/mingw32-make.exe
Configuration: Release
CPU/HW features:
Baseline: SSE SSE2
requested: SSE2
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX
requested: SSE4_1 SSE4_2 AVX FP16
SSE4_1 (14 files): + SSE3 SSSE3 SSE4_1
SSE4_2 (1 files): + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (0 files): + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (5 files): + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2 AVX
C/C++:
Built as dynamic libs?: NO
C++11: YES
C++ Compiler: C:/Strawberry/c/bin/g++.exe (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 -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -mfpmath=sse -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 -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -mfpmath=sse -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: C:/Strawberry/c/bin/gcc.exe
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 -Wuninitialized -Winit-self -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -mfpmath=sse -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 -Wuninitialized -Winit-self -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -mfpmath=sse -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: comctl32 gdi32 ole32 setupapi ws2_32 winmm
3rdparty dependencies: libprotobuf zlib libjpeg-turbo libwebp libpng libtiff libjasper IlmImf quirc
OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: python_bindings_generator python_tests world
Disabled by dependency: -
Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java js matlab ovis python2 python3 sfm viz
Applications: apps
Documentation: NO
Non-free algorithms: NO
Windows RT support: NO
GUI:
Win32 UI: YES
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.11)
JPEG: build-libjpeg-turbo (ver 2.0.5-62)
WEBP: build (ver encoder: 0x020f)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 - 4.0.10)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
Video I/O:
DC1394: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (ver 57.107.100)
avformat: YES (ver 57.83.100)
avutil: YES (ver 55.78.100)
swscale: YES (ver 4.8.100)
avresample: YES (ver 3.7.0)
GStreamer: NO
DirectShow: YES
Parallel framework: none
Trace: YES (built-in)
Other third-party libraries:
Lapack: NO
Eigen: NO
Custom HAL: NO
Protobuf: build (3.5.1)
OpenCL: YES (no extra features)
Include path: D:/opencv-3.4.11/sources/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python (for build): C:/Users/Administrator/AppData/Local/Programs/Python/Python38-32/python.exe
Java:
ant: C:/apache-ant-1.10.8/bin/ant.bat (ver 1.8.0)
JNI: NO
Java wrappers: NO
Java tests: NO
Install to: D:/mingw-build-3.4.11/install
-----------------------------------------------------------------
Configuring done
After applying mingw32-make -j8 and mingw32-make install in CMD, it built successfully.
Then, I add D:\mingw-build-3.4.11\install\x64\mingw\bin to my System PATH and restarted my computer.
The step 10 tells me to download FindOpenCV.cmake and add it to project-root/cmake/. However, this link responsed 502 Bad Gateway, thus I jumped over this step.
The following is my project contents:
CMakeLists.txt
cmake_minimum_required(VERSION 3.6)
project(opencv)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
# Where to find CMake modules and OpenCV
set(OpenCV_DIR "D:\\mingw-build-3.4.11\\install")
find_package(OpenCV REQUIRED core highgui imgproc imgcodecs)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(opencv opencv.cpp)
# add libs you need
set(OpenCV_LIBS opencv_core opencv_imgproc opencv_highgui opencv_imgcodecs)
# linking
target_link_libraries(opencv ${OpenCV_LIBS})
opencv.cpp
#include <opencv2/opencv.hpp>
using namespace cv;
int main() {
Mat mat = imread("1.jpg");
imshow("1", mat);
}
CMake build successfully like following:
"D:\Program Files\JetBrains\CLion 2020.1.2\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" D:\Users\Administrator\Documents\Codes\CLionProjects\opencv
-- OpenCV ARCH: x64
-- OpenCV RUNTIME: mingw
-- OpenCV STATIC: OFF
-- Found OpenCV 3.4.11 in D:/mingw-build-3.4.11/install/x64/mingw/lib
-- You might need to add D:/mingw-build-3.4.11/install/x64/mingw/bin to your PATH to be able to run your applications.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Users/Administrator/Documents/Codes/CLionProjects/opencv/cmake-build-debug
[Finished]
However, everytime I run this application, compiler keeps telling me:
====================[ Build | opencv | Debug ]==================================
"D:\Program Files\JetBrains\CLion 2020.1.2\bin\cmake\win\bin\cmake.exe" --build D:\Users\Administrator\Documents\Codes\CLionProjects\opencv\cmake-build-debug --target opencv -- -j 4
[ 50%] Linking CXX executable opencv.exe
CMakeFiles\opencv.dir/objects.a(opencv.cpp.obj): In function `main':
D:/Users/Administrator/Documents/Codes/CLionProjects/opencv/opencv.cpp:6: undefined reference to `cv::imread(cv::String const&, int)'
D:/Users/Administrator/Documents/Codes/CLionProjects/opencv/opencv.cpp:7: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
CMakeFiles\opencv.dir/objects.a(opencv.cpp.obj): In function `cv::String::String(char const*)':
D:/mingw-build-3.4.11/install/include/opencv2/core/cvstd.hpp:602: undefined reference to `cv::String::allocate(unsigned long long)'
CMakeFiles\opencv.dir/objects.a(opencv.cpp.obj): In function `cv::String::~String()':
D:/mingw-build-3.4.11/install/include/opencv2/core/cvstd.hpp:648: undefined reference to `cv::String::deallocate()'
CMakeFiles\opencv.dir/objects.a(opencv.cpp.obj): In function `cv::String::operator=(cv::String const&)':
D:/mingw-build-3.4.11/install/include/opencv2/core/cvstd.hpp:656: undefined reference to `cv::String::deallocate()'
CMakeFiles\opencv.dir/objects.a(opencv.cpp.obj): In function `cv::Mat::~Mat()':
D:/mingw-build-3.4.11/install/include/opencv2/core/mat.inl.hpp:786: undefined reference to `cv::fastFree(void*)'
CMakeFiles\opencv.dir/objects.a(opencv.cpp.obj): In function `cv::Mat::release()':
D:/mingw-build-3.4.11/install/include/opencv2/core/mat.inl.hpp:898: undefined reference to `cv::Mat::deallocate()'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\opencv.dir\build.make:91: opencv.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:75: CMakeFiles/opencv.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:82: CMakeFiles/opencv.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: opencv] Error 2
Actually no error founded in code check. Moreover, I can find the imread source code through click function with CTRL button pressed.
After building OpenCV with MinGW-w64 I usually do this:
INSTALLPREFIX=installation_path_supplied_as_CMAKE_INSTALL_PREFIX
cp -f build/unix-install/*.pc $INSTALLPREFIX/lib/pkgconfig/
mkdir -p $INSTALLPREFIX/share/OpenCV
mv $INSTALLPREFIX/*.cmake $INSTALLPREFIX/share/OpenCV/
That usually helps get OpenCV to get detected.
I am trying to build opencv like this:
wget -nc -O opencv.tar.gz https://github.com/opencv/opencv/archive/4.1.2.tar.gz
wget -nc -O opencv_contrib.tar.gz https://github.com/opencv/opencv_contrib/archive/4.1.2.tar.gz
echo extracting opencv
tar xzf opencv.tar.gz
tar xzf opencv_contrib.tar.gz
mkdir opencv-build
cd opencv-build
cmake -D CMAKE_BUILD_TYPE=Release \
-D WITH_TBB=ON \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_opencv_bioinspired=OFF \
-D WITH_V4L=ON -D BUILD_opencv_structured_light=OFF \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D WITH_CUDA=OFF -D WITH_GSTREAMER=OFF \
-D BUILD_opencv_stereo=OFF \
-D BUILD_opencv_gapi=ON \
-D BUILD_opencv_objdetect=ON \
-D BUILD_opencv_xobjdetect=ON \
-D BUILD_opencv_stitching=OFF \
-D BUILD_opencv_superres=OFF \
-D BUILD_opencv_surface_matching=OFF \
-D BUILD_opencv_text=OFF \
-D BUILD_opencv_face=OFF \
-D BUILD_opencv_xphoto=OFF \
-D BUILD_opencv_calib3d=ON \
-D BUILD_opencv_core=ON \
-D BUILD_opencv_dnn=ON \
-D BUILD_opencv_cvv=OFF \
-D BUILD_opencv_world=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_opencv_python=OFF \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.1.2/modules \
-D BUILD_EXAMPLES=OFF ../opencv-4.1.2
make -j12
It seems to be able to configure itself:
-- Detected processor: x86_64
-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- libjpeg-turbo: VERSION = 2.0.2, BUILD = opencv-4.1.2-libjpeg-turbo
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
-- found Intel IPP (ICV version): 2019.0.0 [2019.0.0 Gold]
-- at: /home/stiv2/jsoft-1.0/opencv-build/3rdparty/ippicv/ippicv_lnx/icv
-- found Intel IPP Integration Wrappers sources: 2019.0.0
-- at: /home/stiv2/jsoft-1.0/opencv-build/3rdparty/ippicv/ippicv_lnx/iw
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CBLAS_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY)
-- A library with BLAS API not found. Please specify library location.
-- LAPACK requires BLAS
-- A library with LAPACK API not found. Please specify library location.
-- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
-- OpenCV Python: during development append to PYTHONPATH: /home/stiv2/jsoft-1.0/opencv-build/python_loader
-- Caffe: NO
-- Protobuf: NO
-- Glog: NO
-- Checking for module 'freetype2'
-- No package 'freetype2' found
-- freetype2: NO
-- harfbuzz: YES (ver 1.7.2)
-- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) (found version "")
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
-- Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
-- Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
-- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
-- Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
-- Checking for module 'tesseract'
-- No package 'tesseract' found
-- Tesseract: NO
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /home/stiv2/jsoft-1.0/opencv-4.1.2/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out cuda4dnn source code
--
-- General configuration for OpenCV 4.1.2 =====================================
-- Version control: 3e33837e-dirty
--
-- Extra modules:
-- Location (extra): /home/stiv2/jsoft-1.0/opencv_contrib-4.1.2/modules
-- Version control (extra): 3e33837e-dirty
--
-- Platform:
-- Timestamp: 2020-05-21T18:21:21Z
-- Host: Linux 5.3.0-51-generic x86_64
-- CMake: 3.10.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: Release
--
-- CPU/HW features:
-- Baseline: SSE SSE2 SSE3
-- requested: SSE3
-- Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
-- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
-- SSE4_1 (14 files): + SSSE3 SSE4_1
-- SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
-- FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
-- AVX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
-- AVX2 (27 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- AVX512_SKX (3 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/bin/c++ (ver 7.5.0)
-- 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 -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -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 -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -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 -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--gc-sections
-- Linker flags (Debug): -Wl,--gc-sections
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: dl m pthread rt /usr/lib/x86_64-linux-gnu/libOpenGL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libGLU.so
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: aruco bgsegm calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality reg rgbd saliency shape tracking video videoio videostab xfeatures2d ximgproc xobjdetect
-- Disabled: bioinspired cvv face stereo stitching structured_light superres surface_matching text world xphoto
-- Disabled by dependency: -
-- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev freetype 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/x86_64-linux-gnu/libOpenGL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libGLU.so)
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: libjpeg-turbo (ver 2.0.2-62)
-- WEBP: build (ver encoder: 0x020e)
-- PNG: build (ver 1.6.37)
-- TIFF: build (ver 42 - 4.0.10)
-- 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 (58.71.100)
-- avformat: YES (58.38.101)
-- avutil: YES (56.41.100)
-- swscale: YES (5.6.100)
-- avresample: YES (3.7.0)
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Intel IPP: 2019.0.0 Gold [2019.0.0]
-- at: /home/stiv2/jsoft-1.0/opencv-build/3rdparty/ippicv/ippicv_lnx/icv
-- Intel IPP IW: sources (2019.0.0)
-- at: /home/stiv2/jsoft-1.0/opencv-build/3rdparty/ippicv/ippicv_lnx/iw
-- Lapack: NO
-- Eigen: NO
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
--
-- OpenCL: YES (no extra features)
-- Include path: /home/stiv2/jsoft-1.0/opencv-4.1.2/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 3:
-- Interpreter: /usr/bin/python3 (ver 3.6.9)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython3.6m.so (ver 3.6.9)
-- numpy: /home/stiv2/.local/lib/python3.6/site-packages/numpy/core/include (ver 1.18.1)
-- install path: lib/python3.6/dist-packages/cv2/python-3.6
--
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/stiv2/jsoft-1.0/opencv-build
but when I make it, I suddenly get this:
[ 78%] Linking CXX shared library ../../lib/libopencv_videoio.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(vc1dsp_mmx.o): relocation R_X86_64_PC32 against symbol `ff_pw_9' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:415: recipe for target 'lib/libopencv_videoio.so.4.1.2' failed
make[2]: *** [lib/libopencv_videoio.so.4.1.2] Error 1
CMakeFiles/Makefile2:3689: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
what is this and how can I fix it?
I am trying to compile opencv on Slackware 4.1. However I encountered the following error each time.
In file included from /usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:29:0,
from /tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:65:
/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:35:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererStreamInfoClass;
/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:83:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererContainerInfoClass;
/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:104:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererAudioInfoClass;
^
/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:129:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererVideoInfoClass;
^
/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:159:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererSubtitleInfoClass;
^
/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:202:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererInfoClass;
^
In file included from /tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:65:0:
/usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:47:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstEncodingProfileClass;
^
/usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:66:9: error: 'GstEncodingProfileClass' does not name a type
typedef GstEncodingProfileClass GstEncodingContainerProfileClass;
^
/usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:85:9: error: 'GstEncodingProfileClass' does not name a type
typedef GstEncodingProfileClass GstEncodingVideoProfileClass;
^
/usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:104:9: error: 'GstEncodingProfileClass' does not name a type
typedef GstEncodingProfileClass GstEncodingAudioProfileClass;
^
/tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp: In member function 'virtual bool CvCapture_GStreamer::grabFrame()':
/tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:232:57: error: 'gst_app_sink_pull_sample' was not declared in this scope
sample = gst_app_sink_pull_sample(GST_APP_SINK(sink));
^
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_gstreamer.cpp.o] Error 1
The configuration report for the compilation is as follows:
-- General configuration for OpenCV 2.4.11 =====================================
-- Version control: unknown
--
-- Platform:
-- Host: Linux 3.10.17 i686
-- CMake: 2.8.12
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/gmake
-- Configuration: Release
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/bin/c++ (ver 4.8.2)
-- C++ flags (Release): -O2 -march=i486 -mtune=i686 -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): -O2 -march=i486 -mtune=i686 -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): -O2 -march=i486 -mtune=i686 -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): -O2 -march=i486 -mtune=i686 -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: NO
--
-- 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 4.x: YES (ver 4.8.5 EDITION = OpenSource)
-- QT OpenGL support: NO
-- OpenGL support: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/libz.so (ver 1.2.8)
-- JPEG: /usr/lib/libjpeg.so (ver 80)
-- PNG: /usr/lib/libpng.so (ver 1.4.12)
-- TIFF: /usr/lib/libtiff.so (ver 42 - 3.9.7)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: build (ver 1.7.1)
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.2)
-- FFMPEG: NO
-- codec: NO
-- format: NO
-- util: NO
-- swscale: NO
-- gentoo-style: NO
-- 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 0.9.5) / libv4l2 (ver 0.9.5)
-- 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: /tmp/SBo/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.5)
--
-- Java:
-- ant: NO
-- JNI: /usr/lib/java/include /usr/lib/java/include/linux /usr/lib/java/include
-- Java tests: NO
--
-- Documentation:
-- Build Documentation: NO
-- Sphinx: NO
-- PdfLaTeX compiler: /usr/share/texmf/bin/pdflatex
-- Doxygen: YES (/usr/bin/doxygen)
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: NO
--
-- Install path: /usr
--
-- cvconfig.h is in: /tmp/SBo/opencv-2.4.11/build
I looked through the opencv requirement from below link
http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
That I need ffmpeg or libav packages, which I cannot find under standard slackware 14.1 packages. But I installed gstreamer completely instead (gstreamer, gst-pluigns-base, and good) and the error I encountered above definitely has something to do with gstreamer.
I got this fixed by installing libgstreamer-plugins-base1.0-dev. Before that CMake detected GStreamer version 0.10.36, after that - 1.4.5.
It worked for me after I set WITH_GSTREAMER_0_10 to ON
I am using Ubuntu 12.04 but got the same error.
This can be avoided by using the -D WITH_GSTREAMER=OFF parameter.
As advised here and here.
Then here they advise to update gstreamer, but this didn't fix it for me.
I still want to verify this with a fresh installation.
If anybody still have problem with that,
try to install gstreamer1.0 properly with all that packages
Example for Fedora OS:
dnf install gstreamer1-devel gstreamer1-plugins-base-tools
gstreamer1-devel-docs gstreamer1-plugins-base-devel
gstreamer1-plugins-base-devel-docs
gstreamer1-plugins-good gstreamer1-plugins-good-extras
gstreamer1-plugins-ugly gstreamer1-plugins-ugly-devel-docs
gstreamer1-plugins-bad-free gstreamer1-plugins-bad-free-devel
gstreamer1-plugins-bad-free-extras
Here is comprehensive installation guide for your system: official link.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
My steps for installing OpenCV on my Machine (MBP, 15", 2.5 GHz i7, 16GB RAM, AMD Radeon HD 6770M, 128GB SSD)
i install git command line tools
latest macports version installed
cmake installed with $ sudo port install cmake
clone repo of opencv $ git clone git://code.opencv.org/opencv.git
after repo is on my machine, I changed to this directory and make a new directory
$ cd opencv $ mkdir build $ cd build
then I run $ cmake -G “Unix Makefiles” ../
after that I get
`-- checking for module 'libdc1394-2'
-- package 'libdc1394-2' not found
-- checking for module 'libdc1394'
-- package 'libdc1394' not found
-- checking for module 'libv4l1'
-- package 'libv4l1' not found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - not found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- checking for module 'libavcodec'
-- package 'libavcodec' not found
-- checking for module 'libavformat'
-- package 'libavformat' not found
-- checking for module 'libavutil'
-- package 'libavutil' not found
-- checking for module 'libswscale'
-- package 'libswscale' not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - not found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Could NOT find PythonLibs: Found unsuitable version "2.7.2", but required is exact version "2.7.3" (found /usr/lib/libpython2.7.dylib)
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named numpy.distutils
-- Found apache ant 1.8.2: /usr/bin/ant
-- General configuration for OpenCV 2.4.9 =====================================
-- Version control: 2.4.4-642-g061dd7e
-- Platform:
-- Host: Darwin 12.2.0 i386
-- CMake: 2.8.10
-- 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.2.0)
-- C++ flags (Release): -W -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 -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -W -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 -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -g -O0 -DDEBUG -D_DEBUG -ggdb3
-- C Compiler: /usr/bin/cc
-- C flags (Release): -W -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 -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -W -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 -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -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 photo legacy gpu java softcascade stitching ts videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: androidcamera ocl python
-- GUI:
-- QT 4.x: NO
-- Cocoa: YES
-- OpenGL support: NO
-- Media I/O:
-- ZLib: build (ver 1.2.7)
-- JPEG: build (ver 90)
-- WEBP: build (ver 0.2.1)
-- PNG: build (ver 1.5.12)
-- TIFF: build (ver 42 - 4.0.2)
-- JPEG 2000: build (ver 1.900.1)
-- OpenEXR: build (ver 1.7.1)
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: NO
-- FFMPEG: YES
-- codec: YES (ver Unknown)
-- format: YES (ver Unknown)
-- util: YES (ver Unknown)
-- swscale: YES (ver Unknown)
-- gentoo-style: YES
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- QuickTime: NO
-- QTKit: YES
-- V4L/V4L2: NO/NO
-- Other third-party libraries:
-- Use IPP: NO
-- Use Eigen: NO
-- Use TBB: NO
-- Use OpenMP: NO
-- Use GCD YES
-- Use Concurrency NO
-- Use C=: NO
-- Use Cuda: NO
-- Use OpenCL: NO
-- Python:
-- Interpreter: /opt/local/bin/python2 (ver 2.7.3)
-- Java:
-- ant: /usr/bin/ant (ver 1.8.2)
-- JNI: /System/Library/Frameworks/JavaVM.framework/Headers /System/Library/Frameworks/JavaVM.framework/Headers /System/Library/Frameworks/JavaVM.framework/Headers
-- Java tests: YES
-- Documentation:
-- Build Documentation: NO
-- Sphinx: NO
-- PdfLaTeX compiler: NO
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: NO
-- Install path: /usr/local
-- cvconfig.h is in: /Users/miralemcebic/Desktop/ocv/opencv/build
-- -----------------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/miralemcebic/Desktop/ocv/opencv/build`
than I run $ cmake -G “Unix Makefiles” ../
Now here comes the errors and of the end by 30% I get this
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libopencv_highgui.2.4.9.dylib] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
What is here the Problem? I also have Python 2.7 and Python >3
Can anybody help me by this issue?
Install macports
$ sudo port selfupdate
$ sudo port install opencv
Wait.