Skip to contentSkip to conversation

update protobuf package from 3.21.12 to 4.22.2

PATCH In review Xiangyu Chen 3 participants 6 messages Mar 31, 2023 – Jul 30, 2023

lore
Share & tools
lore
#0 lore raw

v4 cover update protobuf package from 3.21.12 to 4.22.2

From: Xiangyu Chen <[email protected]>

The series patches are upgrading protobuf package to latest version and add support which is depending protobuf package.

Changes:
v3->v4:
1. fix build failure under qemuarm
2. fix protobuf-c-native build failure

Tested compiling protobuf/protobuf-native on qemuarm(clang) and x86-64(gcc) Tested compiling protobuf-c/protobuf-c-native on qemuarm(clang) and x86-64(gcc) Tested compiling mosh on qemuarm(clang) and x86-64(gcc)

##### log of building qemuarm with clang (protobuf-c-native/protobuf failed before):

poky/build-upstream$ bitbake protobuf protobuf-native protobuf-c protobuf-c-native mosh
/usr/lib/python3/dist-packages/html5lib/_trie/_base.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
from collections import Mapping
NOTE: Reconnecting to bitbake server...
Loading cache: 100% |######################################################################################################################################################################| Time: 0:00:00 Loaded 3049 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:

BB_VERSION           = "2.3.1"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "qemuarm"
DISTRO               = "poky"
DISTRO_VERSION       = "4.1+snapshot-51c56c35dcbdf990c764f62babdb303568d7c879"
TUNE_FEATURES        = "arm vfp cortexa15 neon thumb callconvention-hard"
TARGET_FPU           = "hard"
meta                 
meta-poky            
meta-yocto-bsp       = "master:51c56c35dcbdf990c764f62babdb303568d7c879"
meta-oe              = "master-dev:a06ee7ad9f58f055cdd08e3807e36e0c21b302d1"
meta-clang           = "HEAD:371097cdaa0175119a6710390d11a4e967188968"

Initialising tasks: 100% |#################################################################################################################################################################| Time: 0:00:01 Sstate summary: Wanted 27 Local 0 Mirrors 0 Missed 27 Current 312 (0% match, 92% complete)
NOTE: Executing Tasks
WARNING: mosh-1.4.0-r0 do_fetch: Failed to fetch URL http://mosh.mit.edu/mosh-1.4.0.tar.gz, attempting MIRRORS if available
WARNING: protobuf-4.22.2-r0 do_fetch: Failed to fetch URL gitsm://github.com/protocolbuffers/protobuf.git;branch=22.x;protocol=https, attempting MIRRORS if available
WARNING: protobuf-c-1.4.1-r0 do_fetch: Failed to fetch URL git://github.com/protobuf-c/protobuf-c.git;branch=master;protocol=https, attempting MIRRORS if available
NOTE: Tasks Summary: Attempted 1254 tasks of which 1182 didn't need to be rerun and all succeeded.

Summary: There were 3 WARNING messages.

#### end of log

v2->v3:
1. fix mosh compile failure
2. fix protobuf-c compile failure under clang

protobuf,protobuf-c and mosh tested under both clang and gcc mode.

v1->v2:
The v2[1] patch for upgrading protobuf from 3.21.12 to 4.22.2.
After upgrading the protobuf, the package protobuf-c cannot compile anymore[2] due to the latest version protobuf is using c++14 and some of API name has been changed, so use another patch to add support of protobuf latest version in protobuf-c.

Ref:
[1] v1 thread please refer to https://lists.openembedded.org/g/openembedded-devel/message/101784
[2] https://errors.yoctoproject.org/Errors/Details/698756/

Xiangyu Chen (3):
protobuf: upgrade 3.21.12 -> 4.22.2
protobuf-c: add support of protobuf 4.22.x
mosh: add support of protobuf 4.22.x

 ...re.ac-add-support-of-protobuf-4.22.x.patch |  63 ++++
 .../recipes-connectivity/mosh/mosh_1.4.0.bb   |   7 +-
 ...ot-compile-the-code-which-was-genera.patch | 147 ++++++++
 .../0001-add-support-of-protobuf-4.22.x.patch | 315 ++++++++++++++++++
 .../protobuf/protobuf-c_1.4.1.bb              |   6 +-
 ...e-respect-CXX-LDFLAGS-variables-fix-.patch |  15 +-
 ...protobuf_3.21.12.bb => protobuf_4.22.2.bb} |  11 +-
 7 files changed, 552 insertions(+), 12 deletions(-)
 create mode 100644 meta-oe/recipes-connectivity/mosh/mosh/0001-configure.ac-add-support-of-protobuf-4.22.x.patch
 create mode 100644 meta-oe/recipes-devtools/protobuf/protobuf-c/0001-Makefile.am-do-not-compile-the-code-which-was-genera.patch
 create mode 100644 meta-oe/recipes-devtools/protobuf/protobuf-c/0001-add-support-of-protobuf-4.22.x.patch
 rename meta-oe/recipes-devtools/protobuf/{protobuf_3.21.12.bb => protobuf_4.22.2.bb} (86%)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v4 1/3 protobuf: upgrade 3.21.12 -> 4.22.2

