-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
OpenCV does not support protobuf 3.x #23791
Copy link
Copy link
Closed
Description
System Information
- OpenCV version: 4.7.0
- Operating System / Platform: Ubuntu 22.04
- Compiler & compiler version: gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
- Python version: Python 3.10.6
Detailed description
Please refer to Pastebin Failed2BuildOpenCV_Protobuf23.2:
A part of the errors are listed as:
[ 29%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/misc/caffe/opencv-caffe.pb.cc.o
cd ....../opencv/build/modules/dnn && /usr/bin/ccache /usr/bin/c++ -DCVAPI_EXPORTS -DCV_CUDA4DNN=1 -DENABLE_PLUGINS -DHAVE_FLATBUFFERS=1 -DHAVE_PROTOBUF=1 -DOPENCV_DNN_EXTERNAL_PROTOBUF=1 -DVK_NO_PROTOTYPES -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I....../opencv/build/3rdparty/ippicv/ippicv_lnx/icv/include -I....../opencv/build/3rdparty/ippicv/ippicv_lnx/iw/include -I....../opencv/build -I....../opencv/3rdparty/include -I....../opencv/modules/dnn/include -I....../opencv/build/modules/dnn -I....../opencv_contrib/modules/cudev/include -I....../opencv/modules/core/include -I....../opencv/modules/imgproc/include -I....../opencv/modules/dnn/misc/caffe -I....../opencv/modules/dnn/misc/tensorflow -I....../opencv/modules/dnn/misc/onnx -I....../opencv/modules/dnn/misc/tflite -isystem /usr/local/cuda/include -isystem /usr/include/eigen3 -isystem ....../opencv/3rdparty/flatbuffers/include -std=c++17 -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fno-omit-frame-pointer -pg -g -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -Wno-deprecated -Wno-missing-declarations -Wno-shadow -Wno-unused-parameter -Wno-sign-compare -Wno-undef -Wno-invalid-offsetof -O3 -DNDEBUG -DNDEBUG -std=c++11 -fPIC -Wno-suggest-override -Wno-array-bounds -MD -MT modules/dnn/CMakeFiles/opencv_dnn.dir/misc/caffe/opencv-caffe.pb.cc.o -MF CMakeFiles/opencv_dnn.dir/misc/caffe/opencv-caffe.pb.cc.o.d -o CMakeFiles/opencv_dnn.dir/misc/caffe/opencv-caffe.pb.cc.o -c ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.cc
In file included from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.cc:4:
....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
17 | #error This file was generated by an older version of protoc which is
| ^~~~~
....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
18 | #error incompatible with your Protocol Buffer headers. Please
| ^~~~~
....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.
19 | #error regenerate this file with a newer version of protoc.
| ^~~~~
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:130,
from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.h:23,
from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.cc:4:
/usr/local/include/google/protobuf/stubs/common.h:63:2: error: #error "C++ versions less than C++14 are not supported."
63 | #error "C++ versions less than C++14 are not supported."
| ^~~~~
In file included from /usr/local/include/google/protobuf/arena.h:52,
from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.h:24,
from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.cc:4:
/usr/local/include/google/protobuf/arena_align.h: In member function ‘constexpr size_t google::protobuf::internal::ArenaAlign::Padded(size_t) const’:
/usr/local/include/google/protobuf/arena_align.h:154:3: error: body of ‘constexpr’ function ‘constexpr size_t google::protobuf::internal::ArenaAlign::Padded(size_t) const’ not a return-statement
154 | }
| ^
/usr/local/include/google/protobuf/arena_align.h: At global scope:
/usr/local/include/google/protobuf/arena_align.h:203:18: error: ‘ArenaAlignAs’ function uses ‘auto’ type specifier without trailing return type
203 | inline constexpr auto ArenaAlignAs() {
| ^~~~
/usr/local/include/google/protobuf/arena_align.h:203:18: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/google/protobuf/arena_align.h:209:18: error: ‘ArenaAlignOf’ function uses ‘auto’ type specifier without trailing return type
209 | inline constexpr auto ArenaAlignOf() {
| ^~~~
/usr/local/include/google/protobuf/arena_align.h:209:18: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
In file included from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.h:24,
from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.cc:4:
/usr/local/include/google/protobuf/arena.h: In member function ‘void google::protobuf::Arena::Own(T*)’:
/usr/local/include/google/protobuf/arena.h:363:14: error: ‘conditional_t’ in namespace ‘std’ does not name a template type; did you mean ‘conditional’?
363 | std::conditional_t<std::is_convertible<T*, MessageLite*>::value,
| ^~~~~~~~~~~~~
| conditional
/usr/local/include/google/protobuf/arena.h:366:36: error: ‘TypeToUse’ does not name a type
366 | impl_.AddCleanup(static_cast<TypeToUse*>(object),
| ^~~~~~~~~
/usr/local/include/google/protobuf/arena.h:366:45: error: expected ‘>’ before ‘*’ token
366 | impl_.AddCleanup(static_cast<TypeToUse*>(object),
| ^
/usr/local/include/google/protobuf/arena.h:366:45: error: expected ‘(’ before ‘*’ token
/usr/local/include/google/protobuf/arena.h:366:46: error: expected primary-expression before ‘>’ token
366 | impl_.AddCleanup(static_cast<TypeToUse*>(object),
| ^
/usr/local/include/google/protobuf/arena.h:367:55: error: ‘TypeToUse’ was not declared in this scope
367 | &internal::arena_delete_object<TypeToUse>);
| ^~~~~~~~~
In file included from /usr/local/include/google/protobuf/generated_message_table_driven.h:34,
from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.h:26,
from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.cc:4:
/usr/local/include/google/protobuf/map.h: At global scope:
/usr/local/include/google/protobuf/map.h:203:31: error: ‘enable_if_t’ is not a member of ‘std’
203 | struct KeyForBaseImpl<T, std::enable_if_t<std::is_integral<T>::value &&
| ^~~~~~~~~~~
/usr/local/include/google/protobuf/map.h:203:31: note: ‘std::enable_if_t’ is only available from C++14 onwards
/usr/local/include/google/protobuf/map.h:203:31: error: ‘enable_if_t’ is not a member of ‘std’
/usr/local/include/google/protobuf/map.h:203:31: note: ‘std::enable_if_t’ is only available from C++14 onwards
/usr/local/include/google/protobuf/map.h:204:62: error: type/value mismatch at argument 2 in template parameter list for ‘template<class T, class> struct google::protobuf::internal::KeyForBaseImpl’
204 | std::is_signed<T>::value>> {
| ^~~~~
/usr/local/include/google/protobuf/map.h:204:62: note: expected a type, got ‘((<expression error> < std::is_integral<_Tp>::value) && std::is_signed<_Tp>::value)’
/usr/local/include/google/protobuf/map.h:204:67: error: expected unqualified-id before ‘>’ token
204 | std::is_signed<T>::value>> {
| ^~
/usr/local/include/google/protobuf/map.h:300:25: error: ‘conditional_t’ in namespace ‘std’ does not name a template type; did you mean ‘conditional’?
300 | using KeyForTree = std::conditional_t<std::is_integral<T>::value, uint64_t,
| ^~~~~~~~~~~~~
| conditional
/usr/local/include/google/protobuf/map.h:305:10: error: ‘conditional_t’ is not a member of ‘std’; did you mean ‘conditional’?
305 | std::conditional_t<std::is_integral<T>::value, uint64_t, T>>::less;
| ^~~~~~~~~~~~~
| conditional
/usr/local/include/google/protobuf/map.h:305:10: error: ‘conditional_t’ is not a member of ‘std’; did you mean ‘conditional’?
305 | std::conditional_t<std::is_integral<T>::value, uint64_t, T>>::less;
| ^~~~~~~~~~~~~
| conditional
/usr/local/include/google/protobuf/map.h:305:62: error: wrong number of template arguments (3, should be 1)
305 | std::conditional_t<std::is_integral<T>::value, uint64_t, T>>::less;
| ^
/usr/local/include/google/protobuf/map.h:214:8: note: provided for ‘template<class key_type> struct google::protobuf::internal::TransparentSupport’
214 | struct TransparentSupport {
| ^~~~~~~~~~~~~~~~~~
/usr/local/include/google/protobuf/map.h:304:30: error: expected nested-name-specifier
304 | using LessForTree = typename TransparentSupport<
| ^~~~~~~~~~~~~~~~~~~
305 | std::conditional_t<std::is_integral<T>::value, uint64_t, T>>::less;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/google/protobuf/map.h:309:14: error: ‘KeyForTree’ was not declared in this scope; did you mean ‘KeyForBase’?
309 | std::map<KeyForTree<Key>, NodeBase*, LessForTree<Key>,
| ^~~~~~~~~~
| KeyForBase
/usr/local/include/google/protobuf/map.h:309:28: error: wrong number of template arguments (1, should be at least 2)
309 | std::map<KeyForTree<Key>, NodeBase*, LessForTree<Key>,
| ^
In file included from /usr/include/c++/11/map:61,
from /usr/local/include/google/protobuf/stubs/common.h:40,
from /usr/local/include/google/protobuf/io/coded_stream.h:130,
from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.h:23,
from ....../opencv/modules/dnn/misc/caffe/opencv-caffe.pb.cc:4:
......Steps to reproduce
Just build OpenCV from source, with the NEWEST protobuf pre-installed.
- BUILD_PROTOBUF OFF
- PROTOBUF_UPDATE_FILES OFF
- WITH_PROTOBUF ONIssue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
Reactions are currently unavailable