What version of protobuf and what language are you using?
Version: 3.11.2 (released ~December 13, 2019)
Language: Ruby 2.7 (released December 25, 2019)
Windows 8, Linux Ubuntu and Mint
What runtime / compiler are you using (e.g., python version or gcc version)
Ruby 2.7
What did you do?
Steps to reproduce the behavior:
require 'google-protobuf' at the startThis can also be reproduced by using Travis-CI's 2.7 environment on any of their images.
What did you expect to see
On Ruby 2.3 through 2.6 this results in the expected program execution.
What did you see instead?
On Ruby 2.7, on each platform I've tested on, this results in the following two errors:
[Snip]
1: from /home/travis/.rvm/gems/ruby-2.7.0/gems/google-protobuf-3.11.2-x86_64-linux/lib/google/protobuf.rb:49:in '/home/travis/.rvm/gems/ruby-2.7.0/gems/google-protobuf-3.11.2-x86_64-linux/lib/google/protobuf.rb:49:in
require: cannot load such file -- google/2.7/protobuf_c (LoadError)[Snip]
2: from /home/travis/.rvm/gems/ruby-2.7.0/gems/google-protobuf-3.11.2-x86_64-linux/lib/google/protobuf.rb:48:in
<top (required)>1: from /home/travis/.rvm/gems/ruby-2.7.0/gems/google-protobuf-3.11.2-x86_64-linux/lib/google/protobuf.rb:51:in
rescue in <top (required)>/home/travis/.rvm/gems/ruby-2.7.0/gems/google-protobuf-3.11.2-x86_64-linux/lib/google/protobuf.rb:51:in
require: cannot load such file -- google/protobuf_c
Anything else we should know about your project / environment
This appears to be related to Ruby 2.7 releasing a few days after 3.11.2 released as it occurs on each system I try with 2.7 on it (including Travis-ci), but any older Ruby version works fine with 3.11.2. As 27 is a major release for Ruby and new installs will start to incorporate it, suggest either not letting the gem install on it, or putting out a bug fix to support 2.7 prior to the next release.
I have a draft PR in the works here: https://github.com/protocolbuffers/protobuf/pull/7091
On MacOS, I'm getting a segfault before I can complete the test suite.
I had to run: ./tests.sh ruby27 after this to tests.sh:
build_ruby27() {
internal_build_cpp # For conformance tests.
cd ruby && bash travis-test.sh ruby-2.7.0 && cd ..
}
Just leaving this so anybody else ending up at the, sadly locked, grpc thread will find their way here:
https://github.com/grpc/grpc/issues/17744
And some searchable stuff:
Ruby 2.7 cannot load such file -- google/protobuf_c grpc bundle exec ./greeter_server.rb protobuf.rb
same here, grpc fixed this: https://github.com/grpc/grpc/issues/21514
The load error is still present with ruby 2.7.0, grpc 1.28.0 and google protobuf 3.11.4
Any update on this? We're hoping to upgrade to ruby 2.7 and this is the only gem that is not compatible
I realize my PR https://github.com/protocolbuffers/protobuf/pull/7091 was lingering in Draft mode. I've now marked it ready for review. Hopefully this helps moving things along.
https://github.com/protocolbuffers/protobuf/pull/7027 this is now merged
Thanks for working on this issue. Unfortunately #7027 didn't fix it for me. I now get:
cannot load such file -- google/protobuf/any_pb
Trace:
/ruby/lib/google/protobuf/well_known_types.rb:32:in `<main>'
in Ruby 2.7.1 and 2.6.5.
Same error here
Here the same problem :/
To clarify, is this error coming from the gem or from GitHub master?
I believe we have merged all Ruby 2.7-related pull requests, so all we should need is a release to push them to Ruby Gems.
If that is not true, please speak up so we can figure out what we need to fix before the next release!
What i've gathered is that the problem exists only in the precompiled lib.
Forcing a compilation fixes the issue.
There is a release candidate on RubyGems that should have full Ruby 2.7 support.
Can anybody who has been having trouble verify that the 3.12.0-rc1 gem fixes the problem?
https://rubygems.org/gems/google-protobuf/versions/3.12.0.rc.1
3.12.0-rc1 working for me. Thanks!
I'm having the same issue with 3.12.1, ruby 2.7.1 and Rails 5.1.7 https://github.com/protocolbuffers/protobuf/issues/7541
Same here @MatayoshiMariano but forcing a compilation in my gemfile for the time being worked.
@MatayoshiMariano @billguy I have you tried the rc version? That one is working for us on rby 2.7
@micke Didn't try but won't be adding a rc to the Gemfile, all changes in a rc should be included in the stable version, right?
UPDATE
Tried the 3.12.0.rc.1 just in case, but same issue here.
Also 2.6.6 fails for me too
@MatayoshiMariano Can you paste the error you are getting? A minimal repro would help too.
I am able to install and require the latest release on Ruby 2.7.1 on Linux:
$ gem install google-protobuf
Fetching google-protobuf-3.12.1-x86_64-linux.gem
Successfully installed google-protobuf-3.12.1-x86_64-linux
Parsing documentation for google-protobuf-3.12.1-x86_64-linux
Installing ri documentation for google-protobuf-3.12.1-x86_64-linux
Done installing documentation for google-protobuf after 0 seconds
1 gem installed
$ irb
irb(main):001:0> require 'google/protobuf'
=> true
irb(main):002:0>
$ ruby --version
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
@haberman I created the issue Ruby: Gem version 3.12.1 doesn't load on Ruby 2.7 or 2.6.6 with Rails 5.1.7, different gem version than this one. I pasted there the errors I'm getting
Most helpful comment
The load error is still present with ruby 2.7.0, grpc 1.28.0 and google protobuf 3.11.4