From: Xiangyu Chen <[email protected]>

---
 ...efile-respect-CXX-LDFLAGS-variables-fix-.patch | 15 +++++++++------
 .../{protobuf_3.21.12.bb => protobuf_4.22.2.bb}   | 11 ++++++++---
 2 files changed, 17 insertions(+), 9 deletions(-)
 rename meta-oe/recipes-devtools/protobuf/{protobuf_3.21.12.bb => protobuf_4.22.2.bb} (86%)
meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch +9 -6
index 36c3c597a..7c4bf260e 100644
@@ -30,7 +30,7 @@ Signed-off-by: Leon Anavi <[email protected]>
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/examples/Makefile b/examples/Makefile
-index 1c7ec8d63..85f591231 100644
+index ef7a4ef58..7206e14e1 100644
 --- a/examples/Makefile
 +++ b/examples/Makefile
 @@ -2,6 +2,8 @@
@@ -42,17 +42,20 @@ index 1c7ec8d63..85f591231 100644
  all: cpp java python
  
  cpp:    add_person_cpp    list_people_cpp
-@@ -40,11 +42,11 @@ protoc_middleman_dart: addressbook.proto
+@@ -41,11 +43,11 @@ protoc_middleman_dart: addressbook.proto
  
  add_person_cpp: add_person.cc protoc_middleman
  	pkg-config --cflags protobuf  # fails if protobuf is not installed
--	c++ -std=c++11 add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf`
-+	$(CXX) $(CXXFLAGS) $(LDFLAGS) ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) add_person.cc addressbook.pb.cc -o add_person_cpp
+-	c++ -std=c++14 add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf`
++	$(CXX) $(CXXFLAGS) $(LDFLAGS) ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) add_person.cc addressbook.pb.cc -o add_person_cpp #$(CXX) -std=c++17 $(PROTOBUF) add_person.cc addressbook.pb.cc -o add_person_cpp
  
  list_people_cpp: list_people.cc protoc_middleman
  	pkg-config --cflags protobuf  # fails if protobuf is not installed
--	c++ -std=c++11 list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf`
-+	$(CXX) $(CXXFLAGS) $(LDFLAGS) ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) list_people.cc addressbook.pb.cc -o list_people_cpp
+-	c++ -std=c++14 list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf`
++	$(CXX) $(CXXFLAGS) $(LDFLAGS) ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) list_people.cc addressbook.pb.cc -o list_people_cpp #$(CXX) -std=c++17 $(PROTOBUF) list_people.cc addressbook.pb.cc -o list_people_cpp
  
  add_person_dart: add_person.dart protoc_middleman_dart
  
+--
+2.34.1
+
meta-oe/recipes-devtools/protobuf/protobuf_4.22.2.bb renamed from meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +8 -3
similarity index 86%
rename from meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb
rename to meta-oe/recipes-devtools/protobuf/protobuf_4.22.2.bb
index 343933033..f99081b01 100644
@@ -7,12 +7,12 @@ SECTION = "console/tools"
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=37b5762e07f0af8c74ce80a8bda4266b"
 
-DEPENDS = "zlib"
+DEPENDS = "zlib abseil-cpp"
 DEPENDS:append:class-target = " protobuf-native"
 
-SRCREV = "f0dc78d7e6e331b8c6bb2d5283e06aa26883ca7c"
+SRCREV = "81f89d509d6771dcccb619cbe26ac86cec472582"
 
-SRC_URI = "git://github.com/protocolbuffers/protobuf.git;branch=21.x;protocol=https \
+SRC_URI = "gitsm://github.com/protocolbuffers/protobuf.git;branch=22.x;protocol=https \
            file://run-ptest \
            file://0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch \
            file://0001-Fix-linking-error-with-ld-gold.patch \
