All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/opencv4: fix build with protobuf 3.18.0
@ 2021-09-26  8:15 Fabrice Fontaine
  2021-09-26 19:49 ` Arnout Vandecappelle
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2021-09-26  8:15 UTC (permalink / raw)
  To: buildroot; +Cc: Fabrice Fontaine

Fix the following build failure raised since bump of protobuf to version
3.18.0 in commit c28924920d6df13a61879e3b301f71dd5edf2880:

/home/giuliobenetti/autobuild/run/instance-0/output-1/build/opencv3-3.4.15/modules/dnn/src/caffe/caffe_io.cpp: In function 'bool cv::dnn::ReadProtoFromBinary(google::protobuf::io::ZeroCopyInputStream*, google::protobuf::Message*)':
/home/giuliobenetti/autobuild/run/instance-0/output-1/build/opencv3-3.4.15/modules/dnn/src/caffe/caffe_io.cpp:1114:67: error: no matching function for call to 'google::protobuf::io::CodedInputStream::SetTotalBytesLimit(const int&, int)'
 1114 |     coded_input.SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
      |                                                                   ^
In file included from /home/giuliobenetti/autobuild/run/instance-0/output-1/build/opencv3-3.4.15/modules/dnn/src/caffe/caffe_io.cpp:93:
/home/giuliobenetti/autobuild/run/instance-0/output-1/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/google/protobuf/io/coded_stream.h:401:8: note: candidate: 'void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int)'
  401 |   void SetTotalBytesLimit(int total_bytes_limit);
      |        ^~~~~~~~~~~~~~~~~~
/home/giuliobenetti/autobuild/run/instance-0/output-1/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/google/protobuf/io/coded_stream.h:401:8: note:   candidate expects 1 argument, 2 provided

Fixes:
 - http://autobuild.buildroot.org/results/2856060cb59250f4ef7ab75a848a3dc0be9b821b

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...gument-version-of-SetTotalBytesLimit.patch | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 package/opencv4/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch

diff --git a/package/opencv4/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch b/package/opencv4/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch
new file mode 100644
index 0000000000..d169e04ef2
--- /dev/null
+++ b/package/opencv4/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch
@@ -0,0 +1,39 @@
+From 9cfa84313c5833d7295fcf57be93d5d2aaadfd88 Mon Sep 17 00:00:00 2001
+From: Vincent Rabaud <vrabaud@google.com>
+Date: Sat, 10 Jul 2021 00:21:52 +0200
+Subject: [PATCH] Use the one argument version of SetTotalBytesLimit.
+
+The two argument versions has been deprecated, cf
+https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.coded_stream
+
+[Retrieved from:
+https://github.com/opencv/opencv/commit/9cfa84313c5833d7295fcf57be93d5d2aaadfd88]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ modules/dnn/src/caffe/caffe_io.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp
+index 2fc4d84f4604..ebecf95eea3a 100644
+--- a/modules/dnn/src/caffe/caffe_io.cpp
++++ b/modules/dnn/src/caffe/caffe_io.cpp
+@@ -92,6 +92,7 @@
+ #ifdef HAVE_PROTOBUF
+ #include <google/protobuf/io/coded_stream.h>
+ #include <google/protobuf/io/zero_copy_stream_impl.h>
++#include <google/protobuf/stubs/common.h>
+ #include <google/protobuf/text_format.h>
+ 
+ #include <opencv2/core.hpp>
+@@ -1111,7 +1112,11 @@ static const int kProtoReadBytesLimit = INT_MAX;  // Max size of 2 GB minus 1 by
+ 
+ bool ReadProtoFromBinary(ZeroCopyInputStream* input, Message *proto) {
+     CodedInputStream coded_input(input);
++#if GOOGLE_PROTOBUF_VERSION >= 3006000
++    coded_input.SetTotalBytesLimit(kProtoReadBytesLimit);
++#else
+     coded_input.SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
++#endif
+ 
+     return proto->ParseFromCodedStream(&coded_input);
+ }
-- 
2.33.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/opencv4: fix build with protobuf 3.18.0
  2021-09-26  8:15 [Buildroot] [PATCH 1/1] package/opencv4: fix build with protobuf 3.18.0 Fabrice Fontaine
@ 2021-09-26 19:49 ` Arnout Vandecappelle
  0 siblings, 0 replies; 2+ messages in thread
From: Arnout Vandecappelle @ 2021-09-26 19:49 UTC (permalink / raw)
  To: Fabrice Fontaine, buildroot



