-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Description
In conda-forge, we build shared libraries for many reasons, and one of the consequences is that we have to rebuild things whenever a new version (resp. changed ABI) of a given library is released. These so-called migrations are usually routine, but still take a certain amount of effort, so there's a natural tendency to group them, especially when they all affect very similar packages that need to be migrated.
This is the case in particular for us w.r.t. abseil, protobuf & grpc. As such, I wanted to build grpc 1.61 against abseil 20240116.0, as in the past these abseil updates were not an issue. After misdiagnosing the first issue I ran into, I realize now that some fixes for the newest abseil only landed after 1.61, but I can deal with that (e.g. by backporting bc04417).
However, even with that fix, the compilation of the C++ helloworld example fails on linux. It passes on osx, which surprised me at first, but I suspect very much that it has something to do with
grpc/src/core/lib/gprpp/sync.h
Lines 45 to 61 in 2393992
| #ifdef GPR_ABSEIL_SYNC | |
| using Mutex = absl::Mutex; | |
| using MutexLock = absl::MutexLock; | |
| using ReleasableMutexLock = absl::ReleasableMutexLock; | |
| using CondVar = absl::CondVar; | |
| // Returns the underlying gpr_mu from Mutex. This should be used only when | |
| // it has to like passing the C++ mutex to C-core API. | |
| // TODO(veblush): Remove this after C-core no longer uses gpr_mu. | |
| inline gpr_mu* GetUnderlyingGprMu(Mutex* mutex) { | |
| return reinterpret_cast<gpr_mu*>(mutex); | |
| } | |
| #else | |
| class ABSL_LOCKABLE Mutex { |
resp.
grpc/include/grpc/support/port_platform.h
Lines 29 to 39 in 2393992
| /* | |
| * Defines GPR_ABSEIL_SYNC to use synchronization features from Abseil | |
| */ | |
| #ifndef GPR_ABSEIL_SYNC | |
| #if defined(__APPLE__) | |
| // This is disabled on Apple platforms because macos/grpc_basictests_c_cpp | |
| // fails with this. https://github.com/grpc/grpc/issues/23661 | |
| #else | |
| #define GPR_ABSEIL_SYNC 1 | |
| #endif | |
| #endif // GPR_ABSEIL_SYNC |
In other words, not using the abseil synchronization features works, but there are problems now also on linux when trying to use them. Not sure why that symbol would not be found, as all the respective grpc files correctly #include "absl/synchronization/mutex.h".
What version of gRPC and what language are you using?
1.61.0
What operating system (Linux, Windows,...) and version?
Linux
What runtime / compiler are you using (e.g. python version or version of gcc)
GCC 12
What did you do?
Compile grpc 1.61.0 with -DgRPC_ABSL_PROVIDER="package" and abseil 20240116.0, then try to compile https://github.com/grpc/grpc/tree/master/examples/cpp/helloworld
What did you expect to see?
Compilation passes
What did you see instead?
[7/18] Linking CXX executable greeter_client
FAILED: greeter_client
: && $PREFIX/bin/x86_64-conda-linux-gnu-c++ -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem $PREFIX/include -fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/libgrpc-1.61.0 -fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,--allow-shlib-undefined -Wl,-rpath,$PREFIX/lib -Wl,-rpath-link,$PREFIX/lib -L$PREFIX/lib CMakeFiles/greeter_client.dir/greeter_client.cc.o -o greeter_client libhw_grpc_proto.a $PREFIX/lib/libabsl_flags_parse.so.2401.0.0 $PREFIX/lib/libgrpc++_reflection.so.1.61.0 $PREFIX/lib/libgrpc++.so.1.61.0 $PREFIX/lib/libprotobuf.so.25.2.0 $PREFIX/lib/libgrpc.so.38.0.0 $PREFIX/lib/libaddress_sorting.so.38.0.0 $PREFIX/lib/libupb_json_lib.so.38.0.0 $PREFIX/lib/libupb_textformat_lib.so.38.0.0 $PREFIX/lib/libupb_message_lib.so.38.0.0 $PREFIX/lib/libupb_base_lib.so.38.0.0 $PREFIX/lib/libupb_mem_lib.so.38.0.0 $PREFIX/lib/libutf8_range_lib.so.38.0.0 $PREFIX/lib/libssl.so $PREFIX/lib/libcrypto.so $PREFIX/lib/libgpr.so.38.0.0 -ldl -lm -lrt $PREFIX/lib/libabsl_random_distributions.so.2401.0.0 $PREFIX/lib/libabsl_random_seed_sequences.so.2401.0.0 $PREFIX/lib/libabsl_random_internal_pool_urbg.so.2401.0.0 $PREFIX/lib/libabsl_random_internal_randen.so.2401.0.0 $PREFIX/lib/libabsl_random_internal_randen_hwaes.so.2401.0.0 $PREFIX/lib/libabsl_random_internal_randen_hwaes_impl.so.2401.0.0 $PREFIX/lib/libabsl_random_internal_randen_slow.so.2401.0.0 $PREFIX/lib/libabsl_random_internal_platform.so.2401.0.0 $PREFIX/lib/libabsl_random_internal_seed_material.so.2401.0.0 $PREFIX/lib/libabsl_random_seed_gen_exception.so.2401.0.0 $PREFIX/lib/libabsl_log_internal_check_op.so.2401.0.0 $PREFIX/lib/libabsl_leak_check.so.2401.0.0 $PREFIX/lib/libabsl_die_if_null.so.2401.0.0 $PREFIX/lib/libabsl_log_internal_conditions.so.2401.0.0 $PREFIX/lib/libabsl_log_internal_message.so.2401.0.0 $PREFIX/lib/libabsl_log_internal_nullguard.so.2401.0.0 $PREFIX/lib/libabsl_examine_stack.so.2401.0.0 $PREFIX/lib/libabsl_log_internal_format.so.2401.0.0 $PREFIX/lib/libabsl_log_internal_proto.so.2401.0.0 $PREFIX/lib/libabsl_log_internal_log_sink_set.so.2401.0.0 $PREFIX/lib/libabsl_log_sink.so.2401.0.0 $PREFIX/lib/libabsl_log_entry.so.2401.0.0 $PREFIX/lib/libabsl_log_initialize.so.2401.0.0 $PREFIX/lib/libabsl_log_globals.so.2401.0.0 $PREFIX/lib/libabsl_vlog_config_internal.so.2401.0.0 $PREFIX/lib/libabsl_log_internal_fnmatch.so.2401.0.0 $PREFIX/lib/libabsl_log_internal_globals.so.2401.0.0 $PREFIX/lib/libabsl_statusor.so.2401.0.0 $PREFIX/lib/libabsl_status.so.2401.0.0 $PREFIX/lib/libabsl_strerror.so.2401.0.0 $PREFIX/lib/libabsl_flags_usage.so.2401.0.0 $PREFIX/lib/libabsl_flags_usage_internal.so.2401.0.0 $PREFIX/lib/libabsl_flags_internal.so.2401.0.0 $PREFIX/lib/libabsl_flags_marshalling.so.2401.0.0 $PREFIX/lib/libabsl_flags_reflection.so.2401.0.0 $PREFIX/lib/libabsl_flags_config.so.2401.0.0 $PREFIX/lib/libabsl_cord.so.2401.0.0 $PREFIX/lib/libabsl_cordz_info.so.2401.0.0 $PREFIX/lib/libabsl_cord_internal.so.2401.0.0 $PREFIX/lib/libabsl_cordz_functions.so.2401.0.0 $PREFIX/lib/libabsl_cordz_handle.so.2401.0.0 $PREFIX/lib/libabsl_crc_cord_state.so.2401.0.0 $PREFIX/lib/libabsl_crc32c.so.2401.0.0 $PREFIX/lib/libabsl_str_format_internal.so.2401.0.0 $PREFIX/lib/libabsl_crc_internal.so.2401.0.0 $PREFIX/lib/libabsl_crc_cpu_detect.so.2401.0.0 $PREFIX/lib/libabsl_raw_hash_set.so.2401.0.0 $PREFIX/lib/libabsl_hash.so.2401.0.0 $PREFIX/lib/libabsl_bad_variant_access.so.2401.0.0 $PREFIX/lib/libabsl_city.so.2401.0.0 $PREFIX/lib/libabsl_low_level_hash.so.2401.0.0 $PREFIX/lib/libabsl_hashtablez_sampler.so.2401.0.0 $PREFIX/lib/libabsl_exponential_biased.so.2401.0.0 $PREFIX/lib/libabsl_flags_private_handle_accessor.so.2401.0.0 $PREFIX/lib/libabsl_flags_commandlineflag.so.2401.0.0 $PREFIX/lib/libabsl_bad_optional_access.so.2401.0.0 $PREFIX/lib/libabsl_flags_commandlineflag_internal.so.2401.0.0 $PREFIX/lib/libabsl_flags_program_name.so.2401.0.0 $PREFIX/lib/libabsl_synchronization.so.2401.0.0 $PREFIX/lib/libabsl_graphcycles_internal.so.2401.0.0 $PREFIX/lib/libabsl_kernel_timeout_internal.so.2401.0.0 $PREFIX/lib/libabsl_time.so.2401.0.0 $PREFIX/lib/libabsl_civil_time.so.2401.0.0 $PREFIX/lib/libabsl_time_zone.so.2401.0.0 $PREFIX/lib/libabsl_stacktrace.so.2401.0.0 $PREFIX/lib/libabsl_symbolize.so.2401.0.0 $PREFIX/lib/libabsl_strings.so.2401.0.0 $PREFIX/lib/libabsl_strings_internal.so.2401.0.0 $PREFIX/lib/libabsl_string_view.so.2401.0.0 $PREFIX/lib/libabsl_int128.so.2401.0.0 $PREFIX/lib/libabsl_throw_delegate.so.2401.0.0 $PREFIX/lib/libabsl_malloc_internal.so.2401.0.0 $PREFIX/lib/libabsl_debugging_internal.so.2401.0.0 $PREFIX/lib/libabsl_demangle_internal.so.2401.0.0 $PREFIX/lib/libabsl_base.so.2401.0.0 -lpthread $PREFIX/lib/libabsl_raw_logging_internal.so.2401.0.0 $PREFIX/lib/libabsl_log_severity.so.2401.0.0 $PREFIX/lib/$PREFIX/x86_64-conda-linux-gnu/bin/ld: libhw_grpc_proto.a(helloworld.grpc.pb.cc.o): in function `grpc::CompletionQueue::~CompletionQueue()':
helloworld.grpc.pb.cc:(.text._ZN4grpc15CompletionQueueD2Ev[_ZN4grpc15CompletionQueueD5Ev]+0x4d): undefined reference to `absl::lts_20240116::Mutex::Dtor()'
$PREFIX/x86_64-conda-linux-gnu/bin/ld: libhw_grpc_proto.a(helloworld.grpc.pb.cc.o): in function `grpc::ClientReader<helloworld::HelloReply>::~ClientReader()':
helloworld.grpc.pb.cc:(.text._ZN4grpc12ClientReaderIN10helloworld10HelloReplyEED2Ev[_ZN4grpc12ClientReaderIN10helloworld10HelloReplyEED5Ev]+0x6c): undefined reference to `absl::lts_20240116::Mutex::Dtor()'
$PREFIX/x86_64-conda-linux-gnu/bin/ld: libhw_grpc_proto.a(helloworld.grpc.pb.cc.o): in function `non-virtual thunk to grpc::ClientReader<helloworld::HelloReply>::~ClientReader()':
helloworld.grpc.pb.cc:(.text._ZN4grpc12ClientReaderIN10helloworld10HelloReplyEED2Ev[_ZN4grpc12ClientReaderIN10helloworld10HelloReplyEED5Ev]+0x10c): undefined reference to `absl::lts_20240116::Mutex::Dtor()'
$PREFIX/x86_64-conda-linux-gnu/bin/ld: libhw_grpc_proto.a(helloworld.grpc.pb.cc.o): in function `non-virtual thunk to grpc::ClientReaderWriter<helloworld::HelloRequest, helloworld::HelloReply>::~ClientReaderWriter()':
helloworld.grpc.pb.cc:(.text._ZN4grpc18ClientReaderWriterIN10helloworld12HelloRequestENS1_10HelloReplyEED2Ev[_ZN4grpc18ClientReaderWriterIN10helloworld12HelloRequestENS1_10HelloReplyEED5Ev]+0x7c): undefined reference to `absl::lts_20240116::Mutex::Dtor()'
$PREFIX/x86_64-conda-linux-gnu/bin/ld: libhw_grpc_proto.a(helloworld.grpc.pb.cc.o): in function `grpc::ClientReaderWriter<helloworld::HelloRequest, helloworld::HelloReply>::~ClientReaderWriter()':
helloworld.grpc.pb.cc:(.text._ZN4grpc18ClientReaderWriterIN10helloworld12HelloRequestENS1_10HelloReplyEED2Ev[_ZN4grpc18ClientReaderWriterIN10helloworld12HelloRequestENS1_10HelloReplyEED5Ev]+0x12c): undefined reference to `absl::lts_20240116::Mutex::Dtor()'
$PREFIX/x86_64-conda-linux-gnu/bin/ld: libhw_grpc_proto.a(helloworld.grpc.pb.cc.o):helloworld.grpc.pb.cc:(.text._ZN4grpc18ClientReaderWriterIN10helloworld12HelloRequestENS1_10HelloReplyEED2Ev[_ZN4grpc18ClientReaderWriterIN10helloworld12HelloRequestENS1_10HelloReplyEED5Ev]+0x1dc): more undefined references to `absl::lts_20240116::Mutex::Dtor()' follow
collect2: error: ld returned 1 exit status
Anything else we should know about your project / environment?
The same build recipe & test procedure passed with the previous abseil version.