@@ -35,6 +35,7 @@ EXTRA_OECMAKE += "\
     -Dprotobuf_BUILD_LIBPROTOC=ON \
     -Dprotobuf_BUILD_TESTS=OFF \
     -Dprotobuf_BUILD_EXAMPLES=OFF \
+    -Dprotobuf_ABSL_PROVIDER="package" \
 "
 
 TEST_SRC_DIR = "examples"
@@ -52,7 +53,11 @@ do_compile_ptest() {
 	cp ${S}/${TEST_SRC_DIR}/Makefile "${B}/${TEST_SRC_DIR}/"
 	sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
 	sed -e 's|Cflags:|Cflags: -I${S}/src|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
+	sed -e 's|Cflags:|Cflags: -I${WORKDIR}/recipe-sysroot{includedir} |' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
 	sed -e 's|Libs:|Libs: -L${B}|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
+	sed -e 's|Libs:|Libs: -L${WORKDIR}/recipe-sysroot/usr/lib|' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
+	sed -e 's|Libs:|Libs: -labsl_log_internal_check_op |' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
+	sed -e 's|Libs:|Libs: -labsl_log_internal_message |' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
 	# Until out-of-tree build of examples is supported, we have to use this approach
 	sed -e 's|../src/google/protobuf/.libs/timestamp.pb.o|${B}/CMakeFiles/libprotobuf.dir/src/google/protobuf/timestamp.pb.cc.o|' -i "${B}/${TEST_SRC_DIR}/Makefile"
 	export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}"
Signature · 1 line
2.34.1
#2 lore raw

PATCH v4 2/3 protobuf-c: add support of protobuf 4.22.x

In reply to Xiangyu Chen

From: Xiangyu Chen <[email protected]>

---
 ...ot-compile-the-code-which-was-genera.patch | 147 ++++++++
 .../0001-add-support-of-protobuf-4.22.x.patch | 315 ++++++++++++++++++
 .../protobuf/protobuf-c_1.4.1.bb              |   6 +-
 3 files changed, 467 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/protobuf/protobuf-c/0001-Makefile.am-do-not-compile-the-code-which-was-genera.patch
 create mode 100644 meta-oe/recipes-devtools/protobuf/protobuf-c/0001-add-support-of-protobuf-4.22.x.patch
