grpc: Unable to install grpc gem with JRuby
The glcoud-ruby project has an issue opened by a user (GoogleCloudPlatform/gcloud-ruby#712) that is unable to install the latest version due to the dependencies on the grpc and google-protobuf gems not installing on jruby. I am not able to get the grpc gem to install on my mac using versions 9.1.1.0 or 9.0.0.0. I have the latest libgrpc installed, using both homebrew and built from source.
Here is the install on mac:
$ ruby -v
jruby 9.1.1.0 (2.3.0) 2016-05-19 fe84e89 Java HotSpot(TM) 64-Bit Server VM 25.91-b14 on 1.8.0_91-b14 +jit [darwin-x86_64]
$ gem install --ignore-dependencies grpc
Fetching: grpc-0.14.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing grpc:
ERROR: Failed to build gem native extension.
current directory: /Users/blowmage/.gem/repos/jruby-9.1.1.0-grpc/gems/grpc-0.14.1/src/ruby/ext/grpc
/Users/blowmage/.rubies/jruby-9.1.1.0/bin/jruby -r ./siteconf20160524-43017-endf8.rb extconf.rb
NotImplementedError: C extensions are not supported
<top> at /Users/blowmage/.rubies/jruby-9.1.1.0/lib/ruby/stdlib/mkmf.rb:1
require at org/jruby/RubyKernel.java:944
(root) at /Users/blowmage/.rubies/jruby-9.1.1.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
<top> at extconf.rb:30
extconf failed, exit code 1
Gem files will remain installed in /Users/blowmage/.gem/repos/jruby-9.1.1.0-grpc/gems/grpc-0.14.1 for inspection.
Results logged to /Users/blowmage/.gem/repos/jruby-9.1.1.0-grpc/extensions/universal-java-1.8/2.3.0/grpc-0.14.1/gem_make.out
Strangly enough, it does install on linux! Here is that install:
$ ./bin/jruby -v
jruby 9.1.1.0 (2.3.0) 2016-05-19 fe84e89 OpenJDK 64-Bit Server VM 24.95-b01 on 1.7.0_95-b00 +jit [linux-x86_64]
$ gem install --ignore-dependencies grpc
Building native extensions. This could take a while...
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 19 (13 by maintainers)
@apolcyn - what I’m looking for is the ability for Ruby dependency management tools like
bundler
to Do the Right Thing™️ when higher level gems (likegoogle-cloud-datastore
for example) express a dependency on thegrpc
gem under a JRuby interpreter. From the perspective of the Gemspec, the approach that the Google Protobuf took is near ideal for my purposes: when executed on the JRuby interpreter, include the jar file rather than the C implementation files. In Protobuf’s case, the job of getting your hands on the jar is a little bit more straightforward as it is built from the same repo as the gem, but there already exist tools to leverage Maven dependencies from JRuby rather than store the jar binary alongside the ruby source. From there it is about building a shim over the Java implementation (to the extent necessary) to provide Ruby API compatibility.