Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing abseil linkage in libprotobuf.a #19375

Open
bojle opened this issue Nov 23, 2024 · 1 comment
Open

Missing abseil linkage in libprotobuf.a #19375

bojle opened this issue Nov 23, 2024 · 1 comment
Labels
untriaged auto added to all issues by default when created.

Comments

@bojle
Copy link

bojle commented Nov 23, 2024

What version of protobuf and what language are you using?
Version: v28.0 (checkout out from github)
Language: C++

What operating system (Linux, Windows, ...) and version?
Linux, Ubuntu (22.04)

What runtime / compiler are you using (e.g., python version or gcc version)
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

What did you do?

I am trying to create an executable that is linked statically with
libprotobuf-lite.a, compiled from source (not the one available in /usr/lib),
but face linker errors from abseil not being linked statically with
libprotobuf-lite.a

Steps to reproduce the behavior:

  1. Create a fresh directory, in it

  2. Download the onnx proto definition

wget 'https://raw.githubusercontent.com/onnx/onnx/refs/heads/main/onnx/onnx.proto3'
  1. Get protobuf v28.0 and build it
git clone https://github.com/protocolbuffers/protobuf/ --depth 1 --recursive -b v28.0
cd protobuf
mkdir build
cmake -B build
cmake --build build -j $(nproc --all)

this should create libprotbuf-lite.a in the build directory

  1. Use the protoc built in step 3, to create onnx.proto3.pb.{h,cc}
./protobuf/build/protoc --cpp_out=. onnx.proto3
  1. Create the driver
// a.cpp

#include "onnx.proto3.pb.h"
#include <fstream>
#include <iostream>

int main() {
        onnx::ModelProto mp;
        std::ifstream ifp("vgg.onnx");
        mp.ParseFromIstream(&ifp);
        std::cout << mp.ir_version() << '\n';
}
// Makefile

