Bug #19082
closedRecent gRPC gem fails to build from the source in already released versions
Description
About 10 days ago, this commit in the ruby_3_1 branch removed the "$" from "[$flag=]" on line 3073 of configure.ac
:
https://github.com/ruby/ruby/commit/ee6cc2502664ac46edc61868d8954b626bb48e53#r87450090
This causes the installation of the grpc gem to fail whereas before this change, the gem installed fine. If I add the dollar sign back in, the grpc gem installs successfully.
Here are the steps to reproduce:
- Clone the Ruby repo on an Apple Silicon Mac that has v14 of the command line tools
git checkout -b ruby_3_1 origin/ruby_3_1
- Compile Ruby:
./autogen.sh
./configure --with-opt-dir="$(brew --prefix openssl@3):$(brew --prefix readline):$(brew --prefix libyaml):$(brew --prefix gdbm):$(brew --prefix gmp)" --prefix=/Users/moncef/.rubies/ruby-3.1.3 --disable-install-doc
make -j7 main
make -j7 install
-
Switch to 3.1.3 with
chruby 3.1.3
-
gem install grpc
With the current branch, this fails. -
Remove ~/.rubies/ruby-3.1.3 and ~/.gem/ruby/3.1.3
-
Add the dollar sign back in
configure.ac
-
Compile Ruby 3.1.3 again the same way as above
-
Switch to 3.1.3
-
gem install grpc
=> This works now.
I attached a zip file of the "gem_make.out" file that shows the full stack trace for why grpc failed to build the gem native extension.
Files
Updated by nobu (Nobuyoshi Nakada) about 2 years ago
ruby_abi_version
has not been used in prior to 3.2, and there is no such string in 3.1 source in fact.
linking shared-object grpc/grpc_c.bundle
Undefined symbols for architecture arm64:
"_ruby_abi_version", referenced from:
-exported_symbol[s_list] command line option
Updated by nobu (Nobuyoshi Nakada) about 2 years ago
- Status changed from Open to Feedback
- Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED
By adding the dollar sign, $flag=
just results in an error, and -undefined dynamic_lookup
flag will be added to DLDFLAGS
.
That means the undefined reference just hidden by that flag.
The real cause is not related to that commit at all.
After the build error, can't you show which of the remained object files has the reference?
Updated by nobu (Nobuyoshi Nakada) about 2 years ago
- Status changed from Feedback to Third Party's Issue
It seems https://github.com/grpc/grpc/pull/28976.
Updated by nobu (Nobuyoshi Nakada) about 2 years ago
- Subject changed from Recent change in the ruby_3_1 branch prevents some gems from being installed on Apple Silicon to Recent gRPC gem fails to build from the source in already released versions
Updated by nobu (Nobuyoshi Nakada) about 2 years ago
Probably this issue will be fixed by https://github.com/grpc/grpc/pull/31151.
Updated by monfresh (Moncef Belyamani) about 2 years ago
nobu (Nobuyoshi Nakada) wrote in #note-5:
Probably this issue will be fixed by https://github.com/grpc/grpc/pull/31151.
Ah! Yes! Thanks for the explanation about what the dollar sign does. I just built the grpc gem locally with the fix in that PR and it installed fine in Ruby 3.1.3.
Updated by stanhu (Stan Hu) about 2 years ago
monfresh (Moncef Belyamani) wrote in #note-6:
nobu (Nobuyoshi Nakada) wrote in #note-5:
Probably this issue will be fixed by https://github.com/grpc/grpc/pull/31151.
Ah! Yes! Thanks for the explanation about what the dollar sign does. I just built the grpc gem locally with the fix in that PR and it installed fine in Ruby 3.1.3.
Note that this issue is also related to https://bugs.ruby-lang.org/issues/19005. The fixes for Ruby to include -undefined dynamic_lookup
to include these flags in XCode 14 despite the warning would fix this issue.
Could Ruby release a new version so we don't hit more of these issues?
Updated by stanhu (Stan Hu) almost 2 years ago
Ok, this is indeed a bug. While Ruby 2.7.7 and 3.0.5 work, Ruby 3.1.3 and up have reintroduced https://bugs.ruby-lang.org/issues/19005. See https://bugs.ruby-lang.org/issues/19005#note-25.
Updated by Eregon (Benoit Daloze) almost 2 years ago
- Related to Bug #19005: Ruby interpreter compiled XCode 14 cannot build some native gems on macOS added