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

require 'google/protobuf' fails on ruby gem version 3.4.0 x86_64-linux #3509

Closed
dduvnjak opened this issue Aug 17, 2017 · 21 comments
Closed

Comments

@dduvnjak
Copy link

Latest version of the ruby gem cannot be required in code, at least the linux version. Here is the error message:

> ruby -v
ruby 2.4.1p111 (2017-03-22

> irb
require 'google/protobuf'
LoadError: cannot load such file -- google/protobuf
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from (irb):1
	from /usr/local/bin/irb:11:in `<main>'

The above can be reproduced on the official Ruby ruby:2.4.1 Docker image, with just the google-protobuf gem installed.
Note that this is a breaking change for all gems which depend on google-protobof, including the latest stable grpc gem.

@liujisi
Copy link
Contributor

liujisi commented Aug 17, 2017

I 'gem yanked' 3.4.0 for now, and will investigate later. Sorry for the breakage.

@liujisi liujisi self-assigned this Aug 17, 2017
@apolcyn
Copy link

apolcyn commented Aug 17, 2017

Are we able to also yank all platform-specific versions of the 3.4.0 gem?

I'm seeing platform-specific 3.4 gems getting pulled down still.

(e.g.,

on rubygems all of these gems are still present:

3.4.0 - August 16, 2017 x86_64-linux (1.09 MB)
3.4.0 - August 16, 2017 x64-mingw32 (1.19 MB)
3.4.0 - August 16, 2017 x86-linux (986 KB)
3.4.0 - August 16, 2017 x86-mingw32 (1.11 MB)
3.4.0 - August 17, 2017 universal-darwin (980 KB)
3.4.0 - August 16, 2017 (223 KB) yanked

)

@liujisi
Copy link
Contributor

liujisi commented Aug 17, 2017

Yanked them all.

@blowmage
Copy link
Contributor

Is this a file permissions issue like we've seen in other gems?

googleapis/gax-ruby#78
googleapis/gax-ruby#54

@liujisi
Copy link
Contributor

liujisi commented Aug 17, 2017

pushed 3.4.0.1 gems for linux/windows. Could you please test if it works this time?

@blowmage
Copy link
Contributor

I've got green builds on darwin and linux using 3.4.0.1. No LoadError's.

@liujisi
Copy link
Contributor

liujisi commented Aug 17, 2017

It looks like I screwed up again on the darwin native one. Would have yank and upload 3.4.0.2 again.

@blowmage
Copy link
Contributor

Confirmed, google-protobuf-3.4.0.1-universal-darwin.gem raises LoadError: cannot load such file -- google/protobuf

@liujisi
Copy link
Contributor

liujisi commented Aug 17, 2017

3.4.0.2 should fix the issues now. Feel free to open it if there are still issues.

@swathibala15
Copy link

I am getting this issue with google-protobuf 3.6.1.
Please let me know if I am missing anything.

Testing started at 3:41 PM ...
bundle.bat exec C:\Ruby26-x64\bin\ruby.exe -EUTF-8 C:\Ruby26-x64\bin\cucumber "C:/Users/Swathi Bala/RubymineProjects/untitled/Features/Cucumberfile.feature" --format Teamcity::Cucumber::Formatter --expand --name "^Login successfully in to www.demo.guru99.com/V4/$" --color -r features
Traceback (most recent call last):
31: from C:/Ruby26-x64/bin/cucumber:23:in <main>' 30: from C:/Ruby26-x64/bin/cucumber:23:in load'
29: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/bin/cucumber:7:in <top (required)>' 28: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/bin/cucumber:7:in require'
27: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/cli/main.rb:4:in <top (required)>' 26: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/cli/main.rb:4:in require'
25: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber.rb:6:in <top (required)>' 24: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber.rb:6:in require'
23: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/runtime.rb:9:in <top (required)>' 22: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/runtime.rb:9:in require'
21: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/filters.rb:3:in <top (required)>' 20: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/filters.rb:3:in require'
19: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/filters/activate_steps.rb:4:in <top (required)>' 18: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/filters/activate_steps.rb:4:in require'
17: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/step_match.rb:3:in <top (required)>' 16: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/step_match.rb:3:in require'
15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/multiline_argument.rb:4:in <top (required)>' 14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/multiline_argument.rb:4:in require'
13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/multiline_argument/data_table.rb:4:in <top (required)>' 12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/multiline_argument/data_table.rb:4:in require'
11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/gherkin/data_table_parser.rb:3:in <top (required)>' 10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/gherkin/data_table_parser.rb:3:in require'
9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gherkin-6.0.15/lib/gherkin/gherkin.rb:3:in <top (required)>' 8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gherkin-6.0.15/lib/gherkin/gherkin.rb:3:in require'
7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gherkin-6.0.15/lib/gherkin/protobuf_cucumber_messages.rb:1:in <top (required)>' 6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gherkin-6.0.15/lib/gherkin/protobuf_cucumber_messages.rb:1:in require'
5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-messages-2.0.0/lib/cucumber/messages.rb:1:in <top (required)>' 4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-messages-2.0.0/lib/cucumber/messages.rb:1:in require'
3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-messages-2.0.0/lib/cucumber/messages_pb.rb:4:in <top (required)>' 2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-messages-2.0.0/lib/cucumber/messages_pb.rb:4:in require'
1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/google-protobuf-3.6.1-x64-mingw32/lib/google/protobuf.rb:48:in <top (required)>' C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/google-protobuf-3.6.1-x64-mingw32/lib/google/protobuf.rb:48:in require': cannot load such file -- google/2.6/protobuf_c (LoadError)
32: from C:/Ruby26-x64/bin/cucumber:23:in <main>' 31: from C:/Ruby26-x64/bin/cucumber:23:in load'
30: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/bin/cucumber:7:in <top (required)>' 29: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/bin/cucumber:7:in require'
28: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/cli/main.rb:4:in <top (required)>' 27: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/cli/main.rb:4:in require'
26: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber.rb:6:in <top (required)>' 25: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber.rb:6:in require'
24: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/runtime.rb:9:in <top (required)>' 23: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/runtime.rb:9:in require'
22: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/filters.rb:3:in <top (required)>' 21: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/filters.rb:3:in require'
20: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/filters/activate_steps.rb:4:in <top (required)>' 19: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/filters/activate_steps.rb:4:in require'
18: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/step_match.rb:3:in <top (required)>' 17: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/step_match.rb:3:in require'
16: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/multiline_argument.rb:4:in <top (required)>' 15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/multiline_argument.rb:4:in require'
14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/multiline_argument/data_table.rb:4:in <top (required)>' 13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/multiline_argument/data_table.rb:4:in require'
12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/gherkin/data_table_parser.rb:3:in <top (required)>' 11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-4.0.0.rc.1/lib/cucumber/gherkin/data_table_parser.rb:3:in require'
10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gherkin-6.0.15/lib/gherkin/gherkin.rb:3:in <top (required)>' 9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gherkin-6.0.15/lib/gherkin/gherkin.rb:3:in require'
8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gherkin-6.0.15/lib/gherkin/protobuf_cucumber_messages.rb:1:in <top (required)>' 7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gherkin-6.0.15/lib/gherkin/protobuf_cucumber_messages.rb:1:in require'
6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-messages-2.0.0/lib/cucumber/messages.rb:1:in <top (required)>' 5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-messages-2.0.0/lib/cucumber/messages.rb:1:in require'
4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-messages-2.0.0/lib/cucumber/messages_pb.rb:4:in <top (required)>' 3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/cucumber-messages-2.0.0/lib/cucumber/messages_pb.rb:4:in require'
2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/google-protobuf-3.6.1-x64-mingw32/lib/google/protobuf.rb:47:in <top (required)>' 1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/google-protobuf-3.6.1-x64-mingw32/lib/google/protobuf.rb:50:in rescue in <top (required)>'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/google-protobuf-3.6.1-x64-mingw32/lib/google/protobuf.rb:50:in `require': cannot load such file -- google/protobuf_c (LoadError)

Process finished with exit code 1

@TeBoring
Copy link
Contributor

@blowmage @liujisi Do you know what's the fix for this change?

@blowmage
Copy link
Contributor

The gem google-protobuf 3.6.1 doesn't have a pre-compiled file for Ruby 2.6. You should either use the 3.7.0.rc.2 gem, or install the gem with --platform=ruby so the gem is compiled for Ruby 2.6 on installation. See the workarounds discussed on #5161.

@TeBoring
Copy link
Contributor

#5701
Someone mentioned 3.7.0.rc.2 gem has the same issue we had for 3.4 release.
Previously, @liujisi yanked gem and fixed the issue.
@blowmage, do you know what was done?

@TeBoring
Copy link
Contributor

Wrong reading. Seems 3.7.0.rc.2 is fine for ruby 2.6.

@OpakAlex
Copy link

Same error with:
docker: ruby:2.6.5-alpine3.10
gem "google-protobuf", "3.11.2", platforms: ["ruby"]

@OpakAlex
Copy link

can we reopen issue @TeBoring ?

@blowmage
Copy link
Contributor

@OpakAlex can you open a new issue with all the relevant details? The error might be the same, but the cause could be different. The more information you can provide, including a minimal reproduction, the better.

@OpakAlex
Copy link

@blowmage thanks for your answer.
I created an example of issue here: https://github.com/OpakAlex/reproduce-google-protobuf-gem-issue
It happens only into docker, so i added docker file, and add Readme.

issue which i have after docker build .:

/bundle/ruby/2.6.0/gems/google-protobuf-3.11.2/lib/google/protobuf.rb:51:in `require': Error relocating /bundle/ruby/2.6.0/gems/google-protobuf-3.11.2/lib/google/protobuf_c.so: __va_copy: symbol not found - /bundle/ruby/2.6.0/gems/google-protobuf-3.11.2/lib/google/protobuf_c.so (LoadError)
	from /bundle/ruby/2.6.0/gems/google-protobuf-3.11.2/lib/google/protobuf.rb:51:in `rescue in <top (required)>'
	from /bundle/ruby/2.6.0/gems/google-protobuf-3.11.2/lib/google/protobuf.rb:48:in `<top (required)>'
	from -e:1:in `require'
/bundle/ruby/2.6.0/gems/google-protobuf-3.11.2/lib/google/protobuf.rb:49:in `require': cannot load such file -- google/2.6/protobuf_c (LoadError)
	from /bundle/ruby/2.6.0/gems/google-protobuf-3.11.2/lib/google/protobuf.rb:49:in `<top (required)>'
	from -e:1:in `require'

@blowmage any chance to look into this?

@blowmage
Copy link
Contributor

I don't know what the underlying issue is, but downgrading to google-protobuf version 3.9 may work for you. Whatever is causing this seems to have been introduced in 3.10.1.

But again, this issue is already closed. Whatever is the cause for this is different than this issue. Please open a new issue, linking to this issue, with all of your relevant details, so that the folks who work on this gem can have the information they need to fix it.

Here is what I've found running on Alpine using the same docker image. All gems seem to install just fine, but version 3.9.2 runs, while 3.10.1 raises.

/ # gem install google-protobuf --version=3.9.2 --platform=ruby
Fetching google-protobuf-3.9.2.gem
Building native extensions. This could take a while...
Successfully installed google-protobuf-3.9.2
1 gem installed
/ # ruby -r 'google/protobuf' -e 'puts "hello"'
hello
/ # gem uninstall google-protobuf
Successfully uninstalled google-protobuf-3.9.2
/ # gem install google-protobuf --version=3.10.1 --platform=ruby
Fetching google-protobuf-3.10.1.gem
Building native extensions. This could take a while...
Successfully installed google-protobuf-3.10.1
1 gem installed
/ # ruby -r 'google/protobuf' -e 'puts "hello"'
Traceback (most recent call last):
	1: from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- google/protobuf (LoadError)
	5: from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
	4: from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
	3: from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
	2: from /usr/local/bundle/gems/google-protobuf-3.10.1/lib/google/protobuf.rb:49:in `<top (required)>'
	1: from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- google/2.6/protobuf_c (LoadError)
	6: from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
	5: from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
	4: from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
	3: from /usr/local/bundle/gems/google-protobuf-3.10.1/lib/google/protobuf.rb:48:in `<top (required)>'
	2: from /usr/local/bundle/gems/google-protobuf-3.10.1/lib/google/protobuf.rb:51:in `rescue in <top (required)>'
	1: from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': Error relocating /usr/local/bundle/gems/google-protobuf-3.10.1/lib/google/protobuf_c.so: __va_copy: symbol not found - /usr/local/bundle/gems/google-protobuf-3.10.1/lib/google/protobuf_c.so (LoadError)
/ # 

It does seem probable that 3.10.1 introduced usage of __va_copy, which is not available on musl. See https://reviews.llvm.org/D36343

@OpakAlex
Copy link

3.9 works. Thanks!

@costa
Copy link

costa commented Dec 22, 2020

@liujisi, all,
I've just got the same error within some docker build with v3.14.0.
Following @blowmage's advice, downgrading to v3.9.2 helped.
I would reopen this issue.

guendto added a commit to guendto/jomiel-client-demos that referenced this issue Jan 11, 2022
…uby/docker/alpine

It now builds and runs without any issues with the google/protobuf gem.
See also, protocolbuffers/protobuf#4460, protocolbuffers/protobuf#3509.
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

8 participants