Open dpservis opened 2 weeks ago
@mkruskal-google Can you take a look at if this needs a patch?
Can you provide the following information:
It looks like you're doing some kind of mix of static and dynamic linking, which is causing the conflicts. It's hard to tell with the information provided though.
I'm able to build just fine using the cmake settings you showed through VS 2022. The thing I find strange is that the error you showed has references to abseil_dll.dll
, which should not be built at all with those settings. You don't set BUILD_SHARED_LIBS
or protobuf_BUILD_SHARED_LIBS
, so everything should be statically linked. It could be leaking in through an earlier build with different settings or through a system installation of Abseil.
Without more complete logs there's not enough information here. I'm just asking for the full output (ideally with --verbose) that you copied that error snippet from.
I seem to have encountered the same problem as him. I compiled it in the main branch without modifying any options. I used version 7.3.0 of mingw32 for g++and gcc compilation, as well as version 3.26.3 of cmake, but encountered the following issues.
[ 57%] Building CXX object CMakeFiles/protoc.dir/src/google/protobuf/compiler/main.cc.obj
[ 57%] Linking CXX executable protoc.exe
libprotoc.a(names.cc.obj):names.cc:(.text+0x1419): undefined reference to std::allocator<absl::lts_20240116::string_view>::allocator()' libprotoc.a(names.cc.obj):names.cc:(.text+0x1be7): undefined reference to
std::allocatorstd::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::allocator()' libprotoc.a(rust_keywords.cc.obj):rust_keywords.cc:(.text+0x834): undefined reference to
std::allocator<std::__cxx11::basic_string<char, std::char_traits
That looks like a completely different problem, maybe file a separate issue?
What version of protobuf and what language are you using? Version: 27.2 Language: C++
What operating system (Linux, Windows, ...) and version? Windows 11 What runtime / compiler are you using (e.g., python version or gcc version) VS2022 v143 What did you do? Steps to reproduce the behavior:
Set cmake options
Build ALL_BUILD
What did you expect to see Build What did you see instead? 1>absl_base.lib(thread_identity.obj) : error LNK2005: "void cdecl absl::lts_20240116::base_internal::SetCurrentThreadIdentity(struct absl::lts_20240116::base_internal::ThreadIdentity *,void (cdecl)(void ))" (?SetCurrentThreadIdentity@base_internal@lts_20240116@absl@@YAXPEAUThreadIdentity@123@P6AXPEAX@Z@Z) already defined in abseil_dll.lib(abseil_dll.dll) 1>absl_base.lib(thread_identity.obj) : error LNK2005: "void __cdecl absl::lts_20240116::base_internal::ClearCurrentThreadIdentity(void)" (?ClearCurrentThreadIdentity@base_internal@lts_20240116@absl@@YAXXZ) already defined in abseil_dll.lib(abseil_dll.dll) Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment