-
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
Update Ruby gem with arm64 binaries (Apple M1 support) #8199
Comments
Confirmed that
in combination with grpc v1.35.0 upgrade solved this issue for me. |
This still does not work for me. I have v. 3.15.3 installed and it throws this:
If I try to load the gem locally and alter lines inside # begin
require "google/#{RUBY_VERSION.sub(/\.\d+$/, '')}/protobuf_c"
# rescue LoadError
# require 'google/protobuf_c'
# end I get:
Any clue why this happens? |
Okay I tried updating to v
I just tried to checkout the ruby gem and see if it could build, it cannot: #8372 |
solved on my new M1 Mac, try the following steps:
seems bundle config force ruby platform not working, we have to reinstall google-protobuf platform: ruby from scratch |
None of these solutions worked for me on 3.17.3 on a 13" M1 MBP. I'm running the latest Monterey public beta (beta 5 I believe) so maybe that's the issue? Installation went fine but when I go to require it I get a "No such file" error when looking for the arm64e bundle. Here's the full error:
I tried on Ruby 2.6.8p205 and 2.7.4p191. I tried recompiling Ruby several times using Xcode Command Line tools and the full version of Xcode (Mac App Store). |
Is there anyway to force bundler to use the Rubygems version installed with Whenever I run |
If you want to prevent bundler from installing these gems, add the following to you # HACK(bouk): Overwrite Bundler's platform matcher to ignore universal CPU
# The protobuf and gRPC 'universal' macOS gems break on M1
module Bundler::MatchPlatform
def match_platform(p)
return false if ::Gem::Platform === platform && platform.cpu == "universal"
Bundler::MatchPlatform.platforms_match?(platform, p)
end
end This will overwrite bundler's platform matcher to ignore any universal gems |
I think some more work is required on the protobuf team's part before we can start publishing Mac arm64 binaries. The build is happening on an x86 machine and we probably need to tweak some things to get cross-compilation working. |
+1 for this |
I've tried all of the suggestions above, but still doesn't work for me: I get this error:
I'm running on Mac M1:
|
Updates on this issue? It appears to be ongoing and I'm only able to bundle with |
Similar to #8682, closing this because in version 3.22 protobuf is planning to experiment with releasing only a source gem. If this experiment is unsuccessful and we revert to building binary gems for some platforms, we'll evaluate whether it makes sense to add arm64 darwin at that time. |
I am running this on M2, facing the same issue
dont know what to do? |
I resolved the issue by ditching homebrew and following the ruby installation docs provided on Jekyll site |
This really helps after searching for a lot methods. |
Protobuf is releasing with arm64-darwin binary gems. For example, here is the latest one: https://rubygems.org/gems/google-protobuf/versions/3.24.2-arm64-darwin However, the current gems require Ruby >=2.7, and I believe macOS is still shipping with Ruby 2.6. So to use the current version of the protobuf package, you would need to install a separate Ruby from Homebrew (or from source). |
The Ruby gem is shipped with compiled extensions (via https://github.com/rake-compiler/rake-compiler), but it is missing arm64 binaries.
This results in errors like the following when installing the gem and requiring:
A workaround is to force compilation of native extensions on install which works perfectly:
or globally via this bundler setting:
Related to #8062
The text was updated successfully, but these errors were encountered: