@ -1,91 +0,0 @@ | |||
From d7f13fdc516ffa36b16b89e7f398a8a36b4188d9 Mon Sep 17 00:00:00 2001 | |||
From: =?UTF-8?q?Christoph=20M=C3=BCllner?= <christophm30@gmail.com> | |||
Date: Sat, 2 Dec 2017 00:08:55 +0100 | |||
Subject: [PATCH 1/6] 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 <christophm30@gmail.com> | |||
--- | |||
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 6080932e9..d3b8cc8f8 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 518c17879..e7dd95ccb 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 19609181e..6f619b5c0 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 35efdbb04..fa91a915d 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); | |||
-- | |||
2.11.0 | |||
@ -1,13 +0,0 @@ | |||
diff --git a/Makefile.am b/Makefile.am | |||
index 22647be..7dcf0de 100644 | |||
--- a/Makefile.am | |||
+++ b/Makefile.am | |||
@@ -45,7 +45,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS = --enable-python-libs | |||
COMMON_CXXFLAGS_ONLY_WARNINGS = \ | |||
-I$(top_srcdir)/include \ | |||
-I$(top_builddir)/include \ | |||
- -Wall -Wformat -W -fvisibility-inlines-hidden \ | |||
+ -Wall -Wformat -W \ | |||
$(libprotobuf_CFLAGS) | |||
COMMON_CXXFLAGS = $(COMMON_CXXFLAGS_ONLY_WARNINGS) |
@ -1,45 +0,0 @@ | |||
From d311970864a2338d63ce3c22a46bb9ec4bb26bfe Mon Sep 17 00:00:00 2001 | |||
From: Peter Newman <peterjnewman@gmail.com> | |||
Date: Fri, 8 Mar 2019 15:43:50 +0000 | |||
Subject: [PATCH] Attempt to fix Protobuf 3.7 builds | |||
--- | |||
configure.ac | 3 +++ | |||
protoc/StrUtil.cpp | 10 ++++++++++ | |||
2 files changed, 13 insertions(+) | |||
diff --git a/configure.ac b/configure.ac | |||
index 9824609b4..4f782847c 100644 | |||
--- a/configure.ac | |||
+++ b/configure.ac | |||
@@ -803,6 +803,9 @@ AS_IF([test "${enable_rdm_tests}" = "yes"], | |||
AS_IF([test "x$build_java_libs" = xyes], | |||
[PROTOBUF_SUPPORT([2.4.0])], | |||
[PROTOBUF_SUPPORT([2.3.0])]) | |||
+# Version 3.7 and above of protoc require some additional includes | |||
+AC_CHECK_HEADERS([google/protobuf/io/strtod.h google/protobuf/stubs/logging.h \ | |||
+ google/protobuf/stubs/stl_util.h]) | |||
# Doxygen | |||
diff --git a/protoc/StrUtil.cpp b/protoc/StrUtil.cpp | |||
index 85891a6a4..2914e82f1 100644 | |||
--- a/protoc/StrUtil.cpp | |||
+++ b/protoc/StrUtil.cpp | |||
@@ -41,6 +41,16 @@ | |||
#include "protoc/StrUtil.h" | |||
+#ifdef HAVE_GOOGLE_PROTOBUF_IO_STRTOD_H | |||
+#include <google/protobuf/io/strtod.h> | |||
+#endif // HAVE_GOOGLE_PROTOBUF_IO_STRTOD_H | |||
+#ifdef HAVE_GOOGLE_PROTOBUF_STUBS_LOGGING_H | |||
+#include <google/protobuf/stubs/logging.h> | |||
+#endif // HAVE_GOOGLE_PROTOBUF_STUBS_LOGGING_H | |||
+#ifdef HAVE_GOOGLE_PROTOBUF_STUBS_STL_UTIL_H | |||
+#include <google/protobuf/stubs/stl_util.h> | |||
+#endif // HAVE_GOOGLE_PROTOBUF_STUBS_STL_UTIL_H | |||
+ | |||
#ifdef _WIN32 | |||
// MSVC has only _snprintf, not snprintf. | |||
// |
@ -1,25 +0,0 @@ | |||
From 409a82f0e35fc33627f16180af7ba8a617347c8e Mon Sep 17 00:00:00 2001 | |||
From: Peter Newman <peterjnewman@gmail.com> | |||
Date: Sat, 9 Mar 2019 14:08:01 +0000 | |||
Subject: [PATCH] Add the missing config.h include | |||
--- | |||
protoc/StrUtil.cpp | 5 +++++ | |||
1 file changed, 5 insertions(+) | |||
diff --git a/protoc/StrUtil.cpp b/protoc/StrUtil.cpp | |||
index 2914e82f1..d300b71e8 100644 | |||
--- a/protoc/StrUtil.cpp | |||
+++ b/protoc/StrUtil.cpp | |||
@@ -41,6 +41,11 @@ | |||
#include "protoc/StrUtil.h" | |||
+#if HAVE_CONFIG_H | |||
+#include <config.h> | |||
+#endif // HAVE_CONFIG_H | |||
+ | |||
+// Required for Protobuf 3.7 onwards | |||
#ifdef HAVE_GOOGLE_PROTOBUF_IO_STRTOD_H | |||
#include <google/protobuf/io/strtod.h> | |||
#endif // HAVE_GOOGLE_PROTOBUF_IO_STRTOD_H |
@ -1,14 +0,0 @@ | |||
--- a/protoc/CppFileGenerator.cpp | |||
+++ b/protoc/CppFileGenerator.cpp | |||
@@ -223,9 +223,9 @@ | |||
printer->Print( | |||
"namespace {\n" | |||
"\n" | |||
- "GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);\n" | |||
+ "::google::protobuf::internal::once_flag protobuf_AssignDescriptors_once_;\n" | |||
"inline void protobuf_AssignDescriptorsOnce() {\n" | |||
- " ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_," | |||
+ " ::google::protobuf::internal::call_once(protobuf_AssignDescriptors_once_," | |||
"\n" | |||
" &$assigndescriptorsname$);\n" | |||
"}\n" |
@ -1,19 +1,10 @@ | |||
--- a/configure.ac | |||
+++ b/configure.ac | |||
@@ -66,14 +66,14 @@ AM_CONDITIONAL([SUPPORTS_GNU_PLUS_PLUS_1 | |||
# force us into gnu++98 mode if necessary | |||
# If gnu++11 and gnu++98 then | |||
-# If no unit tests, force to gnu++98 | |||
+# If no unit tests, force to gnu++11 | |||
# If unittests and cppunit < 1.14.0, force to gnu++98 | |||
# Else turn off deprecation messages for std::auto_ptr and run gnu++11 | |||
require_gnu_plus_plus_11="no" | |||
AS_IF([test "x$ac_cv_gnu_plus_plus_11" = xyes], | |||
@@ -112,7 +112,6 @@ AS_IF([test "x$ac_cv_gnu_plus_plus_11" = | |||
[AS_IF([test "x$ac_cv_gnu_plus_plus_98" = xyes], | |||
[AS_IF([test "x$enable_unittests" = xno], | |||
- [CXXFLAGS="$CXXFLAGS -std=gnu++98"], | |||
+ [require_gnu_plus_plus_11="yes"], | |||
[PKG_CHECK_MODULES([CPPUNIT1], [cppunit < 1.14.0], | |||
[CXXFLAGS="$CXXFLAGS -std=gnu++98"], | |||
[PKG_CHECK_MODULES([CPPUNIT2], [cppunit >= 1.14.0], | |||
[AS_IF([test "x$ac_cv_header_random_98" = xyes], | |||
[AS_IF([test "x$enable_unittests" = xno], | |||
- [CXXFLAGS="$CXXFLAGS -std=gnu++98"], | |||
[PKG_CHECK_MODULES([CPPUNIT1], [cppunit < 1.14.0], | |||
[CXXFLAGS="$CXXFLAGS -std=gnu++98"], | |||
[PKG_CHECK_MODULES([CPPUNIT2], [cppunit >= 1.14.0], |
@ -1,47 +0,0 @@ | |||
--- a/common/http/HTTPServer.cpp | |||
+++ b/common/http/HTTPServer.cpp | |||
@@ -88,7 +88,7 @@ const char HTTPServer::CONTENT_TYPE_OCT[ | |||
* @param key the header name | |||
* @param value the header value | |||
*/ | |||
-static int AddHeaders(void *cls, OLA_UNUSED enum MHD_ValueKind kind, | |||
+static MHD_Result AddHeaders(void *cls, OLA_UNUSED enum MHD_ValueKind kind, | |||
const char *key, const char *value) { | |||
HTTPRequest *request = static_cast<HTTPRequest*>(cls); | |||
string key_string = key; | |||
@@ -110,7 +110,7 @@ static int AddHeaders(void *cls, OLA_UNU | |||
* @param off the offset of the data | |||
* @param size the number of bytes available | |||
*/ | |||
-int IteratePost(void *request_cls, OLA_UNUSED enum MHD_ValueKind kind, | |||
+MHD_Result IteratePost(void *request_cls, OLA_UNUSED enum MHD_ValueKind kind, | |||
const char *key, OLA_UNUSED const char *filename, | |||
OLA_UNUSED const char *content_type, | |||
OLA_UNUSED const char *transfer_encoding, const char *data, | |||
@@ -129,7 +129,7 @@ int IteratePost(void *request_cls, OLA_U | |||
* This sets up HTTPRequest & HTTPResponse objects and then calls | |||
* DispatchRequest. | |||
*/ | |||
-static int HandleRequest(void *http_server_ptr, | |||
+static MHD_Result HandleRequest(void *http_server_ptr, | |||
struct MHD_Connection *connection, | |||
const char *url, | |||
const char *method, | |||
@@ -163,7 +163,7 @@ static int HandleRequest(void *http_serv | |||
if (request->Method() == MHD_HTTP_METHOD_GET) { | |||
HTTPResponse *response = new HTTPResponse(connection); | |||
request->SetInFlight(); | |||
- return http_server->DispatchRequest(request, response); | |||
+ return MHD_Result(http_server->DispatchRequest(request, response)); | |||
} else if (request->Method() == MHD_HTTP_METHOD_POST) { | |||
if (*upload_data_size != 0) { | |||
@@ -173,7 +173,7 @@ static int HandleRequest(void *http_serv | |||
} | |||
request->SetInFlight(); | |||
HTTPResponse *response = new HTTPResponse(connection); | |||
- return http_server->DispatchRequest(request, response); | |||
+ return MHD_Result(http_server->DispatchRequest(request, response)); | |||
} | |||
return MHD_NO; | |||
} |