Trying to build OpenCV 4.8.0 from source on windows with mingw, throws error at around 50%.
I tried both the gcc 13 with mcf threads and gc 12.2.0 with posix threads and seh exceptions but it throws the same error, which is related to videoio.
Cmake Configuration
ocv_init_download: OpenCV source tree is not fetched as git repository. 3rdparty resources will be downloaded from github.com by default. Detected processor: AMD64 Found PythonInterp: C:/Python311/python.exe (found suitable version "3.11.1", minimum required is "2.7") libjpeg-turbo: VERSION = 2.1.3, BUILD = opencv-4.8.0-libjpeg-turbo libjpeg-turbo(SIMD): SIMD extensions disabled: could not find NASM compiler. Performance will suffer. Cleaning INTERNAL cached variable: TIFF_LIBRARY Cleaning INTERNAL cached variable: TIFF_INCLUDE_DIR Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR) Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources OpenJPEG: VERSION = 2.5.0, BUILD = opencv-4.8.0-openjp2-2.5.0 OpenJPEG libraries will be built from sources: libopenjp2 (version "2.5.0") 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) Could NOT find LAPACK (missing: LAPACK_LIBRARIES) Reason given by package: LAPACK could not be found because dependency BLAS could not be found.Could NOT find Java (missing: Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE)
Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 AWT JVM)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Module opencv_python3 disabled because opencv_python_bindings_generator dependency can’t be resolved!
Processing WORLD modules…
module opencv_core…
Consider adding OPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int/int64_t according to your build configuration
module opencv_flann…
module opencv_imgproc…
module opencv_ml…
module opencv_photo…
module opencv_dnn…
Registering hook ‘INIT_MODULE_SOURCES_opencv_dnn’: C:/OpenCV/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
opencv_dnn: filter out cuda4dnn source code
module opencv_features2d…
module opencv_imgcodecs…
imgcodecs: OpenEXR codec is disabled in runtime. Details: OpenEXR vulnerabilities · Issue #21326 · opencv/opencv · GitHub
module opencv_videoio…
module opencv_calib3d…
module opencv_highgui…
highgui: using builtin backend: WIN32UI
module opencv_objdetect…
module opencv_stitching…
module opencv_video…
module opencv_gapi…
Processing WORLD modules… DONE
Excluding from source files list: modules/imgproc/src/imgwarp.lasx.cpp
Excluding from source files list: modules/imgproc/src/resize.lasx.cpp
Excluding from source files list: /modules/world/layers/layers_common.rvv.cpp
Excluding from source files list: /modules/world/layers/layers_common.lasx.cpp
Excluding from source files list: /modules/world/int8layers/layers_common.lasx.cpp
Excluding from source files list: /modules/world/layers/cpu_kernels/conv_depthwise.rvv.cpp
Excluding from source files list: /modules/world/layers/cpu_kernels/conv_depthwise.lasx.cpp
CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
directory
Call Stack (most recent call first):
CMakeLists.txt:1075 (include)General configuration for OpenCV 4.8.0 =====================================
Version control: unknownPlatform:
Timestamp: 2023-09-19T11:49:28Z
Host: Windows 6.3.9600 AMD64
CMake: 3.26.4
CMake generator: MinGW Makefiles
CMake build tool: C:/MinGW/bin/mingw32-make.exe
Configuration: ReleaseCPU/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 (18 files): + SSSE3 SSE4_1
SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (37 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKXC/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: C:/MinGW/bin/g++.exe (ver 12.2.0)
C++ flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -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 -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: C:/MinGW/bin/gcc.exe
C flags (Release): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -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: pthread
3rdparty dependencies:OpenCV modules:
To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo stitching ts video videoio world
Disabled: java_bindings_generator js_bindings_generator objc_bindings_generator python_bindings_generator python_tests
Disabled by dependency: python3
Unavailable: java python2 python2
Applications: tests perf_tests apps
Documentation: NO
Non-free algorithms: NOWindows RT support: NO
GUI:
Win32 UI: YES
VTK support: NOMedia I/O:
ZLib: build (ver 1.2.13)
JPEG: build-libjpeg-turbo (ver 2.1.3-62)
SIMD Support Request: YES
SIMD Support: NO
WEBP: build (ver encoder: 0x020f)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 - 4.2.0)
JPEG 2000: build (ver 2.5.0)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YESVideo I/O:
DC1394: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (58.134.100)
avformat: YES (58.76.100)
avutil: YES (56.70.100)
swscale: YES (5.9.100)
avresample: YES (4.0.0)
GStreamer: NO
DirectShow: YESParallel framework: pthreads
Trace: YES (built-in)
Other third-party libraries:
Lapack: NO
Eigen: YES (ver 3.4.0)
Custom HAL: NO
Protobuf: build (3.19.1)
Flatbuffers: builtin/3rdparty (23.5.9)OpenCL: YES (NVD3D11)
Include path: C:/OpenCV/3rdparty/include/opencl/1.2
Link libraries: Dynamic loadPython 3:
Interpreter: C:/Python311/python.exe (ver 3.11.1)
Libraries: NO
numpy: C:/Python311/Lib/site-packages/numpy/core/include (ver 1.23.5)
install path: -Python (for build): C:/Python311/python.exe
Java:
ant: NO
Java: NO
JNI: NO
Java wrappers: NO
Java tests: NOInstall to: C:/OpenCV/build/install
The Error(s)
[ 49%] Building CXX object modules/world/CMakeFiles/opencv_world.dir/__/videoio/ src/cap_obsensor/obsensor_uvc_stream_channel.cpp.obj In file included from C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream _channel_msmf.hpp:41, from C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_uvc_st ream_channel.cpp:33: C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp: In instantiation of 'class cv::obsensor::ComPtr': C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:145: 42: required from here C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:106: 27: error: could not convert template argument 'cv::obsensor::ComPtr::__T_IID_getter' from 'const IID& (cv::obsensor::ComPtr::)()' {aka 'const GUID& (cv::obsensor::ComPtr::)()'} to 'const IID& (* )()' {aka 'const GUID& (*)()'} 106 | _COM_SMARTPTR_TYPEDEF(T, __uuidof(T)); | ^ C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp: In instantiation of 'class cv::obsensor::ComPtr': C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:146: 44: required from here C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:106: 27: error: could not convert template argument 'cv::obsensor::ComPtr::__T_IID_getter' from 'const IID& (cv::obsensor::ComPtr::)( )' {aka 'const GUID& (cv::obsensor::ComPtr::)()'} to 'const IID& (*)()' {aka 'const GUID& (*)()'} C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp: In instantiation of 'class cv::obsensor::ComPtr': C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:148: 45: required from here C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:106: 27: error: could not convert template argument 'cv::obsensor::ComPtr::__T_IID_getter' from 'const IID& (cv::obsensor::ComPtr:: )()' {aka 'const GUID& (cv::obsensor::ComPtr::)()'} to 'const I ID& (*)()' {aka 'const GUID& (*)()'} C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp: In instantiation of 'class cv::obsensor::ComPtr': C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:149: 47: required from here C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:106: 27: error: could not convert template argument 'cv::obsensor::ComPtr::__T_IID_getter' from 'const IID& (cv::obsensor::ComPtr ::)()' {aka 'const GUID& (cv::obsensor::ComPtr::)()'} to 'cons t IID& (*)()' {aka 'const GUID& (*)()'} C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp: In instantiation of 'class cv::obsensor::ComPtr': C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:150: 45: required from here C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:106: 27: error: could not convert template argument 'cv::obsensor::ComPtr::__T_IID_getter' from 'const IID& (cv::obsensor::ComPtr:: )()' {aka 'const GUID& (cv::obsensor::ComPtr::)()'} to 'const I ID& (*)()' {aka 'const GUID& (*)()'} C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp: In instantiation of 'class cv::obsensor::ComPtr': C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:151: 49: required from here C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:106: 27: error: could not convert template argument 'cv::obsensor::ComPtr::__T_IID_getter' from 'const IID& (cv::obsensor::ComPtr:: )()' {aka 'const GUID& (cv::obsensor::ComPtr::)()'} to 'const I ID& (*)()' {aka 'const GUID& (*)()'} C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp: In instantiation of 'class cv::obsensor::ComPtr': C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:152: 40: required from here C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:106: 27: error: could not convert template argument 'cv::obsensor::ComPtr:: __T_IID_getter' from 'const IID& (cv::obsensor::ComPtr::)()' {aka 'con st GUID& (cv::obsensor::ComPtr::)()'} to 'const IID& (*)()' {aka 'cons t GUID& (*)()'} C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp: In instantiation of 'class cv::obsensor::ComPtr': C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:153: 39: required from here C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:106: 27: error: could not convert template argument 'cv::obsensor::ComPtr ::__T_IID_getter' from 'const IID& (cv::obsensor::ComPtr::)()' {aka 'const GUID& (cv::obsensor::ComPtr::)()'} to 'const IID& (*)()' {aka 'const GUID& (*)()'} C:\OpenCV\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:129: 7: warning: base class 'struct IMFSourceReaderCallback' has accessible non-virtu al destructor [-Wnon-virtual-dtor] 129 | class MSMFStreamChannel : public IUvcStreamChannel, public IMFSourceRead erCallback | ^~~~~~~~~~~~~~~~~ mingw32-make[2]: *** [modules\world\CMakeFiles\opencv_world.dir\build.make:5951: modules/world/CMakeFiles/opencv_world.dir/__/videoio/src/cap_obsensor/obsensor_ uvc_stream_channel.cpp.obj] Error 1 mingw32-make[1]: *** [CMakeFiles\Makefile2:2313: modules/world/CMakeFiles/opencv _world.dir/all] Error 2 mingw32-make: *** [Makefile:165: all] Error 2
System is Windows 8.1 with bing. Prcessor : Intel Celeron Dual Core.
<I have tried to build 4.7.0 previously with both mingw 10 and codeblocks(mingw 8) one way or another it always has ended in termination due to error!>