From a99c94766e00dbb4d7f740e4e5fa342a7ea53899 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 2 Mar 2017 11:32:08 -0800 Subject: [PATCH 1/3] Add option to recompile Node library without ALPN support --- binding.gyp | 22 +++++++++++++++------- templates/binding.gyp.template | 22 +++++++++++++++------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/binding.gyp b/binding.gyp index 2b2072fa568..efac5f0ec12 100644 --- a/binding.gyp +++ b/binding.gyp @@ -43,7 +43,11 @@ # out. It can be re-enabled for one build by setting the npm config # variable grpc_uv to true, and it can be re-enabled permanently by # setting it to true here. - 'grpc_uv%': 'false' + 'grpc_uv%': 'false', + # Some Node installations use the system installation of OpenSSL, and on + # some systems, the system OpenSSL still does not have ALPN support. This + # will let users recompile gRPC to work without ALPN. + 'grpc_alpn%': 'true' }, 'target_defaults': { 'include_dirs': [ @@ -56,8 +60,6 @@ 'conditions': [ ['runtime=="node" and grpc_uv=="true"', { 'defines': [ - # Disabling this while bugs are ironed out. Uncomment this to - # re-enable libuv integration in C core. 'GRPC_UV' ] }], @@ -75,10 +77,16 @@ 'OPENSSL_NO_ASM' ] }, { - # As of the beginning of 2017, we only support versions of Node with - # embedded versions of OpenSSL that support ALPN - 'defines': [ - 'TSI_OPENSSL_ALPN_SUPPORT=1' + 'conditions': [ + ['grpc_alpn=="true"', { + 'defines': [ + 'TSI_OPENSSL_ALPN_SUPPORT=1' + ], + }, { + 'defines': [ + 'TSI_OPENSSL_ALPN_SUPPORT=0' + ], + }] ], 'include_dirs': [ '<(node_root_dir)/deps/openssl/openssl/include', diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 9d7034e18bc..31b8277a249 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -45,7 +45,11 @@ # out. It can be re-enabled for one build by setting the npm config # variable grpc_uv to true, and it can be re-enabled permanently by # setting it to true here. - 'grpc_uv%': 'false' + 'grpc_uv%': 'false', + # Some Node installations use the system installation of OpenSSL, and on + # some systems, the system OpenSSL still does not have ALPN support. This + # will let users recompile gRPC to work without ALPN. + 'grpc_alpn%': 'true' }, 'target_defaults': { 'include_dirs': [ @@ -58,8 +62,6 @@ 'conditions': [ ['runtime=="node" and grpc_uv=="true"', { 'defines': [ - # Disabling this while bugs are ironed out. Uncomment this to - # re-enable libuv integration in C core. 'GRPC_UV' ] }], @@ -77,10 +79,16 @@ 'OPENSSL_NO_ASM' ] }, { - # As of the beginning of 2017, we only support versions of Node with - # embedded versions of OpenSSL that support ALPN - 'defines': [ - 'TSI_OPENSSL_ALPN_SUPPORT=1' + 'conditions': [ + ['grpc_alpn=="true"', { + 'defines': [ + 'TSI_OPENSSL_ALPN_SUPPORT=1' + ], + }, { + 'defines': [ + 'TSI_OPENSSL_ALPN_SUPPORT=0' + ], + }] ], 'include_dirs': [ '<(node_root_dir)/deps/openssl/openssl/include', From 18e8b147e66ba262b4d04a2270d1cae3d95b9a6f Mon Sep 17 00:00:00 2001 From: "J. Martin" Date: Thu, 23 Feb 2017 18:52:46 -0600 Subject: [PATCH 2/3] Limit the gem native build resources When building the native extension make -j can absorb all available resources on a system. Implement "reasonable" limits on the number of compiling jobs when the number of processors can be detected and use a conservative count when ruby version does not provide detection. --- src/ruby/ext/grpc/extconf.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index b379664bab8..ecb66239b90 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -27,6 +27,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +require 'etc' require 'mkmf' LIBDIR = RbConfig::CONFIG['libdir'] @@ -80,7 +81,9 @@ ENV['BUILDDIR'] = output_dir unless windows puts 'Building internal gRPC into ' + grpc_lib_dir - system("make -j -C #{grpc_root} #{grpc_lib_dir}/libgrpc.a CONFIG=#{grpc_config}") + nproc = 4 + nproc = Etc.nprocessors * 2 if Etc.respond_to? :nprocessors + system("make -j#{nproc} -C #{grpc_root} #{grpc_lib_dir}/libgrpc.a CONFIG=#{grpc_config}") exit 1 unless $? == 0 end From aa4abaa8cca03f2235fec8940832d32b2d4bcc66 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 3 Mar 2017 10:19:01 +0100 Subject: [PATCH 3/3] fix Grpc.HealthCheck and Grpc.Reflection packages --- src/csharp/Grpc.Examples/project.json | 7 +------ src/csharp/Grpc.HealthCheck/project.json | 7 +------ src/csharp/Grpc.IntegrationTesting/project.json | 5 +---- src/csharp/Grpc.Reflection/project.json | 7 +------ templates/src/csharp/Grpc.Examples/project.json.template | 7 +------ .../src/csharp/Grpc.HealthCheck/project.json.template | 7 +------ .../csharp/Grpc.IntegrationTesting/project.json.template | 5 +---- templates/src/csharp/Grpc.Reflection/project.json.template | 7 +------ 8 files changed, 8 insertions(+), 44 deletions(-) diff --git a/src/csharp/Grpc.Examples/project.json b/src/csharp/Grpc.Examples/project.json index 21a730cb229..84254e897ed 100644 --- a/src/csharp/Grpc.Examples/project.json +++ b/src/csharp/Grpc.Examples/project.json @@ -9,12 +9,7 @@ "Google.Protobuf": "3.0.0" }, "frameworks": { - "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } - }, + "net45": {}, "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { diff --git a/src/csharp/Grpc.HealthCheck/project.json b/src/csharp/Grpc.HealthCheck/project.json index 608d6454131..ce72395a9f9 100644 --- a/src/csharp/Grpc.HealthCheck/project.json +++ b/src/csharp/Grpc.HealthCheck/project.json @@ -25,12 +25,7 @@ "Google.Protobuf": "3.0.0" }, "frameworks": { - "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } - }, + "net45": {}, "netstandard1.5": { "dependencies": { "NETStandard.Library": "1.6.0" diff --git a/src/csharp/Grpc.IntegrationTesting/project.json b/src/csharp/Grpc.IntegrationTesting/project.json index e47b5953da0..158ffd41b05 100644 --- a/src/csharp/Grpc.IntegrationTesting/project.json +++ b/src/csharp/Grpc.IntegrationTesting/project.json @@ -62,10 +62,7 @@ }, "frameworks": { "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } + "frameworkAssemblies": {} }, "netcoreapp1.0": { "imports": [ diff --git a/src/csharp/Grpc.Reflection/project.json b/src/csharp/Grpc.Reflection/project.json index bc4bca023af..f0897745633 100644 --- a/src/csharp/Grpc.Reflection/project.json +++ b/src/csharp/Grpc.Reflection/project.json @@ -25,12 +25,7 @@ "Google.Protobuf": "3.0.0" }, "frameworks": { - "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } - }, + "net45": {}, "netstandard1.5": { "dependencies": { "NETStandard.Library": "1.6.0" diff --git a/templates/src/csharp/Grpc.Examples/project.json.template b/templates/src/csharp/Grpc.Examples/project.json.template index b8a8314de17..42c2f31ce5c 100644 --- a/templates/src/csharp/Grpc.Examples/project.json.template +++ b/templates/src/csharp/Grpc.Examples/project.json.template @@ -9,12 +9,7 @@ "Google.Protobuf": "3.0.0" }, "frameworks": { - "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } - }, + "net45": {}, "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { diff --git a/templates/src/csharp/Grpc.HealthCheck/project.json.template b/templates/src/csharp/Grpc.HealthCheck/project.json.template index cba68940153..280d529e734 100644 --- a/templates/src/csharp/Grpc.HealthCheck/project.json.template +++ b/templates/src/csharp/Grpc.HealthCheck/project.json.template @@ -27,12 +27,7 @@ "Google.Protobuf": "3.0.0" }, "frameworks": { - "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } - }, + "net45": {}, "netstandard1.5": { "dependencies": { "NETStandard.Library": "1.6.0" diff --git a/templates/src/csharp/Grpc.IntegrationTesting/project.json.template b/templates/src/csharp/Grpc.IntegrationTesting/project.json.template index 3ce94e58387..4d54e63a0e5 100644 --- a/templates/src/csharp/Grpc.IntegrationTesting/project.json.template +++ b/templates/src/csharp/Grpc.IntegrationTesting/project.json.template @@ -17,10 +17,7 @@ }, "frameworks": { "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } + "frameworkAssemblies": {} }, "netcoreapp1.0": { "imports": [ diff --git a/templates/src/csharp/Grpc.Reflection/project.json.template b/templates/src/csharp/Grpc.Reflection/project.json.template index 8a33e1ccc97..6d1c3e891f3 100644 --- a/templates/src/csharp/Grpc.Reflection/project.json.template +++ b/templates/src/csharp/Grpc.Reflection/project.json.template @@ -27,12 +27,7 @@ "Google.Protobuf": "3.0.0" }, "frameworks": { - "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } - }, + "net45": {}, "netstandard1.5": { "dependencies": { "NETStandard.Library": "1.6.0"