-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Does not work on ruby:2.3-alpine docker image #2335
Comments
I am also faced with a problem. I have tried to solve it by some workaround.
After doing it, the error in protobuf seems to be resolved. |
For those following along here, it's worth noting that as of Bundler 1.14, you can set either
Looks like
[EDIT: FWIW, just altering extconf.rb to not build |
Looks like the fix for #2783 released in 3.2.0.1 was the culprit. So, for those who are willing to build from source to work around this issue, with gem 'google-protobuf', '3.2.0' That's it! |
@ernie I wrote a possible fix on this branch, and essentially just added an |
@acozzette happy to. Will report back here. |
@acozzette yep, the gem built fine. Including output here for documentation purposes:
|
Actually let me reopen this; the issue about building from source is now resolved, but I'm not sure if we still want to look into ways of providing a published gem that works out of the box. |
@acozzette how do I force a gem to build? I tried setting |
Includes fixes to build and run `google-cloud-monitoring` and `-logging` gems, which depend on `grpc` and `protobuf` and their native extensions (see protocolbuffers/protobuf#4460, protocolbuffers/protobuf#2335, gliderlabs/docker-alpine#424, grpc/grpc#6525 for details)
Same issue for me. why this issue closed without any solutions?
LoadError: 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 Can somebody look? |
I've got this in my Gemfile:
Which is building correctly:
But when I run the ruby app (rails, to precompile assets), I get this:
|
We also had problems running the google-protobuf gem on Alpine Linux. Compiling worked fine, but the gem could not be loaded:
I think the problem is that code checks if we are compiling with C99 here: protobuf/ruby/ext/google/protobuf_c/upb.h Line 81 in a62ee83
While at the same time it is specified that we compile with
It will instead enter the elif case and use the symbol protobuf/ruby/ext/google/protobuf_c/upb.h Line 110 in a62ee83
Not sure why it compiles, but musl, which is used on Alpine Linux instead of glibc, does not provide this symbol. A workaround we found is to define
|
This is suppose to be fixed in Alpine 3.11.5, check |
@MatayoshiMariano I'm running into the same issue. Have you found a solution? |
@tzusman unfortunately not, right now i'm using
And ruby 2.6.6 Can't upgrade to 2.7.1 until this and this issue is fixed |
As described in https://www.gnu.org/software/libc/manual/html_node/Argument-Macros.html and protocolbuffers#2335 (comment): 1. `va_copy` is not available when building to ISO C90. 2. When `RUBY_PLATFORM` is `linux` or `darwin`, ISO C90 mode is used. 3. Prior to GCC 3.0, GCC provided `__va_copy` as an extension in any standard mode. After GCC 3.0, the compiler builtin is available. Prior to this change, attempting to load the Ruby google-protobuf gem on a musl-based Linux system (e.g. Alpine Linux) would result in `__va_copy: symbol not found`. The only workaround would be to build the Ruby gem with `--with-cflags=-D__va_copy=va_copy`. To fix this, we only use the `__va_copy` macro in scenarios where `__GNUC__ < 3`. This mirrors the change in musl: https://git.musl-libc.org/cgit/musl/commit/?id=def0af189871a499efdc9bc37438d8b20eb702ab.
The workaround in #2335 (comment) worked for me. #7773 should fix this problem. |
Thanks to all the people who commented on this issue. I was able to get a working Dockerfile to run Ruby 2.7.4 with Alpine Linux 3.14. Currently ruby:2-alpine refers to 2.7.4-alpine3.14. Dockerfile
Gemfile:
Finally, this compiles and runs Ruby on Rails using stackdriver gem and other google-cloud-* gems without segfaulting. However, the only issue is that this causes my build time to balloon from around 10 minutes to over 40 minutes, due to all the native gems being compiled. Anyone know of a way to selectively build native Ruby gems using bundler? Ideally we only want the protobuf and grpc gems to be compiled, and everything else to use pre-built binaries. |
It throws
__memcpy_chk: symbol not found
error when trying torequire 'google/protobuf'
.As i understand the issue is that Apline is using
musl
instead ofglibc
. Would be nice ifgoogle-protobuf
could work on Alpine ruby since other ruby images are significantly bigger.Environment: ruby:2.3-alpine docker image
To reproduce it:
Workaround is to change the docker image to
ruby:2.3-slim
, which is about 150 megabytes bigger.The text was updated successfully, but these errors were encountered: