From d7f13fdc516ffa36b16b89e7f398a8a36b4188d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20M=C3=BCllner?= Date: Sat, 2 Dec 2017 00:08:55 +0100 Subject: [PATCH 1/9] Eliminate protobuf AddDescriptors() call. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eliminating protobuf's AddDescriptors() calls enabled forward-compatibility with libprotobuf. That allows to run OLA on recent Linux distrubutions. Tested on x86_64 running Fedora 27 with protobuf 3.3.1 in combination with QLC+ and a uDMX controller. See #1192. Signed-off-by: Christoph Müllner --- config/ola.m4 | 3 --- protoc/CppFileGenerator.cpp | 8 -------- protoc/GeneratorHelpers.cpp | 5 ----- protoc/GeneratorHelpers.h | 3 --- 4 files changed, 19 deletions(-) diff --git a/config/ola.m4 b/config/ola.m4 index 6080932e9a..d3b8cc8f8e 100644 --- a/config/ola.m4 +++ b/config/ola.m4 @@ -24,9 +24,6 @@ AC_DEFUN([PROTOBUF_SUPPORT], AC_REQUIRE_CPP() PKG_CHECK_MODULES(libprotobuf, [protobuf >= $1]) -PKG_CHECK_MODULES(libprotobuf2, [protobuf < 3.2], [], - [AC_MSG_ERROR([OLA currently requires protobuf < 3.2, see issue 1192])]) - AC_SUBST([libprotobuf_CFLAGS]) AC_ARG_WITH([protoc], diff --git a/protoc/CppFileGenerator.cpp b/protoc/CppFileGenerator.cpp index 518c17879d..e7dd95ccb0 100644 --- a/protoc/CppFileGenerator.cpp +++ b/protoc/CppFileGenerator.cpp @@ -196,14 +196,6 @@ void FileGenerator::GenerateBuildDescriptors(Printer* printer) { "assigndescriptorsname", GlobalAssignDescriptorsName(m_output_name)); printer->Indent(); - // Make sure the file has found its way into the pool. If a descriptor - // is requested *during* static init then AddDescriptors() may not have - // been called yet, so we call it manually. Note that it's fine if - // AddDescriptors() is called multiple times. - printer->Print( - "$adddescriptorsname$();\n", - "adddescriptorsname", GlobalAddDescriptorsName(m_file->name())); - // Get the file's descriptor from the pool. printer->Print( "const ::google::protobuf::FileDescriptor* file =\n" diff --git a/protoc/GeneratorHelpers.cpp b/protoc/GeneratorHelpers.cpp index 19609181e4..6f619b5c0c 100644 --- a/protoc/GeneratorHelpers.cpp +++ b/protoc/GeneratorHelpers.cpp @@ -104,11 +104,6 @@ string FilenameIdentifier(const string& filename) { return result; } -// Return the name of the AddDescriptors() function for a given file. -string GlobalAddDescriptorsName(const string& filename) { - return "protobuf_AddDesc_" + FilenameIdentifier(filename); -} - // Return the name of the AssignDescriptors() function for a given file. string GlobalAssignDescriptorsName(const string& filename) { return "protobuf_AssignDesc_" + FilenameIdentifier(filename); diff --git a/protoc/GeneratorHelpers.h b/protoc/GeneratorHelpers.h index 35efdbb043..fa91a915dc 100644 --- a/protoc/GeneratorHelpers.h +++ b/protoc/GeneratorHelpers.h @@ -67,9 +67,6 @@ string StripProto(const string& filename); // Convert a file name into a valid identifier. string FilenameIdentifier(const string& filename); -// Return the name of the AddDescriptors() function for a given file. -string GlobalAddDescriptorsName(const string& filename); - // Return the name of the AssignDescriptors() function for a given file. string GlobalAssignDescriptorsName(const string& filename); From d7dfb7149d7ddc1fd336e6bf568bf2f1a12645be Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Mon, 11 Dec 2017 05:45:30 +0000 Subject: [PATCH 2/9] Protobuf 3.5 builds must succeed with the Protobuf fix in place --- .travis.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 748439a606..c6ba092c6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -202,20 +202,6 @@ matrix: # Short duration job, use the container/without sudo image as it boots faster sudo: false env: TASK='pychecker-wip' - - os: osx - osx_image: xcode9.1 - compiler: clang - env: - - TASK='compile' - - CPPUNIT='1.14' - - PROTOBUF='3.5' - - os: osx - osx_image: xcode9.1 - compiler: gcc - env: - - TASK='compile' - - CPPUNIT='1.14' - - PROTOBUF='3.5' env: global: From 1da479c15228f8278022fea1a0d0a81d8315bfd2 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 18 Feb 2018 04:44:50 +0000 Subject: [PATCH 3/9] Make protobuf-java version a variable --- java/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/pom.xml b/java/pom.xml index 247ae9ac2a..764fe4e030 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -88,7 +88,7 @@ com.google.protobuf protobuf-java - 3.1.0 + ${protobufJavaVersion} junit From 85b94c13fe530b3972039a9ee77adbed7cdef47b Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 18 Feb 2018 04:52:25 +0000 Subject: [PATCH 4/9] Pass in Protobuf Java version to Maven command --- java/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/Makefile.am b/java/Makefile.am index bc4a184c80..596b0a7ea5 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -16,7 +16,7 @@ generated-src/main/java/ola/rpc/Rpc.java: ${top_srcdir}/common/rpc/Rpc.proto $(PROTOC) --java_out=$(top_builddir)/java/generated-src/main/java --proto_path=${top_srcdir}/common/rpc ${top_srcdir}/common/rpc/Rpc.proto ola.jar: generated-src/main/java/ola/proto/Ola.java generated-src/main/java/ola/rpc/Rpc.java - cd ${top_builddir}/java && mvn --file ${top_srcdir}/java/pom.xml -DbuildDir=${abs_top_builddir}/java -DprotobufGeneratedSource=$(abs_top_builddir)/java/generated-src/main/java package + cd ${top_builddir}/java && mvn --file ${top_srcdir}/java/pom.xml -DbuildDir=${abs_top_builddir}/java -DprotobufGeneratedSource=$(abs_top_builddir)/java/generated-src/main/java -DprotobufJavaVersion=$(PROTOBUF_JAVA_VERSION) package CLEANFILES = generated-src/main/java/ola/proto/Ola.java \ generated-src/main/java/ola/rpc/Rpc.java \ From 6743c3e67bbbd8325ee2f26e86a18729c488acbf Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 18 Feb 2018 04:54:58 +0000 Subject: [PATCH 5/9] Use a generic protobuf version variable --- java/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/Makefile.am b/java/Makefile.am index 596b0a7ea5..aab382ea7c 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -16,7 +16,7 @@ generated-src/main/java/ola/rpc/Rpc.java: ${top_srcdir}/common/rpc/Rpc.proto $(PROTOC) --java_out=$(top_builddir)/java/generated-src/main/java --proto_path=${top_srcdir}/common/rpc ${top_srcdir}/common/rpc/Rpc.proto ola.jar: generated-src/main/java/ola/proto/Ola.java generated-src/main/java/ola/rpc/Rpc.java - cd ${top_builddir}/java && mvn --file ${top_srcdir}/java/pom.xml -DbuildDir=${abs_top_builddir}/java -DprotobufGeneratedSource=$(abs_top_builddir)/java/generated-src/main/java -DprotobufJavaVersion=$(PROTOBUF_JAVA_VERSION) package + cd ${top_builddir}/java && mvn --file ${top_srcdir}/java/pom.xml -DbuildDir=${abs_top_builddir}/java -DprotobufGeneratedSource=$(abs_top_builddir)/java/generated-src/main/java -DprotobufJavaVersion=$(PROTOBUF_VERSION) package CLEANFILES = generated-src/main/java/ola/proto/Ola.java \ generated-src/main/java/ola/rpc/Rpc.java \ From 301d686cfc011e35c3ccb47668d5339854fb26f1 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 18 Feb 2018 04:59:03 +0000 Subject: [PATCH 6/9] Try and find the protobuf library version --- config/ola.m4 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/ola.m4 b/config/ola.m4 index d3b8cc8f8e..25f974f152 100644 --- a/config/ola.m4 +++ b/config/ola.m4 @@ -24,6 +24,11 @@ AC_DEFUN([PROTOBUF_SUPPORT], AC_REQUIRE_CPP() PKG_CHECK_MODULES(libprotobuf, [protobuf >= $1]) +AC_MSG_CHECKING([protobuf library version]) +PROTOBUF_VERSION=`pkg-config --modversion protobuf`; +AC_MSG_RESULT([PROTOBUF_VERSION]) +AC_SUBST([PROTOBUF_VERSION]) + AC_SUBST([libprotobuf_CFLAGS]) AC_ARG_WITH([protoc], From 63067a704574b1de71391104a65a730dd1cb1ec6 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 18 Feb 2018 05:05:54 +0000 Subject: [PATCH 7/9] Again Protobuf 3.5 builds must succeed with the Protobuf fix in place --- .travis.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index cdd1849a21..683acb3638 100644 --- a/.travis.yml +++ b/.travis.yml @@ -232,20 +232,6 @@ matrix: # Short duration job, use the container/without sudo image as it boots faster sudo: false env: TASK='pychecker-wip' - - os: osx - osx_image: xcode9.2 - compiler: clang - env: - - TASK='compile' - - CPPUNIT='1.14' - - PROTOBUF='3.5' - - os: osx - osx_image: xcode9.2 - compiler: gcc - env: - - TASK='compile' - - CPPUNIT='1.14' - - PROTOBUF='3.5' - os: linux dist: trusty env: TASK='spellintian' From 8a49c2c5bf3eda6ee443770c4aa3774ebc057527 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 18 Feb 2018 05:12:22 +0000 Subject: [PATCH 8/9] Update pip protobuf version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 683acb3638..46fee331e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -275,7 +275,7 @@ before_cache: install: # Match the version of protobuf being installed via apt -  - if [[ "$PROTOBUF" == "3.5" ]]; then pip install --user protobuf==3.5.0; fi +  - if [[ "$PROTOBUF" == "3.5" ]]; then pip install --user protobuf==3.5.1; fi - if [[ "$PROTOBUF" != "3.5" ]]; then pip install --user protobuf==3.1.0; fi # We need to use pip rather than apt on Trusty - if [ "$TRAVIS_OS_NAME" == "linux" ]; then pip install --user numpy; fi From a2b3a83aa4659b385533a79fca5873c67a5cacbe Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sun, 18 Feb 2018 05:19:48 +0000 Subject: [PATCH 9/9] Fix the protobuf version logging --- config/ola.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ola.m4 b/config/ola.m4 index 25f974f152..9b15a9fc8b 100644 --- a/config/ola.m4 +++ b/config/ola.m4 @@ -26,7 +26,7 @@ PKG_CHECK_MODULES(libprotobuf, [protobuf >= $1]) AC_MSG_CHECKING([protobuf library version]) PROTOBUF_VERSION=`pkg-config --modversion protobuf`; -AC_MSG_RESULT([PROTOBUF_VERSION]) +AC_MSG_RESULT([$PROTOBUF_VERSION]) AC_SUBST([PROTOBUF_VERSION]) AC_SUBST([libprotobuf_CFLAGS])