meta-oe/recipes-devtools/protobuf/protobuf-c/0001-Makefile.am-do-not-compile-the-code-which-was-genera.patch new file +147 -0
new file mode 100644
index 000000000..4450a2f62
@@ -0,0 +1,147 @@
+From c263360d4f40beb2badd04e5bd084f46fd25595b Mon Sep 17 00:00:00 2001
+From: Xiangyu Chen <[email protected]>
+Date: Fri, 31 Mar 2023 16:02:50 +0800
+Subject: [PATCH] Makefile.am: do not compile the code which was generated from
+ test-full.proto in protobuf-c-native
+
+Those code was auto generated by protoc command with test-full.proto, those code are not compatible
+with protobuf 4.22.x, so temporarily disable compile those code until protobuf-c upstream adapt
+the test-full.proto with latest version protobuf.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Xiangyu Chen <[email protected]>
+---
+ Makefile.am | 116 ++++++++++++++++++++++++++--------------------------
+ 1 file changed, 58 insertions(+), 58 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 3b0d1d6..ff4c196 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -136,64 +136,64 @@ else
+ 
+ LOG_COMPILER = $(VALGRIND)
+ 
+-check_PROGRAMS += \
+-	t/generated-code/test-generated-code \
+-	t/generated-code2/test-generated-code2 \
+-	t/version/version
+-
+-TESTS += \
+-	t/generated-code/test-generated-code \
+-	t/generated-code2/test-generated-code2 \
+-	t/version/version
+-
+-t_generated_code_test_generated_code_SOURCES = \
+-	t/generated-code/test-generated-code.c \
+-	t/test.pb-c.c
+-t_generated_code_test_generated_code_LDADD = \
+-	protobuf-c/libprotobuf-c.la
+-
+-t_generated_code2_test_generated_code2_SOURCES = \
+-	t/generated-code2/test-generated-code2.c \
+-	t/test-full.pb-c.c \
+-	t/test-optimized.pb-c.c
+-t_generated_code2_test_generated_code2_LDADD = \
+-	protobuf-c/libprotobuf-c.la
+-
+-noinst_PROGRAMS += \
+-	t/generated-code2/cxx-generate-packed-data
+-
+-t_generated_code2_cxx_generate_packed_data_SOURCES = \
+-	t/generated-code2/cxx-generate-packed-data.cc \
+-	t/test-full.pb.cc \
+-	protobuf-c/protobuf-c.pb.cc
+-$(t_generated_code2_cxx_generate_packed_data_OBJECTS): t/test-full.pb.h
+-t_generated_code2_cxx_generate_packed_data_CXXFLAGS = \
+-	$(AM_CXXFLAGS) \
+-	$(protobuf_CFLAGS)
+-t_generated_code2_cxx_generate_packed_data_LDADD = \
+-	$(protobuf_LIBS)
+-
+-t/test.pb-c.c t/test.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test.proto
+-	$(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test.proto
+-
+-t/test-optimized.pb-c.c t/test-optimized.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test-optimized.proto
+-	$(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test-optimized.proto
+-
+-t/test-full.pb-c.c t/test-full.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test-full.proto
+-	$(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test-full.proto
+-
+-t/test-full.pb.cc t/test-full.pb.h: @PROTOC@ $(top_srcdir)/t/test-full.proto
+-	$(AM_V_GEN)@PROTOC@ -I$(top_srcdir) --cpp_out=$(top_builddir) $(top_srcdir)/t/test-full.proto
+-
+-t/generated-code2/test-full-cxx-output.inc: t/generated-code2/cxx-generate-packed-data$(EXEEXT)
+-	$(AM_V_GEN)$(top_builddir)/t/generated-code2/cxx-generate-packed-data$(EXEEXT) > $(top_builddir)/t/generated-code2/test-full-cxx-output.inc
+-
+-BUILT_SOURCES += \
+-	t/test.pb-c.c t/test.pb-c.h \
+-	t/test-full.pb-c.c t/test-full.pb-c.h \
+-	t/test-optimized.pb-c.c t/test-optimized.pb-c.h \
+-	t/test-full.pb.cc t/test-full.pb.h \
+-	t/generated-code2/test-full-cxx-output.inc
++# check_PROGRAMS += \
++#	t/generated-code/test-generated-code \
++#	t/generated-code2/test-generated-code2 \
++#	t/version/version
++
++# TESTS += \
++#	t/generated-code/test-generated-code \
++#	t/generated-code2/test-generated-code2 \
++#	t/version/version
++
++# t_generated_code_test_generated_code_SOURCES = \
++#	t/generated-code/test-generated-code.c \
++#	t/test.pb-c.c
++# t_generated_code_test_generated_code_LDADD = \
++#	protobuf-c/libprotobuf-c.la
++
++# t_generated_code2_test_generated_code2_SOURCES = \
++#	t/generated-code2/test-generated-code2.c \
++#	t/test-full.pb-c.c \
++#	t/test-optimized.pb-c.c
++# t_generated_code2_test_generated_code2_LDADD = \
++#	protobuf-c/libprotobuf-c.la
++
++# noinst_PROGRAMS += \
++#	t/generated-code2/cxx-generate-packed-data
++
++# t_generated_code2_cxx_generate_packed_data_SOURCES = \
++#	t/generated-code2/cxx-generate-packed-data.cc \
++#	t/test-full.pb.cc \
++#	protobuf-c/protobuf-c.pb.cc
++# $(t_generated_code2_cxx_generate_packed_data_OBJECTS): t/test-full.pb.h
++# t_generated_code2_cxx_generate_packed_data_CXXFLAGS = \
++#	$(AM_CXXFLAGS) \
++#	$(protobuf_CFLAGS)
++# t_generated_code2_cxx_generate_packed_data_LDADD = \
++#	$(protobuf_LIBS)
++
++# t/test.pb-c.c t/test.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test.proto
++#	$(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test.proto
++
++# t/test-optimized.pb-c.c t/test-optimized.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test-optimized.proto
++#	$(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test-optimized.proto
++
++# t/test-full.pb-c.c t/test-full.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test-full.proto
++#	$(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test-full.proto
++
++# t/test-full.pb.cc t/test-full.pb.h: @PROTOC@ $(top_srcdir)/t/test-full.proto
++#	$(AM_V_GEN)@PROTOC@ -I$(top_srcdir) --cpp_out=$(top_builddir) $(top_srcdir)/t/test-full.proto
++
++# t/generated-code2/test-full-cxx-output.inc: t/generated-code2/cxx-generate-packed-data$(EXEEXT)
++#	$(AM_V_GEN)$(top_builddir)/t/generated-code2/cxx-generate-packed-data$(EXEEXT) > $(top_builddir)/t/generated-code2/test-full-cxx-output.inc
++
++# BUILT_SOURCES += \
++#	t/test.pb-c.c t/test.pb-c.h \
++#	t/test-full.pb-c.c t/test-full.pb-c.h \
++#	t/test-optimized.pb-c.c t/test-optimized.pb-c.h \
++#	t/test-full.pb.cc t/test-full.pb.h \
++#	t/generated-code2/test-full-cxx-output.inc
+ 
+ if BUILD_PROTO3
+ 
+-- 
+2.34.1
+
meta-oe/recipes-devtools/protobuf/protobuf-c/0001-add-support-of-protobuf-4.22.x.patch new file +315 -0

315 lines not on this page · raw message

meta-oe/recipes-devtools/protobuf/protobuf-c_1.4.1.bb +5 -1
index d724287d6..86d83e9cc 100644
@@ -12,7 +12,11 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=9f725889e0d77383e26cb42b0b62cea2"
 
 DEPENDS = "protobuf-native protobuf"
 
-SRC_URI = "git://github.com/protobuf-c/protobuf-c.git;branch=master;protocol=https"
+SRC_URI = "git://github.com/protobuf-c/protobuf-c.git;branch=master;protocol=https \
+           file://0001-add-support-of-protobuf-4.22.x.patch \
+           "
+SRC_URI:append:class-native = " file://0001-Makefile.am-do-not-compile-the-code-which-was-genera.patch"
+
 SRCREV = "abc67a11c6db271bedbb9f58be85d6f4e2ea8389"
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.34.1
#3 lore raw

PATCH v4 3/3 mosh: add support of protobuf 4.22.x

In reply to Xiangyu Chen

From: Xiangyu Chen <[email protected]>

---
 ...re.ac-add-support-of-protobuf-4.22.x.patch | 63 +++++++++++++++++++
 .../recipes-connectivity/mosh/mosh_1.4.0.bb   |  7 ++-
 2 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-connectivity/mosh/mosh/0001-configure.ac-add-support-of-protobuf-4.22.x.patch
meta-oe/recipes-connectivity/mosh/mosh/0001-configure.ac-add-support-of-protobuf-4.22.x.patch new file +63 -0
new file mode 100644
index 000000000..088124391
@@ -0,0 +1,63 @@
+From d9a1a6aac5a3b270449d09ec0d2a556807ab9287 Mon Sep 17 00:00:00 2001
+From: Xiangyu Chen <[email protected]>
+Date: Wed, 29 Mar 2023 13:53:44 +0800
+Subject: [PATCH] configure.ac: add support of protobuf 4.22.x
+
+the protobuf 4.22x is using c++14 as default, this caused the mosh cannot compile anymore and report following error:
+
+....
+/usr/include/google/protobuf/port_def.inc:200:15: error: static assertion failed: Protobuf only supports C++14 and newer.
+| 200 | static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer.");
+| | ^~~~~~~~~~~~~~~~~~~~~~
+....
+
+Upstream-Status: Pending [https://github.com/mobile-shell/mosh/pull/1266]
+
+Signed-off-by: Xiangyu Chen <[email protected]>
+---
+ configure.ac             | 8 ++++++++
+ src/frontend/Makefile.am | 2 +-
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index ee70c7b..5457009 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -26,6 +26,10 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+ AS_IF([pkg-config --atleast-version 3.6.0 protobuf],
+   [AX_CXX_COMPILE_STDCXX([11])])
+ 
++# If current protobuf 4.22+ update the requires to C++14.
++AS_IF([pkg-config --atleast-version 4.22.0 protobuf],
++  [AX_CXX_COMPILE_STDCXX([14])])
++
+ WARNING_CXXFLAGS=""
+ PICKY_CXXFLAGS=""
+ DISTCHECK_CXXFLAGS=""
+@@ -311,6 +315,10 @@ AC_CHECK_FUNCS(m4_normalize([
+   pledge
+   ]))
+ 
++AS_IF([pkg-config --atleast-version 4.22.0 protobuf],
++  [PKG_CHECK_MODULES([ABSL_LOG_INTERNAL_CHECK_OP], [absl_log_internal_check_op],[],
++     [AC_MSG_ERROR([Missing abseil-cpp library.])])])
++
+ # Start by trying to find the needed tinfo parts by pkg-config
+ PKG_CHECK_MODULES([TINFO], [tinfo],
+   [AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if <curses.h> is present])],
+diff --git a/src/frontend/Makefile.am b/src/frontend/Makefile.am
+index 1aa83fd..399ecd6 100644
+--- a/src/frontend/Makefile.am
++++ b/src/frontend/Makefile.am
+@@ -1,7 +1,7 @@
+ AM_CPPFLAGS = -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I../protobufs -I$(srcdir)/../util $(TINFO_CFLAGS) $(protobuf_CFLAGS) $(CRYPTO_CFLAGS)
+ AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS)
+ AM_LDFLAGS  = $(HARDEN_LDFLAGS) $(CODE_COVERAGE_LIBS)
+-LDADD = ../crypto/libmoshcrypto.a ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../util/libmoshutil.a ../protobufs/libmoshprotos.a -lm $(TINFO_LIBS) $(protobuf_LIBS) $(CRYPTO_LIBS)
++LDADD = ../crypto/libmoshcrypto.a ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../util/libmoshutil.a ../protobufs/libmoshprotos.a -lm $(TINFO_LIBS) $(protobuf_LIBS) $(CRYPTO_LIBS) $(ABSL_LOG_INTERNAL_CHECK_OP_LIBS)
+ 
+ mosh_server_LDADD = $(LDADD)
+ 
+-- 
+2.34.1
+
meta-oe/recipes-connectivity/mosh/mosh_1.4.0.bb +5 -2
index 4537a0941..4eb0dba23 100644
@@ -12,9 +12,12 @@ HOMEPAGE = "http://mosh.mit.edu"
 LICENSE = "GPL-3.0-or-later"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
-DEPENDS = "protobuf-native protobuf ncurses zlib libio-pty-perl openssl libutempter"
+DEPENDS = "protobuf-native protobuf ncurses zlib libio-pty-perl openssl libutempter abseil-cpp"
+
+SRC_URI = "http://mosh.mit.edu/mosh-${PV}.tar.gz \
+           file://0001-configure.ac-add-support-of-protobuf-4.22.x.patch \
+           "
 
-SRC_URI = "http://mosh.mit.edu/mosh-${PV}.tar.gz"
 SRC_URI[sha256sum] = "872e4b134e5df29c8933dff12350785054d2fd2839b5ae6b5587b14db1465ddd"
 
 inherit autotools pkgconfig
Signature · 1 line
2.34.1
#4 lore raw
In reply to Xiangyu Chen

next error

https://errors.yoctoproject.org/Errors/Details/699337/

Quoted 93 lines · Xiangyu Chen

From: Xiangyu Chen <[email protected]>

The series patches are upgrading protobuf package to latest version and add support which is depending protobuf package.

Changes:
v3->v4:
1. fix build failure under qemuarm
2. fix protobuf-c-native build failure

Tested compiling protobuf/protobuf-native on qemuarm(clang) and x86-64(gcc) Tested compiling protobuf-c/protobuf-c-native on qemuarm(clang) and x86-64(gcc) Tested compiling mosh on qemuarm(clang) and x86-64(gcc)

##### log of building qemuarm with clang (protobuf-c-native/protobuf failed before):

poky/build-upstream$ bitbake protobuf protobuf-native protobuf-c protobuf-c-native mosh
/usr/lib/python3/dist-packages/html5lib/_trie/_base.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
from collections import Mapping
NOTE: Reconnecting to bitbake server...
Loading cache: 100% |######################################################################################################################################################################| Time: 0:00:00 Loaded 3049 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:

BB_VERSION           = "2.3.1"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "qemuarm"
DISTRO               = "poky"
DISTRO_VERSION       = "4.1+snapshot-51c56c35dcbdf990c764f62babdb303568d7c879"
TUNE_FEATURES        = "arm vfp cortexa15 neon thumb callconvention-hard"
TARGET_FPU           = "hard"
meta
meta-poky
meta-yocto-bsp       = "master:51c56c35dcbdf990c764f62babdb303568d7c879"
meta-oe              = "master-dev:a06ee7ad9f58f055cdd08e3807e36e0c21b302d1"
meta-clang           = "HEAD:371097cdaa0175119a6710390d11a4e967188968"

Initialising tasks: 100% |#################################################################################################################################################################| Time: 0:00:01 Sstate summary: Wanted 27 Local 0 Mirrors 0 Missed 27 Current 312 (0% match, 92% complete)
NOTE: Executing Tasks
WARNING: mosh-1.4.0-r0 do_fetch: Failed to fetch URL http://mosh.mit.edu/mosh-1.4.0.tar.gz, attempting MIRRORS if available
WARNING: protobuf-4.22.2-r0 do_fetch: Failed to fetch URL gitsm://github.com/protocolbuffers/protobuf.git;branch=22.x;protocol=https, attempting MIRRORS if available
WARNING: protobuf-c-1.4.1-r0 do_fetch: Failed to fetch URL git://github.com/protobuf-c/protobuf-c.git;branch=master;protocol=https, attempting MIRRORS if available
NOTE: Tasks Summary: Attempted 1254 tasks of which 1182 didn't need to be rerun and all succeeded.

Summary: There were 3 WARNING messages.

#### end of log

v2->v3:
1. fix mosh compile failure
2. fix protobuf-c compile failure under clang

protobuf,protobuf-c and mosh tested under both clang and gcc mode.

v1->v2:
The v2[1] patch for upgrading protobuf from 3.21.12 to 4.22.2.
After upgrading the protobuf, the package protobuf-c cannot compile anymore[2] due to the latest version protobuf is using c++14 and some of API name has been changed, so use another patch to add support of protobuf latest version in protobuf-c.

Ref:
[1] v1 thread please refer to https://lists.openembedded.org/g/openembedded-devel/message/101784
[2] https://errors.yoctoproject.org/Errors/Details/698756/

Xiangyu Chen (3):
protobuf: upgrade 3.21.12 -> 4.22.2
protobuf-c: add support of protobuf 4.22.x
mosh: add support of protobuf 4.22.x

 ...re.ac-add-support-of-protobuf-4.22.x.patch |  63 ++++
 .../recipes-connectivity/mosh/mosh_1.4.0.bb   |   7 +-
 ...ot-compile-the-code-which-was-genera.patch | 147 ++++++++
 .../0001-add-support-of-protobuf-4.22.x.patch | 315 ++++++++++++++++++
 .../protobuf/protobuf-c_1.4.1.bb              |   6 +-
 ...e-respect-CXX-LDFLAGS-variables-fix-.patch |  15 +-
 ...protobuf_3.21.12.bb => protobuf_4.22.2.bb} |  11 +-
 7 files changed, 552 insertions(+), 12 deletions(-)
 create mode 100644 meta-oe/recipes-connectivity/mosh/mosh/0001-configure.ac-add-support-of-protobuf-4.22.x.patch
 create mode 100644 meta-oe/recipes-devtools/protobuf/protobuf-c/0001-Makefile.am-do-not-compile-the-code-which-was-genera.patch
 create mode 100644 meta-oe/recipes-devtools/protobuf/protobuf-c/0001-add-support-of-protobuf-4.22.x.patch
 rename meta-oe/recipes-devtools/protobuf/{protobuf_3.21.12.bb => protobuf_4.22.2.bb} (86%)

--
2.34.1

#5 lore raw

Hi Xiangyu,

Quoted 3 lines · Khem Raj

next error

https://errors.yoctoproject.org/Errors/Details/699337/

Could you try to bump gRPC and see if it fixed the compilation?

I was looking to bump gRPC but got other issues with utf8-native
https://lists.openembedded.org/g/openembedded-core/message/184648

Regards,
Clement

Quoted 136 lines
Quoted 4 lines · Xiangyu Chen

From: Xiangyu Chen <[email protected]>

The series patches are upgrading protobuf package to latest version and

add support which is

Quoted 8 lines

depending protobuf package.

Changes:
v3->v4:
1. fix build failure under qemuarm
2. fix protobuf-c-native build failure

Tested compiling protobuf/protobuf-native on qemuarm(clang) and

x86-64(gcc)

Quoted 1 line

Tested compiling protobuf-c/protobuf-c-native on qemuarm(clang) and

x86-64(gcc)

Quoted 3 lines

Tested compiling mosh on qemuarm(clang) and x86-64(gcc)

##### log of building qemuarm with clang (protobuf-c-native/protobuf

failed before):