On 26/09/2021 10:15, Fabrice Fontaine wrote:
> Fix the following build failure raised since bump of protobuf to version
> 3.18.0 in commit c28924920d6df13a61879e3b301f71dd5edf2880:
> 
> /home/giuliobenetti/autobuild/run/instance-0/output-1/build/opencv3-3.4.15/modules/dnn/src/caffe/caffe_io.cpp: In function 'bool cv::dnn::ReadProtoFromBinary(google::protobuf::io::ZeroCopyInputStream*, google::protobuf::Message*)':
> /home/giuliobenetti/autobuild/run/instance-0/output-1/build/opencv3-3.4.15/modules/dnn/src/caffe/caffe_io.cpp:1114:67: error: no matching function for call to 'google::protobuf::io::CodedInputStream::SetTotalBytesLimit(const int&, int)'
>   1114 |     coded_input.SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
>        |                                                                   ^
> In file included from /home/giuliobenetti/autobuild/run/instance-0/output-1/build/opencv3-3.4.15/modules/dnn/src/caffe/caffe_io.cpp:93:
> /home/giuliobenetti/autobuild/run/instance-0/output-1/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/google/protobuf/io/coded_stream.h:401:8: note: candidate: 'void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int)'
>    401 |   void SetTotalBytesLimit(int total_bytes_limit);
>        |        ^~~~~~~~~~~~~~~~~~
> /home/giuliobenetti/autobuild/run/instance-0/output-1/host/mipsel-buildroot-linux-gnu/sysroot/usr/include/google/protobuf/io/coded_stream.h:401:8: note:   candidate expects 1 argument, 2 provided
> 
> Fixes:
>   - http://autobuild.buildroot.org/results/2856060cb59250f4ef7ab75a848a3dc0be9b821b
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

  Applied to master, thanks.

  Regards,
  Arnout

> ---
>   ...gument-version-of-SetTotalBytesLimit.patch | 39 +++++++++++++++++++
>   1 file changed, 39 insertions(+)
>   create mode 100644 package/opencv4/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch
> 
> diff --git a/package/opencv4/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch b/package/opencv4/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch
> new file mode 100644
> index 0000000000..d169e04ef2
> --- /dev/null
> +++ b/package/opencv4/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch
> @@ -0,0 +1,39 @@
> +From 9cfa84313c5833d7295fcf57be93d5d2aaadfd88 Mon Sep 17 00:00:00 2001
> +From: Vincent Rabaud <vrabaud@google.com>
> +Date: Sat, 10 Jul 2021 00:21:52 +0200
> +Subject: [PATCH] Use the one argument version of SetTotalBytesLimit.
> +
> +The two argument versions has been deprecated, cf
> +https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.coded_stream
> +
> +[Retrieved from:
> +https://github.com/opencv/opencv/commit/9cfa84313c5833d7295fcf57be93d5d2aaadfd88]
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +---
> + modules/dnn/src/caffe/caffe_io.cpp | 5 +++++
> + 1 file changed, 5 insertions(+)
> +
> +diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp
> +index 2fc4d84f4604..ebecf95eea3a 100644
> +--- a/modules/dnn/src/caffe/caffe_io.cpp
> ++++ b/modules/dnn/src/caffe/caffe_io.cpp
> +@@ -92,6 +92,7 @@
> + #ifdef HAVE_PROTOBUF
> + #include <google/protobuf/io/coded_stream.h>
> + #include <google/protobuf/io/zero_copy_stream_impl.h>
> ++#include <google/protobuf/stubs/common.h>
> + #include <google/protobuf/text_format.h>
> +
> + #include <opencv2/core.hpp>
> +@@ -1111,7 +1112,11 @@ static const int kProtoReadBytesLimit = INT_MAX;  // Max size of 2 GB minus 1 by
> +
> + bool ReadProtoFromBinary(ZeroCopyInputStream* input, Message *proto) {
> +     CodedInputStream coded_input(input);
> ++#if GOOGLE_PROTOBUF_VERSION >= 3006000
> ++    coded_input.SetTotalBytesLimit(kProtoReadBytesLimit);
> ++#else
> +     coded_input.SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
> ++#endif
> +
> +     return proto->ParseFromCodedStream(&coded_input);
> + }
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-26 19:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26  8:15 [Buildroot] [PATCH 1/1] package/opencv4: fix build with protobuf 3.18.0 Fabrice Fontaine
2021-09-26 19:49 ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.