abseil/abseil-cpp

[Bug]: Problems with inline namespaces in 20240116

Closed this issue · 7 comments

Describe the issue

While building grpc with -DgRPC_ABSL_PROVIDER="package" in conda-forge against the newest abseil 20240116.0, all builds failed with problems due to namespaces, more precisely: the linkers not finding symbols. This worked without issue with the previous abseil 20230802.0

OSX and windows both failed to find absl::StrCat. That file had quite a lot of changes recently, but I don't see how that symbol could not be found anymore?

OSX:

FAILED: CMakeFiles/grpc.dir/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc.o 
$BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang++ -Dgrpc_EXPORTS -I$SRC_DIR/include -I$SRC_DIR -I$SRC_DIR/third_party/address_sorting/include -I$SRC_DIR/src/core/ext/upb-gen -I$SRC_DIR/src/core/ext/upbdefs-gen -I$SRC_DIR/third_party/upb -I$SRC_DIR/third_party/utf8_range -I$SRC_DIR/third_party/xxhash -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -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 -D_LIBCPP_DISABLE_AVAILABILITY  -O3 -DNDEBUG -std=gnu++17 -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -mmacosx-version-min=10.13 -fPIC -MD -MT CMakeFiles/grpc.dir/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc.o -MF CMakeFiles/grpc.dir/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc.o.d -o CMakeFiles/grpc.dir/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc.o -c $SRC_DIR/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc
$SRC_DIR/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc:59:15: error: no member named 'StrCat' in namespace 'absl'
        absl::StrCat("getsockname:", grpc_core::StrError(errno)));
        ~~~~~~^
1 error generated.

Windows:

FAILED: CMakeFiles/grpc.dir/src/core/lib/event_engine/windows/native_windows_dns_resolver.cc.obj
cl.exe  /nologo /TP -DABSL_CONSUME_DLL -DGPR_DLL_IMPORTS -DGRPC_DLL_EXPORTS -DUPB_DLL_IMPORTS -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WIN32_WINNT=0x600 -D_WINSOCK_DEPRECATED_NO_WARNINGS -I%SRC_DIR%\include -I%SRC_DIR% -I%SRC_DIR%\third_party\address_sorting\include -I%SRC_DIR%\src\core\ext\upb-gen -I%SRC_DIR%\src\core\ext\upbdefs-gen -I%SRC_DIR%\third_party\upb -I%SRC_DIR%\third_party\utf8_range -I%SRC_DIR%\third_party\xxhash -external:I%PREFIX%\Library\include -external:W0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc  /wd4065 /wd4506 /wd4200 /wd4291 /wd4244 /wd4267 /wd4987 /wd4774 /wd4819 /wd4996 /wd4619 /wd4503 /utf-8 /MD /O2 /Ob2 /DNDEBUG -std:c++17 /showIncludes /FoCMakeFiles\grpc.dir\src\core\lib\event_engine\windows\native_windows_dns_resolver.cc.obj /Fdgrpc.pdb /FS -c %SRC_DIR%\src\core\lib\event_engine\windows\native_windows_dns_resolver.cc
%SRC_DIR%\src\core\lib\event_engine\windows\native_windows_dns_resolver.cc(44): error C2039: 'StrCat': is not a member of 'absl'
%PREFIX%\Library\include\absl/hash/hash.h(87): note: see declaration of 'absl'

Linux passed compilation of the main libgrpc.so, but failed while compiling an example against it as a sanity check. No idea why the situation is opposite here.

[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/libabsl_spinlock_wait.so.2401.0.0 && :
$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()'
[...]
collect2: error: ld returned 1 exit status

Steps to reproduce the problem

Build https://github.com/grpc/grpc with -DgRPC_ABSL_PROVIDER="package" against abseil 20240116.0. It would also be possible to replay the recipe we have in conda-forge.

What version of Abseil are you using?

20240116

What operating system and version are you using?

linux/osx/win

What compiler and version are you using?

gcc 12, clang 16, vs 2019

What build system are you using?

cmake

Additional context

No response

It seems like gRPC was relying on transitive includes, and the include graph changed. See grpc/grpc@bc04417.

Ah thanks. I got confused by the fact that those includes were there already - I must have checked the head and not the tag. Will try backporting that commit...

Closing as this is a gRPC issue.

@derekmauro
I backported that commit but the failure regarding undefined reference to absl::lts_20240116::Mutex::Dtor() persists on linux. Did anything related to mutexes and its destructor change from 20230802.0?

There is a very relevant change (f3760b4) but I'm not sure what the problem is.

Oh yeah, this looks highly relevant, thanks a lot!

I think we're running into a mismatch of expectations vs. reality in:

#if defined(__APPLE__) || defined(ABSL_BUILD_DLL)
// When building a dll symbol export lists may reference the destructor
// and want it to be an exported symbol rather than an inline function.
// Some apple builds also do dynamic library build but don't say it explicitly.
Mutex::~Mutex() { Dtor(); }
#endif

I don't yet know how, but grpc needs that destructor also on linux.

Could you reopen this issue (I can rename it afterwards), or do you want me to open a new one?

I would open a new issue. Thanks.