summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2021-09-29 15:42:34 +0200
committerKhem Raj <raj.khem@gmail.com>2021-09-29 07:23:40 -0700
commitcafcc65e746763b22407a13ce7aad9e098018c11 (patch)
treedec6be8d42be2f64fe3fef33167a391e57cc55f6 /meta-oe
parentd93099003aa83e2346fbba97d33ff1f3209ec558 (diff)
downloadmeta-openembedded-cafcc65e746763b22407a13ce7aad9e098018c11.tar.gz
opencv: fix build with protobuf-3.18 when dnn PACKAGECONFIG is enabled
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-support/opencv/opencv/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch41
-rw-r--r--meta-oe/recipes-support/opencv/opencv_4.5.2.bb1
2 files changed, 42 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/opencv/opencv/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch b/meta-oe/recipes-support/opencv/opencv/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch
new file mode 100644
index 000000000..5d88d1a6a
--- /dev/null
+++ b/meta-oe/recipes-support/opencv/opencv/0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch
@@ -0,0 +1,41 @@
1From 9cfa84313c5833d7295fcf57be93d5d2aaadfd88 Mon Sep 17 00:00:00 2001
2From: Vincent Rabaud <vrabaud@google.com>
3Date: Sat, 10 Jul 2021 00:21:52 +0200
4Subject: [PATCH] Use the one argument version of SetTotalBytesLimit.
5
6The two argument versions has been deprecated, cf
7https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.coded_stream
8
9Upstream-Status: Backport [9cfa84313c5833d7295fcf57be93d5d2aaadfd88 - from master after 4.5.3 tag]
10Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
11---
12 modules/dnn/src/caffe/caffe_io.cpp | 5 +++++
13 1 file changed, 5 insertions(+)
14
15diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp
16index 2fc4d84f46..ebecf95eea 100644
17--- a/modules/dnn/src/caffe/caffe_io.cpp
18+++ b/modules/dnn/src/caffe/caffe_io.cpp
19@@ -92,6 +92,7 @@
20 #ifdef HAVE_PROTOBUF
21 #include <google/protobuf/io/coded_stream.h>
22 #include <google/protobuf/io/zero_copy_stream_impl.h>
23+#include <google/protobuf/stubs/common.h>
24 #include <google/protobuf/text_format.h>
25
26 #include <opencv2/core.hpp>
27@@ -1111,7 +1112,11 @@ static const int kProtoReadBytesLimit = INT_MAX; // Max size of 2 GB minus 1 by
28
29 bool ReadProtoFromBinary(ZeroCopyInputStream* input, Message *proto) {
30 CodedInputStream coded_input(input);
31+#if GOOGLE_PROTOBUF_VERSION >= 3006000
32+ coded_input.SetTotalBytesLimit(kProtoReadBytesLimit);
33+#else
34 coded_input.SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
35+#endif
36
37 return proto->ParseFromCodedStream(&coded_input);
38 }
39--
402.32.0
41
diff --git a/meta-oe/recipes-support/opencv/opencv_4.5.2.bb b/meta-oe/recipes-support/opencv/opencv_4.5.2.bb
index 7eefbccfe..361ac0cb9 100644
--- a/meta-oe/recipes-support/opencv/opencv_4.5.2.bb
+++ b/meta-oe/recipes-support/opencv/opencv_4.5.2.bb
@@ -52,6 +52,7 @@ SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \
52 file://download.patch \ 52 file://download.patch \
53 file://0001-Make-ts-module-external.patch \ 53 file://0001-Make-ts-module-external.patch \
54 file://0001-sfm-link-with-Glog_LIBS.patch;patchdir=../contrib \ 54 file://0001-sfm-link-with-Glog_LIBS.patch;patchdir=../contrib \
55 file://0001-Use-the-one-argument-version-of-SetTotalBytesLimit.patch \
55 " 56 "
56SRC_URI:append:riscv64 = " file://0001-Use-Os-to-compile-tinyxml2.cpp.patch;patchdir=../contrib" 57SRC_URI:append:riscv64 = " file://0001-Use-Os-to-compile-tinyxml2.cpp.patch;patchdir=../contrib"
57 58