From 6076825390164c51a0017cb2893de708a0e3b338 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Fri, 23 Jun 2023 18:43:02 -0400 Subject: [PATCH] [ruby] Add `-weak_framework CoreFoundation` to link line (#33538) Add -weak_framework CoreFoundation to the ruby extension link line on arm64-darwin, to address "undefined symbols" issues from #33483 This is a variation on #33513 in response to feedback and so I've made sure @alto-ruby is credited as co-author. Closes #33483 Supersedes #33513 cc @apolcyn Co-authored-by: alto-ruby --- src/ruby/ext/grpc/extconf.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index 5658a8ce58e..5dd2a23ac44 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -141,7 +141,10 @@ end ext_export_file = File.join(grpc_root, 'src', 'ruby', 'ext', 'grpc', ext_export_filename()) $LDFLAGS << ' -Wl,--version-script="' + ext_export_file + '.gcc"' if linux -$LDFLAGS << ' -Wl,-exported_symbols_list,"' + ext_export_file + '.clang"' if apple_toolchain +if apple_toolchain + $LDFLAGS << ' -weak_framework CoreFoundation' if RUBY_PLATFORM =~ /arm64/ + $LDFLAGS << ' -Wl,-exported_symbols_list,"' + ext_export_file + '.clang"' +end $LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows if grpc_config == 'gcov'