Quoted 2 lines

poky/build-upstream$ bitbake protobuf protobuf-native protobuf-c

protobuf-c-native mosh

Quoted 1 line

/usr/lib/python3/dist-packages/html5lib/_trie/_base.py:3:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working

Quoted 3 lines

from collections import Mapping
NOTE: Reconnecting to bitbake server...
Loading cache: 100%

|######################################################################################################################################################################|
Time: 0:00:00

Quoted 11 lines

Loaded 3049 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:

BB_VERSION           = "2.3.1"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "qemuarm"
DISTRO               = "poky"
DISTRO_VERSION       =

"4.1+snapshot-51c56c35dcbdf990c764f62babdb303568d7c879"

Quoted 6 lines

TUNE_FEATURES = "arm vfp cortexa15 neon thumb callconvention-hard"
TARGET_FPU = "hard"
meta
meta-poky
meta-yocto-bsp = "master:51c56c35dcbdf990c764f62babdb303568d7c879"
meta-oe =

"master-dev:a06ee7ad9f58f055cdd08e3807e36e0c21b302d1"

Quoted 3 lines

meta-clang = "HEAD:371097cdaa0175119a6710390d11a4e967188968"

Initialising tasks: 100%

|#################################################################################################################################################################|
Time: 0:00:01

Quoted 1 line

