[Ruby] Add ruby_abi_version to exported symbols (#28976)

The next Ruby version, 3.2, will have builtin ABI checking (see
ruby/ruby#5474). This requires that the symbol `ruby_abi_version` is
present in the shared object, otherwise the object fails to load.

For example, this is a small repro in Ruby 3.2:

```
$ ruby -Isrc/ruby/lib -e "require 'grpc'"
<internal:/home/peter/src/ruby/install/lib/ruby/3.2.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require': /home/peter/src/grpc/src/ruby/lib/grpc/grpc_c.so: undefined symbol: ruby_abi_version - ruby_abi_version (LoadError)
	from <internal:/home/peter/src/ruby/install/lib/ruby/3.2.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /home/peter/src/grpc/src/ruby/lib/grpc/grpc.rb:22:in `<top (required)>'
	from /home/peter/src/grpc/src/ruby/lib/grpc.rb:19:in `require_relative'
	from /home/peter/src/grpc/src/ruby/lib/grpc.rb:19:in `<top (required)>'
	from <internal:/home/peter/src/ruby/install/lib/ruby/3.2.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/home/peter/src/ruby/install/lib/ruby/3.2.0+0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from -e:1:in `<main>'
```
pull/29840/head
Peter Zhu 3 years ago committed by GitHub
parent c16fa00f94
commit d316cf7ae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/ruby/ext/grpc/ext-export.clang
  2. 1
      src/ruby/ext/grpc/ext-export.gcc

@ -1 +1,2 @@
_Init_grpc_c
_ruby_abi_version

@ -1,6 +1,7 @@
grpc_1.0 {
global:
Init_grpc_c;
ruby_abi_version;
local:
*;
};
Loading…
Cancel
Save