New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't install google-protobuf (3.25.1) on JRuby 9.4.5.0 on aarch64 #8062
Comments
@dentarg The problem here is that google-protobuf only has a C extension at this point. I believe there was work planned to make it use FFI, or to add a JVM/JRuby version, but I have no idea whether that work has gone forward. Have you checked their bug tracker to see if anyone else is trying to use JRuby? |
@headius google-protobuf has been supported on JRuby (via ffi) since 2021 :) but you still need a working compiler to build C extensions for it. @dentarg based on your log - cc command failed with status (127) which means you don't have a compiler (gcc / clang) installed in your docker container. Something like https://github.com/alexandreelise/install-gcc/blob/master/Dockerfile should help. |
I'm using https://github.com/jruby/docker-jruby so maybe this issue should be transfered to that repo? |
yes, but it's questionable if devkit tools should be included by default because JRuby itself (and most gems) don't need them, only gems with C extensions do using precompiled binaries for each platform is an alternative option, but google-protobuf requires both java and c extensions, so they would have to bundle binaries for all platforms in a single gem (platform=java). There's no way to solve this combination cleanly with the current version of rubygems & rake compiler. |
Wouldn't it make it so much easier to install a lot more gems that need to be compiled? |
@jimtng definitely, but there are downsides. anyway, we should at least improve the error message, because it should be something like This gem requires C extensions, but devkit isn't available, please add these (...) libraries to your bundle. |
@ahorek Thank you, I knew about the FFI work but I lost track of it. Glad to hear it is working!
Yeah I wish we had a better option here. RubyGems needs better support for conditional dependencies based on OS, architecture, and Ruby engine.
@jimtng There are very few such gems, but it is a growing problem. The more we push FFI for integrating native code, the more we see gems like sassc and google-protobuf that expect to be able to build that native code before binding it. We have had other requests to add build tools to the JRuby docker images, and while we're not opposed to it we'd probably do so as a separate image, to avoid existing users suddenly getting a larger image with tools they don't need or want. It's a trade-off we're still actively debating. Of course it's also pretty easy for you to just add some commands and install the necessary tools on your end while spinning up the container, right? |
Only just stumbled across this but there's some discussion and background at protocolbuffers/protobuf#14611 with more specific summary of their plans for jruby/java at protocolbuffers/protobuf#14611 (comment) My problem was mainly with Windows because toolchain is more of a pain there and we already had toolchains installed for Linux runners for other purposes, but the wider summary of where they are going on Ruby with ffi/ffi-compiler may be useful. |
From
docker run -it --rm jruby:9.4.5.0 bash
(on Apple silicon)Not sure what goes wrong here, maybe the issue is with https://github.com/jruby/docker-jruby and not JRuby in general. I'll let you experts decide on that.
The text was updated successfully, but these errors were encountered: