protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.68k stars 15.5k forks source link

Unable to link absl log internal #14500

Closed dicetrash closed 1 year ago

dicetrash commented 1 year ago

While attempting to compile a project with protobuf got """ undefined reference to symbol '_ZN4absl12lts_2023080212log_internal17MakeCheckOpStringIllEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEET_T0_PKc' /usr/bin/ld: /usr/lib/libabsl_log_internal_check_op.so.2308.0.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status "" it looks like some internal implementation detail of abseil that isn't exposed cannot be linked.

What version of protobuf and what language are you using? Using 24.3-1 Language: C++ Abseil-cpp arch 20230802.1-1

What operating system (Linux, Windows, ...) and version? Linux arch with protobuf package https://archlinux.org/packages/extra/x86_64/protobuf/

What runtime / compiler are you using (e.g., python version or gcc version) cmake 3.27.7 -> make -> gcc 13.2.1

What did you do? Steps to reproduce the behavior:

  1. Compile protobufs for open source project https://github.com/opencardev/aasdk
  2. Attempt to compile opencardev/openauto What did you expect to see successful completion of linking at the end

What did you see instead? linker error about DSO missing for absl out from usage of protobuf

Anything else we should know about your project / environment attempted all three in cmake file but no change in output. find_package(Protobuf REQUIRED) find_package(Protobuf REQUIRED CONFIG) find_package(absl REQUIRED)

Worked in earlier versions of protobuf, this is a regression since May (time it worked)

dicetrash commented 1 year ago

Was able to pass through DSO missing by adding CMakeFlags

set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--copy-dt-needed-entries") set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--copy-dt-needed-entries") set(CMAKE_STATIC_LINKER_FLAGS "-Wl,--copy-dt-needed-entries") not exactly sure which one was the right one