[resolved]A question about installation 4.7.0

When I was compiling, Windows PowerShell provided feedback:

[  0%] Built target opencv_dnn_plugins
[  0%] Built target opencv_highgui_plugins
Consolidate compiler generated dependencies of target jsimd
[  0%] Built target jsimd
Consolidate compiler generated dependencies of target libopenjp2
[  1%] Built target libopenjp2
[  1%] Built target opencv_videoio_plugins
Consolidate compiler generated dependencies of target zlib
[  2%] Built target zlib
Consolidate compiler generated dependencies of target libpng
[  3%] Built target libpng
Consolidate compiler generated dependencies of target IlmImf
[  8%] Built target IlmImf
Consolidate compiler generated dependencies of target libprotobuf
[  8%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj
In file included from D:\opencv\opencv-4.7.0\3rdparty\protobuf\src\google\protobuf\arena.cc:42:0:
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h: In constructor 'constexpr google::protobuf::internal::WrappedMutex::WrappedMutex()':
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:124:29: error: temporary of non-literal type 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' in a constant expression
   constexpr WrappedMutex() {}
                             ^
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:98:7: note: 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' is not literal because:
 class CallOnceInitializedMutex {
       ^
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:98:7: note:   'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' has a non-trivial destructor
3rdparty\protobuf\CMakeFiles\libprotobuf.dir\build.make:90: recipe for target '3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj' failed
mingw32-make[2]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj] Error 1
CMakeFiles\Makefile2:2202: recipe for target '3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all' failed
mingw32-make[1]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all] Error 2
Makefile:164: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

What can I do?

which mingw is it, exactly ? (g++ --version, please)
(you need a version, that supports posix threads,
else it does not have the resp. mutex headers)

also, just saying, since there is NO mingw containing MSMF
support code, you need to disable :

 WITH_MSMF=OFF    WITH_OBSSENSOR=OFF

and , maybe (idr) also disable hdf/exr support:

WITH_OPENEXR=OFF  BUILD_OPENEXR=OFF

Thank you.

It worked.

But now PowerShell provided feedback:

PS D:\opencv\build\x64\mingw> minGW32-make
[  0%] Built target opencv_dnn_plugins
[  0%] Built target opencv_highgui_plugins
Consolidate compiler generated dependencies of target jsimd
[  0%] Built target jsimd
Consolidate compiler generated dependencies of target libopenjp2
[  1%] Built target libopenjp2
[  1%] Built target opencv_videoio_plugins
Consolidate compiler generated dependencies of target ade
[  1%] Built target ade
Consolidate compiler generated dependencies of target libjpeg-turbo
[  3%] Built target libjpeg-turbo
Consolidate compiler generated dependencies of target zlib
[  4%] Built target zlib
Consolidate compiler generated dependencies of target libtiff
[  7%] Built target libtiff
Consolidate compiler generated dependencies of target libwebp
[ 12%] Built target libwebp
Consolidate compiler generated dependencies of target quirc
[ 12%] Built target quirc
Consolidate compiler generated dependencies of target libpng
[ 13%] Built target libpng
Consolidate compiler generated dependencies of target libprotobuf
[ 13%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj
In file included from D:\opencv\opencv-4.7.0\3rdparty\protobuf\src\google\protobuf\arena.cc:42:0:
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h: In constructor 'constexpr google::protobuf::internal::WrappedMutex::WrappedMutex()':
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:124:29: error: temporary of non-literal type 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' in a constant expression
   constexpr WrappedMutex() {}
                             ^
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:98:7: note: 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' is not literal because:
 class CallOnceInitializedMutex {
       ^
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:98:7: note:   'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' has a non-trivial destructor
3rdparty\protobuf\CMakeFiles\libprotobuf.dir\build.make:90: recipe for target '3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj' failed
mingw32-make[2]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj] Error 1
CMakeFiles\Makefile2:2158: recipe for target '3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all' failed
mingw32-make[1]: *** [3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all] Error 2
Makefile:164: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
PS D:\opencv\build\x64\mingw>

what worked ? still same error, no ?

It seems like it is, but I see the progress has changed from 8 to 13.

Please forgive my ignorance

most probably, bc you skipped a library (less work to do)

I think you are right.

What else can I do?

again, g++ --version, please
( imo you have to switch (dl, install) to a different compiler toolchain, e.g. this, again, you need 64bit, posix, seh support to build opencv )

So,

g++ (tdm64-1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This will not do.

1 Like

屏幕截图 2023-04-24 191129

Is this?

You are right,and there are some changes.

But,somthing is also wrong.

PS D:\opencv\build\x64\mingw> mingw32-make
[  0%] Built target opencv_dnn_plugins
[  0%] Built target opencv_highgui_plugins
[  0%] Built target jsimd
[  1%] Built target libopenjp2
[  1%] Built target opencv_videoio_plugins
[  1%] Built target ade
[  3%] Built target libjpeg-turbo
[  4%] Built target zlib
[  7%] Built target libtiff
[ 12%] Built target libwebp
[ 12%] Built target quirc
[ 13%] Built target libpng
[ 13%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj
In file included from D:\opencv\opencv-4.7.0\3rdparty\protobuf\src\google\protobuf\arena.cc:42:0:
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h: In constructor 'constexpr google::protobuf::internal::WrappedMutex::WrappedMutex()':
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:124:29: error: temporary of non-literal type 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' in a constant expression
   constexpr WrappedMutex() {}
                             ^
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:98:7: note: 'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' is not literal because:
 class CallOnceInitializedMutex {
       ^
D:/opencv/opencv-4.7.0/3rdparty/protobuf/src/google/protobuf/stubs/mutex.h:98:7: note:   'google::protobuf::internal::CallOnceInitializedMutex<std::mutex>' has a non-trivial destructor
mingw32-make[2]: *** [3rdparty\protobuf\CMakeFiles\libprotobuf.dir\build.make:91: 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:2159: 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/all] Error 2
mingw32-make: *** [Makefile:165: all] Error 2
PS D:\opencv\build\x64\mingw> gcc --version
gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

clean build folder (from previous artifacts) & try again, starting with cmake, please

Thank you very much,it’s OK.

1 Like

Which version of MinGW did u use for 64bit OS , posix, seh support to build opencv library ? @cqbztzl

This.

Which version of OpenCV did you use ?

In the title: opencv4.7.0