Error during compiling OpenCV with CMake using Qt MinGW

asked 2018-06-12 10:14:21 -0600

Hello All,

I am trying to compile OpenCV 3.4.1 with CMake 3.11.3 using Qt5.11 MinGW on windows 10 but it gives me error when i try to generate in Cmake. I would like to use openCV libraries in Qt 5.11.

I followed the following steps mentioned here. Following is the debug output:

CUDA compilation is disabled (due to only Visual Studio compiler supported on your platform).
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.
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
Excluding from source files list: modules/core/src/convert.avx2.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: modules/imgproc/src/undistort.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.1 =====================================
Version control:               unknown

Platform:
Timestamp:                   2018-06-12T13:40:31Z
Host:                        Windows 10.0.17134 AMD64
CMake:                       3.11.3
CMake generator:             MinGW Makefiles
CMake build tool:            C:/Qt/Tools/mingw530_32/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 (3 files):          + SSE3 SSSE3 SSE4_1
  SSE4_2 (1 files):          + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2
  FP16 (2 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?:      YES
C++ Compiler:                C:/Qt/Tools/mingw530_32/bin/g++.exe  (ver 5.3.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 -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -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-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -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:/Qt/Tools/mingw530_32/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-narrowing -Wno-comment -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 ...
(more)
edit retag flag offensive close merge delete

Comments

  • mingw version 5.3.0 -- that is quite old. (also, 32bits,hmmm) . maybe getting latest mingw64 is a better idea, than using that.
  • please clarify: do you want to build the opencv highgui qt extensions , or do you want to build programs with your own, qt based ui later ? (this is kind of XOR, you have to make a decision)
  • ENABLE_PRECOMPILED_HEADERS=OFF
berak gravatar imageberak ( 2018-06-12 10:43:58 -0600 )edit

Hi Berak, Thanks for the reply. I would like to build programs on my own using qt based ui at a later stage. I will try to update mingw.

wreck_zone gravatar imagewreck_zone ( 2018-06-12 10:57:02 -0600 )edit

in that case try :

cmake -DWITH_QT=OFF

maybe that cures it already (highgui)

berak gravatar imageberak ( 2018-06-12 11:00:18 -0600 )edit

try that, and report back, please.

berak gravatar imageberak ( 2018-06-12 13:32:58 -0600 )edit

Hi Berak, Yesterday I tried multiple times to compile but didnt succeed with your suggested methods. I then tried to put BUILD_opencv_highgui=OFF , BUILD_PROTOBUF=OFF, WITH_PROTOBUF=OFF and I was then able to generate from cmake but in command prompt when I do: mingw32-make install I get following errors:

modules\videoio\CMakeFiles\opencv_videoio.dir\build.make:146: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_dshow.cpp.obj' failed mingw32-make[2]: * [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_dshow.cpp.obj] Error 1 CMakeFiles\Makefile2:2194: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed mingw32-make[1]: * [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2 Makefile:161: recipe for target 'all' failed

wreck_zone gravatar imagewreck_zone ( 2018-06-13 02:33:43 -0600 )edit

I don't know how should I proceed with compilation. Do you have any other suggestions? I didn't tried with mingw64 as their website is down for maintenance since yesterday so I couldn't donwload it. I will try to compile with lower version of opencv now. I will keep you updated.

wreck_zone gravatar imagewreck_zone ( 2018-06-13 02:36:41 -0600 )edit

i can assure you it works with a more modern mingw64

berak gravatar imageberak ( 2018-06-13 02:39:57 -0600 )edit