static opencv build for QT using MinGW. mingw32-make: *** [all] Error 2



  • I am having a problem when trying to compile a static opencv build for QT using MinGW.
    This is a log of the failed build:
    ...
    [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap
    _images.cpp.obj
    cc1plus.exe: warning: C:/qtOpenCV/opencv/build/modules/videoio/precomp.hpp.gch/o
    pencv_videoio_Debug.gch: created and used with differing settings of '-mvzeroupp
    er'
    [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap
    _mjpeg_encoder.cpp.obj
    cc1plus.exe: warning: C:/qtOpenCV/opencv/build/modules/videoio/precomp.hpp.gch/o
    pencv_videoio_Debug.gch: created and used with differing settings of '-mvzeroupp
    er'
    [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap
    _mjpeg_decoder.cpp.obj
    cc1plus.exe: warning: C:/qtOpenCV/opencv/build/modules/videoio/precomp.hpp.gch/o
    pencv_videoio_Debug.gch: created and used with differing settings of '-mvzeroupp
    er'
    [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap
    _cmu.cpp.obj
    cc1plus.exe: warning: C:/qtOpenCV/opencv/build/modules/videoio/precomp.hpp.gch/o
    pencv_videoio_Debug.gch: created and used with differing settings of '-mvzeroupp
    er'
    [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap
    _dshow.cpp.obj
    cc1plus.exe: warning: C:/qtOpenCV/opencv/build/modules/videoio/precomp.hpp.gch/o
    pencv_videoio_Debug.gch: created and used with differing settings of '-mvzeroupp
    er'
    [ 39%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap
    _vfw.cpp.obj
    cc1plus.exe: warning: C:/qtOpenCV/opencv/build/modules/videoio/precomp.hpp.gch/o
    pencv_videoio_Debug.gch: created and used with differing settings of '-mvzeroupp
    er'
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp: In member function '
    virtual bool CvCaptureCAM_VFW::open(int)':
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::uiImageWidth' [-Wmissing-field-initial
    izers]
    CAPSTATUS status = {};
    ^
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::uiImageHeight' [-Wmissing-field-initia
    lizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::fLiveWindow' [-Wmissing-field-initiali
    zers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::fOverlayWindow' [-Wmissing-field-initi
    alizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::fScale' [-Wmissing-field-initializers]

    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::ptScroll' [-Wmissing-field-initializer
    s]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::fUsingDefaultPalette' [-Wmissing-field
    -initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::fAudioHardware' [-Wmissing-field-initi
    alizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::fCapFileExists' [-Wmissing-field-initi
    alizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::dwCurrentVideoFrame' [-Wmissing-field-
    initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::dwCurrentVideoFramesDropped' [-Wmissin
    g-field-initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::dwCurrentWaveSamples' [-Wmissing-field
    -initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::dwCurrentTimeElapsedMS' [-Wmissing-fie
    ld-initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::hPalCurrent' [-Wmissing-field-initiali
    zers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::fCapturingNow' [-Wmissing-field-initia
    lizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::dwReturn' [-Wmissing-field-initializer
    s]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::wNumVideoAllocated' [-Wmissing-field-i
    nitializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:414:29: warning: miss
    ing initializer for member 'tagCapStatus::wNumAudioAllocated' [-Wmissing-field-i
    nitializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp: In member function '
    virtual double CvCaptureCAM_VFW::getProperty(int) const':
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::dwRequestMicroSecPerFrame' [-Wmissi
    ng-field-initializers]
    CAPTUREPARMS params = {};
    ^
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fMakeUserHitOKToCapture' [-Wmissing
    -field-initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::wPercentDropForError' [-Wmissing-fi
    eld-initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fYield' [-Wmissing-field-initialize
    rs]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::dwIndexSize' [-Wmissing-field-initi
    alizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::wChunkGranularity' [-Wmissing-field
    -initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fUsingDOSMemory' [-Wmissing-field-i
    nitializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::wNumVideoRequested' [-Wmissing-fiel
    d-initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fCaptureAudio' [-Wmissing-field-ini
    tializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::wNumAudioRequested' [-Wmissing-fiel
    d-initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::vKeyAbort' [-Wmissing-field-initial
    izers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fAbortLeftMouse' [-Wmissing-field-i
    nitializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fAbortRightMouse' [-Wmissing-field-
    initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fLimitEnabled' [-Wmissing-field-ini
    tializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::wTimeLimit' [-Wmissing-field-initia
    lizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fMCIControl' [-Wmissing-field-initi
    alizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fStepMCIDevice' [-Wmissing-field-in
    itializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::dwMCIStartTime' [-Wmissing-field-in
    itializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::dwMCIStopTime' [-Wmissing-field-ini
    tializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fStepCaptureAt2x' [-Wmissing-field-
    initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::wStepCaptureAverageFrames' [-Wmissi
    ng-field-initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::dwAudioBufferSize' [-Wmissing-field
    -initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::fDisableWriteCache' [-Wmissing-fiel
    d-initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:556:36: warning: miss
    ing initializer for member 'tagCaptureParms::AVStreamMaster' [-Wmissing-field-in
    itializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp: In member function '
    virtual bool CvCaptureCAM_VFW::setProperty(int, double)':
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::uiImageWidth' [-Wmissing-field-initial
    izers]
    CAPSTATUS status = {};
    ^
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::uiImageHeight' [-Wmissing-field-initia
    lizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::fLiveWindow' [-Wmissing-field-initiali
    zers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::fOverlayWindow' [-Wmissing-field-initi
    alizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::fScale' [-Wmissing-field-initializers]

    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::ptScroll' [-Wmissing-field-initializer
    s]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::fUsingDefaultPalette' [-Wmissing-field
    -initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::fAudioHardware' [-Wmissing-field-initi
    alizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::fCapFileExists' [-Wmissing-field-initi
    alizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::dwCurrentVideoFrame' [-Wmissing-field-
    initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::dwCurrentVideoFramesDropped' [-Wmissin
    g-field-initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::dwCurrentWaveSamples' [-Wmissing-field
    -initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::dwCurrentTimeElapsedMS' [-Wmissing-fie
    ld-initializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::hPalCurrent' [-Wmissing-field-initiali
    zers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::fCapturingNow' [-Wmissing-field-initia
    lizers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::dwReturn' [-Wmissing-field-initializer
    s]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::wNumVideoAllocated' [-Wmissing-field-i
    nitializers]
    C:\qtOpenCV\opencv\sources\modules\videoio\src\cap_vfw.cpp:631:37: warning: miss
    ing initializer for member 'tagCapStatus::wNumAudioAllocated' [-Wmissing-field-i
    nitializers]
    [ 40%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap
    ffmpeg.cpp.obj
    cc1plus.exe: warning: C:/qtOpenCV/opencv/build/modules/videoio/precomp.hpp.gch/o
    pencv_videoio_Debug.gch: created and used with differing settings of '-mvzeroupp
    er'
    [ 40%] Linking CXX shared library ....\bin\libopencv_videoio310.dll
    Copying C:/qtOpenCV/opencv/sources/3rdparty/ffmpeg/opencv_ffmpeg.dll to the outp
    ut directory
    [ 40%] Built target opencv_videoio
    [ 42%] Generating opencv_perf_core_pch_dephelp.cxx
    Scanning dependencies of target opencv_perf_core_pch_dephelp
    [ 42%] Building CXX object modules/core/CMakeFiles/opencv_perf_core_pch_dephelp.
    dir/opencv_perf_core_pch_dephelp.cxx.obj
    [ 42%] Linking CXX static library ....\lib\libopencv_perf_core_pch_dephelp.a
    [ 42%] Built target opencv_perf_core_pch_dephelp
    Scanning dependencies of target pch_Generate_opencv_perf_core
    [ 42%] Generating perf_precomp.hpp
    [ 42%] Generating perf_precomp.hpp.gch/opencv_perf_core_Release.gch
    [ 42%] Built target pch_Generate_opencv_perf_core
    Scanning dependencies of target opencv_ts_pch_dephelp
    [ 42%] Building CXX object modules/ts/CMakeFiles/opencv_ts_pch_dephelp.dir/openc
    v_ts_pch_dephelp.cxx.obj
    [ 42%] Linking CXX static library ....\lib\libopencv_ts_pch_dephelp.a
    [ 42%] Built target opencv_ts_pch_dephelp
    [ 42%] Generating precomp.hpp.gch/opencv_ts_Release.gch
    [ 42%] Built target pch_Generate_opencv_ts
    Scanning dependencies of target opencv_highgui_pch_dephelp_automoc
    [ 42%] Automatic moc for target opencv_highgui_pch_dephelp
    [ 42%] Built target opencv_highgui_pch_dephelp_automoc
    [ 42%] Generating opencv_highgui_pch_dephelp.cxx
    Scanning dependencies of target opencv_highgui_pch_dephelp
    [ 42%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui_pch_dephelp
    .dir/opencv_highgui_pch_dephelp.cxx.obj
    [ 42%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui_pch_dephelp
    .dir/opencv_highgui_pch_dephelp_automoc.cpp.obj
    [ 42%] Linking CXX static library ....\lib\libopencv_highgui_pch_dephelp.a
    [ 42%] Built target opencv_highgui_pch_dephelp
    Scanning dependencies of target pch_Generate_opencv_highgui
    [ 42%] Generating precomp.hpp
    [ 42%] Generating precomp.hpp.gch/opencv_highgui_Release.gch
    [ 42%] Built target pch_Generate_opencv_highgui
    Scanning dependencies of target opencv_highgui_automoc
    [ 42%] Automatic moc for target opencv_highgui
    Generating moc_window_QT.cpp
    [ 42%] Built target opencv_highgui_automoc
    [ 42%] Generating qrc_window_QT.cpp
    Scanning dependencies of target opencv_highgui
    [ 42%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/win
    dow.cpp.obj
    [ 42%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/win
    dow_QT.cpp.obj
    [ 42%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/qrc_win
    dow_QT.cpp.obj
    [ 43%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/opencv

    highgui_automoc.cpp.obj
    [ 43%] Linking CXX shared library ....\bin\libopencv_highgui310.dll
    CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$
    _ZN10CvWinModelD1Ev[ZN10CvWinModelD1Ev]+0x7): undefined reference to _imp___Z N7QWidgetD2Ev' CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$ _ZN10CvWinModelD0Ev[__ZN10CvWinModelD0Ev]+0x15): undefined reference toimp
    ZN7QWidgetD2Ev'
    C:/QtCreator/Tools/mingw492_32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../..
    /i686-w64-mingw32/bin/ld.exe: CMakeFiles\opencv_highgui.dir/objects.a(window_QT.
    cpp.obj): bad reloc address 0x15 in section `.text$_ZN10CvWinModelD0Ev[_ZN10CvW
    inModelD0Ev]'
    collect2.exe: error: ld returned 1 exit status
    modules\highgui\CMakeFiles\opencv_highgui.dir\build.make:201: recipe for target
    'bin/libopencv_highgui310.dll' failed
    mingw32-make[2]: *** [bin/libopencv_highgui310.dll] Error 1
    CMakeFiles\Makefile2:4735: recipe for target 'modules/highgui/CMakeFiles/opencv

    highgui.dir/all' failed
    mingw32-make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2

    makefile:159: recipe for target 'all' failed
    mingw32-make: *** [all] Error 2

    C:\qtOpenCV\opencv\build>mingw32-make



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.