grpc: Undefined symbol `_ruby_abi_version` regression with Xcode 13 -> 14
What version of gRPC and what language are you using?
grpc: 1.48.0 language: ruby 2.7.6
What operating system (Linux, Windows,…) and version?
MacOS 12.6 Apple M1 chip
What runtime / compiler are you using (e.g. python version or version of gcc)
Xcode 14
What did you do?
gem install grpc -v 1.48.0
What did you expect to see?
Successfully install
What did you see instead?
Undefined symbols for architecture arm64:
"_ruby_abi_version", referenced from:
-exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [grpc_c.bundle] Error 1
Anything else we should know about your project / environment?
Worked correctly a few days ago with Xcode 13
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 30
- Comments: 22 (5 by maintainers)
Commits related to this issue
- [Ruby] Stop stripping exported symbols This commit stops stripping exported symbols in the compiled binary. This will ensure that functions like `Init_grpc` and `ruby_abi_version` are not removed fro... — committed to peterzhu2118/grpc by peterzhu2118 2 years ago
- [Ruby] Stop stripping exported symbols This commit stops stripping exported symbols in the compiled binary. This will ensure that functions like `Init_grpc` and `ruby_abi_version` are not removed fro... — committed to healthie/grpc by peterzhu2118 2 years ago
As mentioned in the Ruby issue, there are several possible workarounds until Ruby releases the patched versions for this (or gRPC fixes the underlying symbol issue):
DLDFLAGS="-Wl,-undefined,dynamic_lookup"
set in the environment. Note that I don’t believe that setting the environment and rungem install grpc
alone works because gRPC will default to using the RubyDLDFLAGS
.RbConfig::CONFIG['DLDFLAGS']
should show these flags:gem install
:bundle config
:Explanation
As I mentioned in the Ruby bug report, XCode 14.0 now warns with the message when
-Wl,undefined,dynamic_lookup
is used:This warning was enough to make the Ruby
configure
script believe that those flags were no longer available on the system.-Wl,undefined,dynamic_lookup
has long been the default everywhere, and most gems were not tested without those flags.I believe the patches in https://github.com/ruby/ruby/pull/6441/files fix the
configure
script in Ruby to enable this linker option despite this warning message, which is why the latest 3.2.0 preview release works fine. The patches have been backported to 2.7 and up, but there is no official released version yet.I’m still getting the same make error after running:
Downgrading grpc to 1.470 was the fix for me too! Thanks
Just to follow up, the workaround didn’t work for us and we ended up downgrading grpc to 1.470
I have been trying this workaround and it helped, I just needed to run it in the following sequence, so the grpc installation runs on clean environment I guess.
Yeah, 3.1.3, 3.2.0, and other versions still need the flags. Apparently the fix accidentally worked in 2.7.7 and 3.0.5. See my note in https://bugs.ruby-lang.org/issues/19005#note-25.
I proposed an upstream fix in https://github.com/ruby/ruby/pull/7086.
https://github.com/grpc/grpc/pull/31151 fixes this (not merged yet).
Same issue with M1 Pro Apple Silicon (arm64) but on ruby 3.1.0 . Uninstalling and installing again didnt solve
I had the same issue but with Ruby 3.0.4. After trying everything else, I fixed it by reinstalling Ruby:
It’s also worth noting that I got the error while I was migrating from an older MacBook Pro with Intel arch to the new M1 Pro Apple Silicon (arm64).
@ethankhall found a workaround for this:
cc @ngan @noizwaves
3.1.3 still threw the error for me without the flags.