Sstate summary: Wanted 27 Local 0 Mirrors 0 Missed 27 Current 312 (0%

match, 92% complete)

Quoted 2 lines

NOTE: Executing Tasks
WARNING: mosh-1.4.0-r0 do_fetch: Failed to fetch URL

http://mosh.mit.edu/mosh-1.4.0.tar.gz, attempting MIRRORS if available

Quoted 1 line

WARNING: protobuf-4.22.2-r0 do_fetch: Failed to fetch URL gitsm://

github.com/protocolbuffers/protobuf.git;branch=22.x;protocol=https, attempting MIRRORS if available

Quoted 1 line

WARNING: protobuf-c-1.4.1-r0 do_fetch: Failed to fetch URL git://

github.com/protobuf-c/protobuf-c.git;branch=master;protocol=https, attempting MIRRORS if available

Quoted 1 line

NOTE: Tasks Summary: Attempted 1254 tasks of which 1182 didn't need to

be rerun and all succeeded.

Quoted 9 lines

Summary: There were 3 WARNING messages.

#### end of log

v2->v3:
1. fix mosh compile failure
2. fix protobuf-c compile failure under clang

Quoted 6 lines

protobuf,protobuf-c and mosh tested under both clang and gcc mode.

v1->v2:
The v2[1] patch for upgrading protobuf from 3.21.12 to 4.22.2. After upgrading the protobuf, the package protobuf-c cannot compile

