Skip to content
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

Ruby: Gem version 3.11.2 doesn't load on Ruby 2.7 #7070

Closed
threeplanetssoftware opened this issue Jan 9, 2020 · 25 comments
Closed

Ruby: Gem version 3.11.2 doesn't load on Ruby 2.7 #7070

threeplanetssoftware opened this issue Jan 9, 2020 · 25 comments

Comments

@threeplanetssoftware
Copy link

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:

  1. gem install google-protobuf
  2. Run any Ruby code which has require 'google-protobuf' at the start
  3. Get Load Errors, see below.

This 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 '<top (required)>'

/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.

@ewalk153
Copy link
Contributor

ewalk153 commented Jan 14, 2020

I have a draft PR in the works here: #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 ..
}

@gerrywastaken
Copy link

gerrywastaken commented Mar 8, 2020

Just leaving this so anybody else ending up at the, sadly locked, grpc thread will find their way here:
grpc/grpc#17744

And some searchable stuff:
Ruby 2.7 cannot load such file -- google/protobuf_c grpc bundle exec ./greeter_server.rb protobuf.rb

@rainchen
Copy link

same here, grpc fixed this: grpc/grpc#21514

@sriedel
Copy link

sriedel commented Apr 3, 2020

The load error is still present with ruby 2.7.0, grpc 1.28.0 and google protobuf 3.11.4

@kryptonat
Copy link

Any update on this? We're hoping to upgrade to ruby 2.7 and this is the only gem that is not compatible

@ewalk153
Copy link
Contributor

I realize my PR #7091 was lingering in Draft mode. I've now marked it ready for review. Hopefully this helps moving things along.

@sophieyfang
Copy link

#7027 this is now merged

@ojundt
Copy link

ojundt commented Apr 17, 2020

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.

@iagopiimenta
Copy link

Same error here

@douglara
Copy link

Here the same problem :/

@haberman
Copy link
Member

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!

@micke
Copy link

micke commented Apr 28, 2020

What i've gathered is that the problem exists only in the precompiled lib.
Forcing a compilation fixes the issue.

@haberman
Copy link
Member

haberman commented May 5, 2020

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

@blzabub
Copy link

blzabub commented May 5, 2020

3.12.0-rc1 working for me. Thanks!

@MatayoshiMariano
Copy link

MatayoshiMariano commented May 21, 2020

I'm having the same issue with 3.12.1, ruby 2.7.1 and Rails 5.1.7 #7541

@billguy
Copy link

billguy commented May 21, 2020

Same here @MatayoshiMariano but forcing a compilation in my gemfile for the time being worked.

@micke
Copy link

micke commented May 21, 2020

@MatayoshiMariano @billguy I have you tried the rc version? That one is working for us on rby 2.7

@MatayoshiMariano
Copy link

MatayoshiMariano commented May 21, 2020

@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

@haberman
Copy link
Member

@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]

@MatayoshiMariano
Copy link

MatayoshiMariano commented May 21, 2020

@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

@haberman
Copy link
Member

Closing this issue as I believe it is obsolete.

@jjb
Copy link

jjb commented Sep 28, 2021

@micke thanks for the hack!

@haynesgt
Copy link

Simple fix for me was bundle config set force_ruby_platform true (does the same thing as hack from micke -- also see #8199)

@CarterPape
Copy link

@haynesgt Thank you for the more elegant workaround. It worked for me.

@hmarin-sunpower
Copy link

hmarin-sunpower commented Jan 3, 2023

this worked for me gem uninstall google-protobuf -a; BUNDLE_FORCE_RUBY_PLATFORM=true bundle install
ruby 2.6.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests