# MinGW Build Error OpenCV 4.8.0

**URL:** https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597
**Category:** C++
**Tags:** windows, build, videoio
**Created:** [September 19, 2023, 2:51pm UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597 "2023-09-19T14:51:04Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![saqib](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/saqib/32/8741_2.png) [@saqib](https://forum.opencv.org/u/saqib)
#### Post date: [September 19, 2023, 2:51pm UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597/1 "2023-09-19T14:51:04Z")

</div>

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](https://github.com/opencv/opencv/issues/21326)  
> > 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: unknown
> > 
> > Platform:  
> > 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: 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 (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\_SKX
> > 
> > C/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: NO
> > 
> > Windows RT support: NO
> > 
> > GUI:  
> > Win32 UI: YES  
> > VTK support: NO
> > 
> > Media 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: YES
> > 
> > Video 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: YES
> > 
> > Parallel 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 load
> > 
> > Python 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: NO
> > 
> > Install to: C:/OpenCV/build/install_

Error

> **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!\>**

---

<div class="post-metadata">

### Author: ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)
#### Post date: [September 19, 2023, 3:37pm UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597/2 "2023-09-19T15:37:06Z")

</div>

unfortunately, _no_ mingw version has code for MSMF, so you will have to do without the MSMF & OBSSENSOR backends for videoio

clean prev. build artefacts and add

```
WITH_MSMF=OFF
WITH_OBSSENSOR=OFF

```

to your cmake cmdline, rerun cmake && make

---

<div class="post-metadata">

### Author: ![saqib](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/saqib/32/8741_2.png) [@saqib](https://forum.opencv.org/u/saqib)
#### Post date: [September 20, 2023, 5:41am UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597/3 "2023-09-20T05:41:32Z")

</div>

Thank You, Very much it really helped, i built without errors, but now there is another runtime error, when i start program it instantly crashes and the fault is in opencv\_480world.dll, what my question is that i built with world and i thought it would make a separate world dll alongwith all others but it deleted others, so i would like to use some help building all other modules without going through all that mess again since object files are already present so its just a matter of link. Can you please tell how?

---

<div class="post-metadata">

### Author: ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)
#### Post date: [September 20, 2023, 5:55am UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597/4 "2023-09-20T05:55:14Z")

</div>

> [@saqib](#):
>
> but now there is another runtime error, when i start program it instantly crashes and the fault is in opencv\_480world.dll

code ? error ?  
dont make us guess, it’s bad enough if you do …

---

<div class="post-metadata">

### Author: ![saqib](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/saqib/32/8741_2.png) [@saqib](https://forum.opencv.org/u/saqib)
#### Post date: [September 20, 2023, 6:30am UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597/5 "2023-09-20T06:30:53Z")

</div>

> [@berak](#):
>
> error

code is simple!

> **Main.cpp**
>
> `
> 
> #include <opencv2/opencv.hpp> 
> #include <opencv2/core/core.hpp> 
> #include <opencv2/imgproc/imgproc.hpp> 
> #include <opencv2//video.hpp> 
> #include <opencv2/videoio/videoio.hpp> 
> #include <opencv2/highgui/highgui.hpp> 
> #include <iostream> 
> int main()
> {
> cv::VideoCapture cap(1); //if(!cap.isOpened()) throw std::runtime_error(“Can’t open camera!”);
> cv::Mat frame; // = cv::Mat::zeros(640, 480, CV_8U);
> cv::namedWindow(“Test”);
> while(true) {
> cap >> frame;
> cv::imshow(“Test”, frame);
> ```
> if(cv::waitKey(20) == 27) break;
> }
> 
> std::cout << "Hello, World!" << std::endl;
> return 0;
> 
> ```
> }
> 
> `

  

> **CMakeLists.txt**
>
> `
> 
> cmake_minimum_required(VERSION 3.17)
> project(Test)
> set(CMAKE_CXX_STANDARD 14)
> find_package(OpenCV REQUIRED)
> #message(${CMAKE_MODULE_PATH})
> include_directories({OpenCV_INCLUDE_DIRS})
> #set(OpenCV_LIB_PATH "{OpenCV_DIR}/lib")
> add_executable(Test main.cpp)
> target_link_libraries(Test ${OpenCV_LIBS})
> 
> `
> 
> _"OpenCV/x64/mingw/bin"_ is in PATH!

---

<div class="post-metadata">

### Author: ![saqib](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/saqib/32/8741_2.png) [@saqib](https://forum.opencv.org/u/saqib)
#### Post date: [September 20, 2023, 6:41am UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597/6 "2023-09-20T06:41:27Z")

</div>

I would just like to build modules separately because opencv\_world is just too large to ship with my little projects that use at max two libraries, so if you can help with that i would be pleased, because my system is slow it already took me freaking **8\*\*hours** to build, only to realize it combined all libs into one.

---

<div class="post-metadata">

### Author: ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)
#### Post date: [September 20, 2023, 6:44am UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597/7 "2023-09-20T06:44:21Z")

</div>

> [@saqib](#):
>
> if(!cap.isOpened())

indeed, you must check this ! and this:

> [@saqib](#):
>
> cap \>\> frame;

```
if (frame.empty())) // ALARM !

```

most probably, you capture did not open, try index 0 instead

---

<div class="post-metadata">

### Author: ![saqib](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/saqib/32/8741_2.png) [@saqib](https://forum.opencv.org/u/saqib)
#### Post date: [September 20, 2023, 11:03am UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597/8 "2023-09-20T11:03:57Z")

</div>

It worked, for some reason Clion shell couldn’t see Environment variables thats why it was crashing, however my question remains same can i build with slight change to config without building it from scratch, i tried modifying Makefile and Cmake files but they are just too many. regenerating obviously starts building from very start.

---

<div class="post-metadata">

### Author: ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)
#### Post date: [September 20, 2023, 11:14am UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597/9 "2023-09-20T11:14:14Z")

</div>

> [@saqib](#):
>
> I would just like to build modules separately

easy:

```
cmake -DBUILD_opencv_world=OFF

```

> [@saqib](#):
>
> thats why it was crashing,

i’m afraid, you’re still making wrong guesses.

if the video capture does not open, it’s because of wrong user supplied params (id, backend) _at runtime_, it’s not a linking problem

---

<div class="post-metadata">

### Author: ![saqib](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/saqib/32/8741_2.png) [@saqib](https://forum.opencv.org/u/saqib)
#### Post date: [September 20, 2023, 11:16am UTC](https://forum.opencv.org/t/mingw-build-error-opencv-4-8-0/14597/10 "2023-09-20T11:16:12Z")

</div>

Thanks that really helped… yes I got that crashing part under control now.
