You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2019/01/16 00:35:53 UTC

[mesos] 01/02: Fixed gRPC CMake build issue on Ubuntu 14.04.

This is an automated email from the ASF dual-hosted git repository.

chhsiao pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit bfa0ec3ea7fe8e05290142ea776903b5f7762da5
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
AuthorDate: Thu Jan 10 15:31:07 2019 -0800

    Fixed gRPC CMake build issue on Ubuntu 14.04.
    
    This patch cherry-picks an unofficial commit to disable ALPN compilation
    if only OpenSSL 1.0.1 is on the system.
    
    Review: https://reviews.apache.org/r/69708
---
 3rdparty/CMakeLists.txt    |  4 +--
 3rdparty/grpc-1.10.0.patch | 79 ++++++++++++++++++++++++++++++++++++++--------
 3rdparty/grpc.md           | 13 ++++++--
 3 files changed, 79 insertions(+), 17 deletions(-)

diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index 22a53a2..23ba58f 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -1263,9 +1263,9 @@ set_target_properties(
   grpc PROPERTIES
   INTERFACE_INCLUDE_DIRECTORIES ${GRPC_ROOT}/include)
 
-if (WIN32)
-  PATCH_CMD(GRPC_PATCH_CMD grpc-${GRPC_VERSION}.patch)
+PATCH_CMD(GRPC_PATCH_CMD grpc-${GRPC_VERSION}.patch)
 
+if (WIN32)
   list(APPEND GRPC_CMAKE_ARGS -DZLIB_ROOT=${ZLIB_ROOT}-lib)
 
   if (CMAKE_GENERATOR MATCHES "Visual Studio")
diff --git a/3rdparty/grpc-1.10.0.patch b/3rdparty/grpc-1.10.0.patch
index 655f003..00dddbc 100644
--- a/3rdparty/grpc-1.10.0.patch
+++ b/3rdparty/grpc-1.10.0.patch
@@ -1,16 +1,9 @@
-diff --git a/Makefile b/Makefile
-index 8bab9c3afd..9f8261f0a4 100644
---- a/Makefile
-+++ b/Makefile
-@@ -15461,8 +15461,6 @@ $(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/stats.o:  $(LIBDIR)/$(CONFIG)/libgrpc
- 
- $(OBJDIR)/$(CONFIG)/test/cpp/codegen/codegen_test_minimal.o:  $(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
- 
--$(OBJDIR)/$(CONFIG)/src/cpp/codegen/codegen_init.o:  $(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
--
- deps_codegen_test_minimal: $(CODEGEN_TEST_MINIMAL_OBJS:.o=.dep)
- 
- ifneq ($(NO_SECURE),true)
+From 90869cffbd0cd05ee663e1b81cda169dd40cdf22 Mon Sep 17 00:00:00 2001
+From: Chun-Hung Hsiao <ch...@mesosphere.io>
+Date: Thu, 19 Apr 2018 14:15:10 -0700
+Subject: [PATCH] Fixed undefined `_WIN32_WINNT` for Windows compilation.
+
+
 diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h
 index 819d17ce2a..77b587dac3 100644
 --- a/include/grpc/impl/codegen/port_platform.h
@@ -33,3 +26,63 @@ index 819d17ce2a..77b587dac3 100644
  #ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
  #undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
  #undef WIN32_LEAN_AND_MEAN
+-- 
+2.17.2 (Apple Git-113)
+
+
+From 6531532de6a35ed8e00e24d3b60e88fd90d01335 Mon Sep 17 00:00:00 2001
+From: Chun-Hung Hsiao <ch...@mesosphere.io>
+Date: Fri, 10 Aug 2018 14:00:03 -0700
+Subject: [PATCH] Removed unnecessary dependencies of `codegen_init.o` for
+ unsecure build.
+
+`codegen_init.cc` is listed in `LIBGRPC++_UNSECURE_SRC`, which are
+compiled without SSL, but in `Makefile` lists SSL-required libraries as
+its dependencies. Since the file itself does not use any bits from those
+libraries, it is safe to remove those dependencies.
+
+diff --git a/Makefile b/Makefile
+index 8bab9c3afd..9f8261f0a4 100644
+--- a/Makefile
++++ b/Makefile
+@@ -15461,8 +15461,6 @@ $(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/stats.o:  $(LIBDIR)/$(CONFIG)/libgrpc
+ 
+ $(OBJDIR)/$(CONFIG)/test/cpp/codegen/codegen_test_minimal.o:  $(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
+ 
+-$(OBJDIR)/$(CONFIG)/src/cpp/codegen/codegen_init.o:  $(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
+-
+ deps_codegen_test_minimal: $(CODEGEN_TEST_MINIMAL_OBJS:.o=.dep)
+ 
+ ifneq ($(NO_SECURE),true)
+-- 
+2.17.2 (Apple Git-113)
+
+
+From 5c13ad2a3df1108184c716379818eab6fc0ba72d Mon Sep 17 00:00:00 2001
+From: Chun-Hung Hsiao <ch...@mesosphere.io>
+Date: Thu, 10 Jan 2019 14:26:11 -0800
+Subject: [PATCH] CMake: Automatic fallbacking on system's OpenSSL if it only
+ has NPN.
+
+Since ALPN is not supported on some old systems that come with OpenSSL
+version 1.0.1 or older, gRPC needs to fall back to NPN when being built
+with these systems' OpenSSL.
+
+diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
+index 83f642a675..8e2253fb39 100644
+--- a/cmake/ssl.cmake
++++ b/cmake/ssl.cmake
+@@ -36,6 +36,10 @@ elseif("${gRPC_SSL_PROVIDER}" STREQUAL "package")
+   # project itself does not provide installation support in its CMakeLists.txt
+   # See https://cmake.org/cmake/help/v3.6/module/FindOpenSSL.html
+   find_package(OpenSSL REQUIRED)
++
++  if (OPENSSL_VERSION VERSION_LESS "1.0.2")
++    add_definitions(-DTSI_OPENSSL_ALPN_SUPPORT=0)
++  endif()
+   
+   if(TARGET OpenSSL::SSL)
+     set(_gRPC_SSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
+-- 
+2.17.2 (Apple Git-113)
+
diff --git a/3rdparty/grpc.md b/3rdparty/grpc.md
index e06843c..fab174f 100644
--- a/3rdparty/grpc.md
+++ b/3rdparty/grpc.md
@@ -18,5 +18,14 @@ We bundle 1.10.0 for better CMake build support.
 
 ## Cherry Picks
 
-- [Fixed undefined `_WIN32_WINNT` for generated files on Windows.](https://github.com/grpc/grpc/pull/15128)
-- [Removed unnecessary dependencies of `codegen_init.o` for unsecure build.](https://github.com/grpc/grpc/pull/16323)
+- [Fixed undefined `_WIN32_WINNT` for generated files on Windows.](https://github.com/chhsia0/grpc/commit/90869cffbd0cd05ee663e1b81cda169dd40cdf22)
+
+  Upstream PR: https://github.com/grpc/grpc/pull/15128
+
+- [Removed unnecessary dependencies of `codegen_init.o` for unsecure build.](https://github.com/chhsia0/grpc/commit/6531532de6a35ed8e00e24d3b60e88fd90d01335)
+
+  Upstream PR: https://github.com/grpc/grpc/pull/16323
+
+- [CMake: Automatic fallbacking on system's OpenSSL if it only has NPN.](https://github.com/chhsia0/grpc/commit/5c13ad2a3df1108184c716379818eab6fc0ba72d)
+
+  Upstream PR: https://github.com/grpc/grpc/pull/17726