anymore[2] due to the latest version

Quoted 1 line

protobuf is using c++14 and some of API name has been changed, so use

another patch to add support of

Quoted 5 lines

protobuf latest version in protobuf-c.

Ref:
[1] v1 thread please refer to

https://lists.openembedded.org/g/openembedded-devel/message/101784

Quoted 8 lines

[2] https://errors.yoctoproject.org/Errors/Details/698756/

Xiangyu Chen (3):
protobuf: upgrade 3.21.12 -> 4.22.2
protobuf-c: add support of protobuf 4.22.x
mosh: add support of protobuf 4.22.x

Quoted 9 lines
 ...re.ac-add-support-of-protobuf-4.22.x.patch |  63 ++++
 .../recipes-connectivity/mosh/mosh_1.4.0.bb   |   7 +-
 ...ot-compile-the-code-which-was-genera.patch | 147 ++++++++
 .../0001-add-support-of-protobuf-4.22.x.patch | 315 ++++++++++++++++++
 .../protobuf/protobuf-c_1.4.1.bb              |   6 +-
 ...e-respect-CXX-LDFLAGS-variables-fix-.patch |  15 +-
 ...protobuf_3.21.12.bb => protobuf_4.22.2.bb} |  11 +-
 7 files changed, 552 insertions(+), 12 deletions(-)
 create mode 100644

meta-oe/recipes-connectivity/mosh/mosh/0001-configure.ac-add-support-of-protobuf-4.22.x.patch

Quoted 1 line
 create mode 100644

meta-oe/recipes-devtools/protobuf/protobuf-c/0001-Makefile.am-do-not-compile-the-code-which-was-genera.patch

Quoted 1 line
 create mode 100644

meta-oe/recipes-devtools/protobuf/protobuf-c/0001-add-support-of-protobuf-4.22.x.patch

Quoted 1 line
 rename meta-oe/recipes-devtools/protobuf/{protobuf_3.21.12.bb =>

protobuf_4.22.2.bb} (86%)

Quoted 4 lines

--
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#101868):
https://lists.openembedded.org/g/openembedded-devel/message/101868
Mute This Topic: https://lists.openembedded.org/mt/97969897/4240582
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-