INC = -I protobuf/src/ -I protobuf/third_party/abseil-cpp/
ABSL = protobuf/build/third_party/abseil-cpp/absl/
LIBS = ${ABSL}/log/*.a ${ABSL}/base/*.a ${ABSL}/container/*.a ${ABSL}/crc/*.a ${ABSL}/debugging/*.a ${ABSL}/flags/*.a ${ABSL}/hash/*.a ${ABSL}/log/*.a ${ABSL}/numeric/*.a ${ABSL}/profiling/*.a ${ABSL}/random/*.a ${ABSL}/status/*.a ${ABSL}/strings/*.a ${ABSL}/synchronization/*.a ${ABSL}/time/*.a ${ABSL}/types/*.a


all: a.cpp onnx.proto3.pb.o
        g++ ${INC} a.cpp onnx.proto3.pb.o protobuf/build/libprotobuf-lite.a ${LIBS} -o a

onnx.proto3.pb.o: onnx.proto3.pb.cc
        g++ -c ${INC} $^ -o $@
  1. Build the driver
make

What did you expect to see

Expected the executable to be built completely without any linker errors.

What did you see instead?

Compilation terminates with these absl errors:

/usr/bin/ld: protobuf/build/libprotobuf-lite.a(generated_message_tctable_lite.cc.o): in function `google::protobuf::internal::TcParser::FastSS1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long)':
generated_message_tctable_lite.cc:(.text+0x148d4): undefined reference to `utf8_range::IsStructurallyValid(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: protobuf/build/libprotobuf-lite.a(generated_message_tctable_lite.cc.o): in function `google::protobuf::internal::TcParser::FastSS2(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long)':
generated_message_tctable_lite.cc:(.text+0x14c4c): undefined reference to `utf8_range::IsStructurallyValid(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: protobuf/build/libprotobuf-lite.a(generated_message_tctable_lite.cc.o): in function `google::protobuf::internal::TcParser::FastUS1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long)':
generated_message_tctable_lite.cc:(.text+0x14fc8): undefined reference to `utf8_range::IsStructurallyValid(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: protobuf/build/libprotobuf-lite.a(generated_message_tctable_lite.cc.o): in function `google::protobuf::internal::TcParser::FastUS2(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long)':
generated_message_tctable_lite.cc:(.text+0x15370): undefined reference to `utf8_range::IsStructurallyValid(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: protobuf/build/libprotobuf-lite.a(generated_message_tctable_lite.cc.o): in function `google::protobuf::internal::TcParser::MpVerifyUtf8(std::basic_string_view<char, std::char_traits<char> >, google::protobuf::internal::TcParseTableBase const*, google::protobuf::internal::TcParseTableBase::FieldEntry const&, unsigned short)':
generated_message_tctable_lite.cc:(.text+0x18b5c): undefined reference to `utf8_range::IsStructurallyValid(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: protobuf/build/libprotobuf-lite.a(generated_message_tctable_lite.cc.o):generated_message_tctable_lite.cc:(.text+0x18bd0): more undefined references to `utf8_range::IsStructurallyValid(std::basic_string_view<char, std::char_traits<char> >)' follow
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_stacktrace.a(stacktrace.cc.o): in function `GetKernelRtSigreturnAddress()::{lambda(int)#1}::operator()(int) const':
stacktrace.cc:(.text+0x3c): undefined reference to `absl::lts_20240116::debugging_internal::VDSOSupport::LookupSymbol(char const*, char const*, int, absl::lts_20240116::debugging_internal::ElfMemImage::SymbolInfo*) const'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_stacktrace.a(stacktrace.cc.o): in function `GetKernelRtSigreturnAddress()':
stacktrace.cc:(.text+0xb4): undefined reference to `absl::lts_20240116::debugging_internal::VDSOSupport::VDSOSupport()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_stacktrace.a(stacktrace.cc.o): in function `void** NextStackFrame<true, true>(void**, void const*, StackInfo const*)':
stacktrace.cc:(.text+0xfb0): undefined reference to `absl::lts_20240116::debugging_internal::AddressIsReadable(void const*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_stacktrace.a(stacktrace.cc.o): in function `void** NextStackFrame<false, true>(void**, void const*, StackInfo const*)':
stacktrace.cc:(.text+0x1300): undefined reference to `absl::lts_20240116::debugging_internal::AddressIsReadable(void const*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::InitializeSymbolizer(char const*)':
symbolize.cc:(.text+0xc): undefined reference to `absl::lts_20240116::debugging_internal::VDSOSupport::Init()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::(anonymous namespace)::InitSigSafeArena()':
symbolize.cc:(.text+0x1a8): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::NewArena(unsigned int)'
/usr/bin/ld: symbolize.cc:(.text+0x1ec): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::DeleteArena(absl::lts_20240116::base_internal::LowLevelAlloc::Arena*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::(anonymous namespace)::AddrMap::~AddrMap()':
symbolize.cc:(.text+0x25c): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Free(void*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::(anonymous namespace)::AddrMap::Add()':
symbolize.cc:(.text+0x37c): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::AllocWithArena(unsigned long, absl::lts_20240116::base_internal::LowLevelAlloc::Arena*)'
/usr/bin/ld: symbolize.cc:(.text+0x3d4): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Free(void*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::(anonymous namespace)::Symbolizer::CopyString(char const*)':
symbolize.cc:(.text+0x4f0): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::AllocWithArena(unsigned long, absl::lts_20240116::base_internal::LowLevelAlloc::Arena*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::AllocateSymbolizer()':
symbolize.cc:(.text+0x618): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::AllocWithArena(unsigned long, absl::lts_20240116::base_internal::LowLevelAlloc::Arena*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::FreeSymbolizer(absl::lts_20240116::debugging_internal::(anonymous namespace)::Symbolizer*)':
symbolize.cc:(.text+0x6a8): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Free(void*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::(anonymous namespace)::Symbolizer::~Symbolizer()':
symbolize.cc:(.text+0x820): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Free(void*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::(anonymous namespace)::Symbolizer::ClearAddrMap()':
symbolize.cc:(.text+0x274c): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Free(void*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::DemangleInplace(char*, unsigned long, char*, unsigned long)':
symbolize.cc:(.text+0x2a10): undefined reference to `absl::lts_20240116::debugging_internal::Demangle(char const*, char*, unsigned long)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::(anonymous namespace)::Symbolizer::InsertSymbolInCache(void const*, char const*)':
symbolize.cc:(.text+0x2db4): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Free(void*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::(anonymous namespace)::Symbolizer::GetUncachedSymbol(void const*)':
symbolize.cc:(.text+0x3624): undefined reference to `absl::lts_20240116::debugging_internal::VDSOSupport::VDSOSupport()'
/usr/bin/ld: symbolize.cc:(.text+0x364c): undefined reference to `absl::lts_20240116::debugging_internal::VDSOSupport::LookupSymbolByAddress(void const*, absl::lts_20240116::debugging_internal::ElfMemImage::SymbolInfo*) const'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::debugging_internal::RegisterFileMappingHint(void const*, void const*, unsigned long, char const*)':
symbolize.cc:(.text+0x3c50): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::AllocWithArena(unsigned long, absl::lts_20240116::base_internal::LowLevelAlloc::Arena*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//debugging/libabsl_symbolize.a(symbolize.cc.o): in function `absl::lts_20240116::base_internal::SpinLock::Unlock()':
symbolize.cc:(.text._ZN4absl12lts_2024011613base_internal8SpinLock6UnlockEv[_ZN4absl12lts_2024011613base_internal8SpinLock6UnlockEv]+0x98): undefined reference to `absl::lts_20240116::base_internal::SpinLock::SlowUnlock(unsigned int)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//hash/libabsl_hash.a(hash.cc.o): in function `absl::lts_20240116::hash_internal::MixingHashState::CombineLargeContiguousImpl32(unsigned long, unsigned char const*, unsigned long)':
hash.cc:(.text+0x30): undefined reference to `absl::lts_20240116::hash_internal::CityHash32(char const*, unsigned long)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//hash/libabsl_hash.a(hash.cc.o): in function `absl::lts_20240116::hash_internal::MixingHashState::CombineContiguousImpl(unsigned long, unsigned char const*, unsigned long, std::integral_constant<int, 4>)':
hash.cc:(.text._ZN4absl12lts_2024011613hash_internal15MixingHashState21CombineContiguousImplEmPKhmSt17integral_constantIiLi4EE[_ZN4absl12lts_2024011613hash_internal15MixingHashState21CombineContiguousImplEmPKhmSt17integral_constantIiLi4EE]+0x78): undefined reference to `absl::lts_20240116::hash_internal::CityHash32(char const*, unsigned long)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cord.a(cord.cc.o): in function `absl::lts_20240116::Cord::SetCrcCordState(absl::lts_20240116::crc_internal::CrcCordState)':
cord.cc:(.text+0x2a80): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::CrcCordState(absl::lts_20240116::crc_internal::CrcCordState&&)'
/usr/bin/ld: cord.cc:(.text+0x2a9c): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: cord.cc:(.text+0x2af0): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::CrcCordState(absl::lts_20240116::crc_internal::CrcCordState&&)'
/usr/bin/ld: cord.cc:(.text+0x2b0c): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: cord.cc:(.text+0x2b58): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::CrcCordState(absl::lts_20240116::crc_internal::CrcCordState&&)'
/usr/bin/ld: cord.cc:(.text+0x2b74): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: cord.cc:(.text+0x2ba0): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: cord.cc:(.text+0x2bb4): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: cord.cc:(.text+0x2bc8): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cord.a(cord.cc.o): in function `absl::lts_20240116::Cord::SetExpectedChecksum(unsigned int)':
cord.cc:(.text+0x2c3c): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::CrcCordState()'
/usr/bin/ld: cord.cc:(.text+0x2c94): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::CrcCordState(absl::lts_20240116::crc_internal::CrcCordState&&)'
/usr/bin/ld: cord.cc:(.text+0x2cac): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: cord.cc:(.text+0x2cb4): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: cord.cc:(.text+0x2ce0): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: cord.cc:(.text+0x2cf0): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cord.a(cord.cc.o): in function `absl::lts_20240116::Cord::ExpectedChecksum() const':
cord.cc:(.text+0x2e24): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::Checksum() const'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cord.a(cord.cc.o): in function `absl::lts_20240116::DumpNode(absl::lts_20240116::cord_internal::CordRep*, bool, std::ostream*, int)':
cord.cc:(.text+0x4fa0): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::Checksum() const'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cord.a(cord.cc.o): in function `absl::lts_20240116::cord_internal::CordRepCrc::~CordRepCrc()':
cord.cc:(.text._ZN4absl12lts_2024011613cord_internal10CordRepCrcD2Ev[_ZN4absl12lts_2024011613cord_internal10CordRepCrcD5Ev]+0x14): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::~CrcCordState()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cord_internal.a(cord_rep_crc.cc.o): in function `absl::lts_20240116::cord_internal::CordRepCrc::New(absl::lts_20240116::cord_internal::CordRep*, absl::lts_20240116::crc_internal::CrcCordState)':
cord_rep_crc.cc:(.text+0x7c): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::operator=(absl::lts_20240116::crc_internal::CrcCordState&&)'
/usr/bin/ld: cord_rep_crc.cc:(.text+0x11c): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::operator=(absl::lts_20240116::crc_internal::CrcCordState&&)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cord_internal.a(cord_rep_crc.cc.o): in function `absl::lts_20240116::cord_internal::CordRepCrc::CordRepCrc()':
cord_rep_crc.cc:(.text._ZN4absl12lts_2024011613cord_internal10CordRepCrcC2Ev[_ZN4absl12lts_2024011613cord_internal10CordRepCrcC5Ev]+0x1c): undefined reference to `absl::lts_20240116::crc_internal::CrcCordState::CrcCordState()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cordz_functions.a(cordz_functions.cc.o): in function `absl::lts_20240116::cord_internal::cordz_should_profile_slow()':
cordz_functions.cc:(.text+0xa4): undefined reference to `absl::lts_20240116::profiling_internal::ExponentialBiased::GetStride(long)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cordz_info.a(cordz_info.cc.o): in function `absl::lts_20240116::cord_internal::CordzInfo::Head(absl::lts_20240116::cord_internal::CordzSnapshot const&)':
cordz_info.cc:(.text+0x910): undefined reference to `absl::lts_20240116::cord_internal::CordzHandle::DiagnosticsHandleIsSafeToInspect(absl::lts_20240116::cord_internal::CordzHandle const*) const'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cordz_info.a(cordz_info.cc.o): in function `absl::lts_20240116::cord_internal::CordzInfo::Next(absl::lts_20240116::cord_internal::CordzSnapshot const&) const':
cordz_info.cc:(.text+0xa44): undefined reference to `absl::lts_20240116::cord_internal::CordzHandle::DiagnosticsHandleIsSafeToInspect(absl::lts_20240116::cord_internal::CordzHandle const*) const'
/usr/bin/ld: cordz_info.cc:(.text+0xa68): undefined reference to `absl::lts_20240116::cord_internal::CordzHandle::DiagnosticsHandleIsSafeToInspect(absl::lts_20240116::cord_internal::CordzHandle const*) const'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cordz_info.a(cordz_info.cc.o): in function `absl::lts_20240116::cord_internal::CordzInfo::CordzInfo(absl::lts_20240116::cord_internal::CordRep*, absl::lts_20240116::cord_internal::CordzInfo const*, absl::lts_20240116::cord_internal::CordzUpdateTracker::MethodIdentifier)':
cordz_info.cc:(.text+0xfb0): undefined reference to `absl::lts_20240116::cord_internal::CordzHandle::~CordzHandle()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cordz_info.a(cordz_info.cc.o): in function `absl::lts_20240116::cord_internal::CordzInfo::~CordzInfo()':
cordz_info.cc:(.text+0x1030): undefined reference to `absl::lts_20240116::cord_internal::CordzHandle::~CordzHandle()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cordz_info.a(cordz_info.cc.o): in function `absl::lts_20240116::cord_internal::CordzInfo::Untrack()':
cordz_info.cc:(.text+0x1384): undefined reference to `absl::lts_20240116::cord_internal::CordzHandle::SafeToDelete() const'
/usr/bin/ld: cordz_info.cc:(.text+0x1400): undefined reference to `absl::lts_20240116::cord_internal::CordzHandle::Delete(absl::lts_20240116::cord_internal::CordzHandle*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cordz_info.a(cordz_info.cc.o): in function `absl::lts_20240116::base_internal::SpinLock::Lock()':
cordz_info.cc:(.text._ZN4absl12lts_2024011613base_internal8SpinLock4LockEv[_ZN4absl12lts_2024011613base_internal8SpinLock4LockEv]+0x2c): undefined reference to `absl::lts_20240116::base_internal::SpinLock::SlowLock()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cordz_info.a(cordz_info.cc.o): in function `absl::lts_20240116::cord_internal::CordzHandle::CordzHandle()':
cordz_info.cc:(.text._ZN4absl12lts_2024011613cord_internal11CordzHandleC2Ev[_ZN4absl12lts_2024011613cord_internal11CordzHandleC5Ev]+0x14): undefined reference to `absl::lts_20240116::cord_internal::CordzHandle::CordzHandle(bool)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_cordz_info.a(cordz_info.cc.o):(.data.rel.ro._ZTIN4absl12lts_2024011613cord_internal9CordzInfoE[_ZTIN4absl12lts_2024011613cord_internal9CordzInfoE]+0x10): undefined reference to `typeinfo for absl::lts_20240116::cord_internal::CordzHandle'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//strings/libabsl_str_format_internal.a(float_conversion.cc.o): in function `absl::lts_20240116::str_format_internal::(anonymous namespace)::Decomposed<long double> absl::lts_20240116::str_format_internal::(anonymous namespace)::Decompose<long double>(long double)':
float_conversion.cc:(.text+0x3e88): undefined reference to `absl::lts_20240116::uint128::uint128(long double)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::EnsureSynchEvent(std::atomic<long>*, char const*, long, long)':
mutex.cc:(.text+0x758): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Free(void*)'
/usr/bin/ld: mutex.cc:(.text+0x850): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Alloc(unsigned long)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::UnrefSynchEvent(absl::lts_20240116::SynchEvent*)':
mutex.cc:(.text+0x968): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Free(void*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::LocksHeldAlloc()':
mutex.cc:(.text+0xd28): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Alloc(unsigned long)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::Mutex::InternalAttemptToUseMutexInFatalSignalHandler()':
mutex.cc:(.text+0xe64): undefined reference to `absl::lts_20240116::base_internal::CurrentThreadIdentityIfPresent()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::GetGraphIdLocked(absl::lts_20240116::Mutex*)':
mutex.cc:(.text+0x1f94): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Alloc(unsigned long)'
/usr/bin/ld: mutex.cc:(.text+0x1fb0): undefined reference to `absl::lts_20240116::synchronization_internal::GraphCycles::GraphCycles()'
/usr/bin/ld: mutex.cc:(.text+0x1fd0): undefined reference to `absl::lts_20240116::synchronization_internal::GraphCycles::GetId(void*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::(anonymous namespace)::ScopedDeadlockReportBuffers::ScopedDeadlockReportBuffers()':
mutex.cc:(.text+0x2890): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Alloc(unsigned long)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::(anonymous namespace)::ScopedDeadlockReportBuffers::~ScopedDeadlockReportBuffers()':
mutex.cc:(.text+0x28c0): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Free(void*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::DeadlockCheck(absl::lts_20240116::Mutex*)':
mutex.cc:(.text+0x29bc): undefined reference to `absl::lts_20240116::synchronization_internal::GraphCycles::UpdateStackTrace(absl::lts_20240116::synchronization_internal::GraphId, int, int (*)(void**, int))'
/usr/bin/ld: mutex.cc:(.text+0x29fc): undefined reference to `absl::lts_20240116::synchronization_internal::GraphCycles::Ptr(absl::lts_20240116::synchronization_internal::GraphId)'
/usr/bin/ld: mutex.cc:(.text+0x2a24): undefined reference to `absl::lts_20240116::synchronization_internal::GraphCycles::InsertEdge(absl::lts_20240116::synchronization_internal::GraphId, absl::lts_20240116::synchronization_internal::GraphId)'
/usr/bin/ld: mutex.cc:(.text+0x2afc): undefined reference to `absl::lts_20240116::synchronization_internal::GraphCycles::Ptr(absl::lts_20240116::synchronization_internal::GraphId)'
/usr/bin/ld: mutex.cc:(.text+0x2c04): undefined reference to `absl::lts_20240116::synchronization_internal::GraphCycles::FindPath(absl::lts_20240116::synchronization_internal::GraphId, absl::lts_20240116::synchronization_internal::GraphId, int, absl::lts_20240116::synchronization_internal::GraphId*) const'
/usr/bin/ld: mutex.cc:(.text+0x2c40): undefined reference to `absl::lts_20240116::synchronization_internal::GraphCycles::Ptr(absl::lts_20240116::synchronization_internal::GraphId)'
/usr/bin/ld: mutex.cc:(.text+0x2c6c): undefined reference to `absl::lts_20240116::synchronization_internal::GraphCycles::GetStackTrace(absl::lts_20240116::synchronization_internal::GraphId, void***)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::Mutex::ForgetDeadlockInfo()':
mutex.cc:(.text+0x2f30): undefined reference to `absl::lts_20240116::synchronization_internal::GraphCycles::RemoveNode(void*)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::synchronization_internal::GetOrCreateCurrentThreadIdentity()':
mutex.cc:(.text._ZN4absl12lts_2024011624synchronization_internal32GetOrCreateCurrentThreadIdentityEv[_ZN4absl12lts_2024011624synchronization_internal32GetOrCreateCurrentThreadIdentityEv]+0x8): undefined reference to `absl::lts_20240116::base_internal::CurrentThreadIdentityIfPresent()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::base_internal::CycleClock::LoadCycleClockSource()':
mutex.cc:(.text._ZN4absl12lts_2024011613base_internal10CycleClock20LoadCycleClockSourceEv[_ZN4absl12lts_2024011613base_internal10CycleClock20LoadCycleClockSourceEv]+0xc): undefined reference to `absl::lts_20240116::base_internal::CycleClock::cycle_clock_source_'
/usr/bin/ld: mutex.cc:(.text._ZN4absl12lts_2024011613base_internal10CycleClock20LoadCycleClockSourceEv[_ZN4absl12lts_2024011613base_internal10CycleClock20LoadCycleClockSourceEv]+0x10): undefined reference to `absl::lts_20240116::base_internal::CycleClock::cycle_clock_source_'
/usr/bin/ld: mutex.cc:(.text._ZN4absl12lts_2024011613base_internal10CycleClock20LoadCycleClockSourceEv[_ZN4absl12lts_2024011613base_internal10CycleClock20LoadCycleClockSourceEv]+0x38): undefined reference to `absl::lts_20240116::base_internal::CycleClock::cycle_clock_source_'
/usr/bin/ld: mutex.cc:(.text._ZN4absl12lts_2024011613base_internal10CycleClock20LoadCycleClockSourceEv[_ZN4absl12lts_2024011613base_internal10CycleClock20LoadCycleClockSourceEv]+0x3c): undefined reference to `absl::lts_20240116::base_internal::CycleClock::cycle_clock_source_'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::base_internal::CycleClock::Now()':
mutex.cc:(.text._ZN4absl12lts_2024011613base_internal10CycleClock3NowEv[_ZN4absl12lts_2024011613base_internal10CycleClock3NowEv]+0x1c): undefined reference to `absl::lts_20240116::base_internal::UnscaledCycleClock::Now()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(mutex.cc.o): in function `absl::lts_20240116::base_internal::CycleClock::Frequency()':
mutex.cc:(.text._ZN4absl12lts_2024011613base_internal10CycleClock9FrequencyEv[_ZN4absl12lts_2024011613base_internal10CycleClock9FrequencyEv]+0x8): undefined reference to `absl::lts_20240116::base_internal::UnscaledCycleClock::Frequency()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(create_thread_identity.cc.o): in function `absl::lts_20240116::synchronization_internal::ReclaimThreadIdentity(void*)':
create_thread_identity.cc:(.text+0x40): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Free(void*)'
/usr/bin/ld: create_thread_identity.cc:(.text+0x44): undefined reference to `absl::lts_20240116::base_internal::ClearCurrentThreadIdentity()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(create_thread_identity.cc.o): in function `absl::lts_20240116::synchronization_internal::NewThreadIdentity()':
create_thread_identity.cc:(.text+0x32c): undefined reference to `absl::lts_20240116::base_internal::LowLevelAlloc::Alloc(unsigned long)'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(create_thread_identity.cc.o): in function `absl::lts_20240116::synchronization_internal::CreateThreadIdentity()':
create_thread_identity.cc:(.text+0x3a4): undefined reference to `absl::lts_20240116::base_internal::SetCurrentThreadIdentity(absl::lts_20240116::base_internal::ThreadIdentity*, void (*)(void*))'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(futex_waiter.cc.o): in function `absl::lts_20240116::synchronization_internal::FutexWaiter::WaitUntil(std::atomic<int>*, int, absl::lts_20240116::synchronization_internal::KernelTimeout)':
futex_waiter.cc:(.text+0x98): undefined reference to `absl::lts_20240116::synchronization_internal::KernelTimeout::MakeRelativeTimespec() const'
/usr/bin/ld: futex_waiter.cc:(.text+0xbc): undefined reference to `absl::lts_20240116::synchronization_internal::KernelTimeout::MakeAbsTimespec() const'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//synchronization/libabsl_synchronization.a(waiter_base.cc.o): in function `absl::lts_20240116::synchronization_internal::WaiterBase::MaybeBecomeIdle()':
waiter_base.cc:(.text+0x8): undefined reference to `absl::lts_20240116::base_internal::CurrentThreadIdentityIfPresent()'
/usr/bin/ld: protobuf/build/third_party/abseil-cpp/absl//time/libabsl_time.a(duration.cc.o): in function `absl::lts_20240116::(anonymous namespace)::SafeMultiply<absl::lts_20240116::uint128>::operator()(absl::lts_20240116::uint128, absl::lts_20240116::uint128) const':
duration.cc:(.text+0x4750): undefined reference to `absl::lts_20240116::kuint128max'
/usr/bin/ld: duration.cc:(.text+0x4754): undefined reference to `absl::lts_20240116::kuint128max'
/usr/bin/ld: duration.cc:(.text+0x4780): undefined reference to `absl::lts_20240116::kuint128max'
/usr/bin/ld: duration.cc:(.text+0x4784): undefined reference to `absl::lts_20240116::kuint128max'

Anything else we should know about your project / environment

Initially i was not linking absl .a libs explicitly assuming them to be fully linked in the libprotobuf-lite.a. Upon checking
out all the issues similar to this, I started linking absl. The linker error still persist even after linking absl libs fully.

The system is a very barebone linux image with no other absl/protobuf. Here's ldd for protoc,

$ ldd protobuf/build/protoc
	linux-vdso.so.1 (0x0000007f9413a000)
	libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000007f92fe0000)
	libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007f92f40000)
	libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000007f92f10000)
	libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f92d60000)
	/lib/ld-linux-aarch64.so.1 (0x0000007f94101000)
@bojle bojle added the untriaged auto added to all issues by default when created. label Nov 23, 2024
@bojle
Copy link
Author

bojle commented Nov 23, 2024

@mkruskal-google could you look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged auto added to all issues by default when created.
Projects
None yet
Development

No branches or pull requests

1 participant