Repository navigation
Closed
Description
Help
I compile opencv-4.0.0-alpha using mingw-w64.
Should I solve the following error?
Compiling Environment
- Windows-10-64bit
- MinGW-x64-4.8.1-release-posix-seh-rev5
- CMake-3.12.0
- opencv-4.0.0-alpha
Configuration
General configuration for OpenCV 4.0.0-alpha =====================================
Version control: unknown
Platform:
Timestamp: 2018-09-25T08:37:52Z
Host: Windows 10.0.17134 AMD64
CMake: 3.12.0
CMake generator: MinGW Makefiles
CMake build tool: E:/MinGW-w64/x64-4.8.1-release-posix-seh-rev5/mingw64/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
requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_1 (4 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 (6 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (10 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
C/C++:
Built as dynamic libs?: YES
C++ Compiler: E:/MinGW-w64/x64-4.8.1-release-posix-seh-rev5/mingw64/bin/g++.exe (ver 4.8.1)
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 -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 -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 -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: E:/MinGW-w64/x64-4.8.1-release-posix-seh-rev5/mingw64/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 -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 -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 -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:
3rdparty dependencies:
OpenCV modules:
To be built: calib3d core dnn features2d flann highgui imgcodecs imgproc java_bindings_generator ml objdetect photo python_bindings_generator shape stitching superres ts video videoio videostab
Disabled: js world
Disabled by dependency: -
Unavailable: java python2 python3 viz
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.11)
JPEG: build-libjpeg-turbo (ver 1.5.3-62)
WEBP: build (ver encoder: 0x020e)
PNG: build (ver 1.6.34)
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:
Video for Windows: YES
DC1394: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (ver 58.18.100)
avformat: YES (ver 58.12.100)
avutil: YES (ver 56.14.100)
swscale: YES (ver 5.1.100)
avresample: YES (ver 4.0.0)
GStreamer: NO
DirectShow: YES
Media Foundation: 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: E:/opencv-4.0.0-alpha/opencv-4.0.0-alpha/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python (for build): E:/Python37-32/python.exe
Java:
ant: NO
JNI: C:/Program Files (x86)/Java/jdk1.8.0_181/include C:/Program Files (x86)/Java/jdk1.8.0_181/include/win32 C:/Program Files (x86)/Java/jdk1.8.0_181/include
Java wrappers: NO
Java tests: NO
Install to: E:/opencv-4.0.0-alpha/opencv-4.0.0-mingw64-build/install
-----------------------------------------------------------------
Error log
......
E:\opencv-4.0.0-alpha\opencv-4.0.0-alpha\modules\videoio\src\cap_msmf.cpp: In member function 'HRESULT {anonymous}::ComPtr<T>::As({anonymous}::ComPtr<U>&) const [with U = IMF2DBuffer; T = IMFMediaBuffer; HRESULT = long int]':
E:\opencv-4.0.0-alpha\opencv-4.0.0-alpha\modules\videoio\src\cap_msmf.cpp:172:5: error: control reaches end of non-void function [-Werror=return-type]
}
^
E:\opencv-4.0.0-alpha\opencv-4.0.0-alpha\modules\videoio\src\cap_msmf.cpp: In member function 'T* {anonymous}::ComPtr<T>::operator->() const [with T = IMF2DBuffer]':
E:\opencv-4.0.0-alpha\opencv-4.0.0-alpha\modules\videoio\src\cap_msmf.cpp:149:5: error: control reaches end of non-void function [-Werror=return-type]
}
^
E:\opencv-4.0.0-alpha\opencv-4.0.0-alpha\modules\videoio\src\cap_msmf.cpp: In member function 'T* {anonymous}::ComPtr<T>::operator->() const [with T = IMFMediaBuffer]':
E:\opencv-4.0.0-alpha\opencv-4.0.0-alpha\modules\videoio\src\cap_msmf.cpp:149:5: error: control reaches end of non-void function [-Werror=return-type]
}
^
E:\opencv-4.0.0-alpha\opencv-4.0.0-alpha\modules\videoio\src\cap_msmf.cpp: In member function 'T* {anonymous}::ComPtr<T>::operator->() const [with T = IMFSinkWriter]':
E:\opencv-4.0.0-alpha\opencv-4.0.0-alpha\modules\videoio\src\cap_msmf.cpp:149:5: error: control reaches end of non-void function [-Werror=return-type]
}
^
E:\opencv-4.0.0-alpha\opencv-4.0.0-alpha\modules\videoio\src\cap_msmf.cpp: In member function 'T* {anonymous}::ComPtr<T>::Get() const [with T = IMFMediaBuffer]':
E:\opencv-4.0.0-alpha\opencv-4.0.0-alpha\modules\videoio\src\cap_msmf.cpp:158:5: error: control reaches end of non-void function [-Werror=return-type]
}
^
cc1plus.exe: some warnings being treated as errors
modules\videoio\CMakeFiles\opencv_videoio.dir\build.make:188: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_msmf.cpp.obj' failed
mingw32-make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_msmf.cpp.obj] Error 1
CMakeFiles\Makefile2:2556: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed
mingw32-make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
mingw32-make[1]: *** Waiting for unfinished jobs....
[ 58%] Linking CXX shared library ..\..\bin\libopencv_dnn400.dll
[ 59%] Built target opencv_dnn
Makefile:161: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
Activity
[-]Failed to compile opencv-4.0.0-alpha using Mingw-64[/-][+]Failed to compile opencv-4.0.0-alpha using mingw-w64[/+]berak commentedon Sep 25, 2018
mingw can't compile the MSMF capture code, you have to disable it:
huihut commentedon Sep 25, 2018
@berak Thanks, that error was solved, but I encountered another error:
'M_PI' was not declared in this scopeberak commentedon Sep 25, 2018
change it to
CV_PI.later mingw versions (4.8.1 is very old) do have M_PI, so maybe update it ?
huihut commentedon Sep 25, 2018
@berak Thanks, I succeeded in compiling opencv through modifying it.
Which branch(tree) should I make a pr?
berak commentedon Sep 25, 2018
if so, 3.4.
huihut commentedon Sep 25, 2018
I modified
chessboard.cpp,chessboard.hppandtest_chesscorners.cppat master, because 3.4 does not havechessboard.cppandchessboard.hppAnd I can compile because I modified these three files.
#12645
berak commentedon Sep 25, 2018
apologies, i was wrong about the branch, then, use the same you have (4.0.0-alpha).
huihut commentedon Sep 25, 2018
emmm, 4.0.0-alpha is a tag, I can't change it. What should I do?

berak commentedon Sep 25, 2018
uff. ofc.
but again, your pr is all looking fine. why not leave everything "as is" now ?
huihut commentedon Sep 26, 2018
OK, then I won't be PR again.
1iver commentedon Mar 10, 2022
Again, OpenCV 4.5.5, the same kind problem appears, what a terrible experience.
berak commentedon Mar 10, 2022
@1iver -- which "same problem", please ?
1iver commentedon Mar 11, 2022
Thanks, @berak This is the first error. Build progress failed when compiling cap_msmf.cpp. It has something to do with these files "mfplay.h", "evr.h", "cap_msmf.cpp". From this post, I thought it was possible to build MXMF using mingw while I end in failure.
berak commentedon Mar 11, 2022
again, mingw does not have the needed headers / code for MSMF,
that's why you still have to disable it when building the opencv libs: