when using protobufs in C++ facing runtime crash in ShortDebugString and DebugString

13 views
Skip to first unread message

Sumit Bhoir

unread,
Aug 29, 2025, 4:27:41 AM (8 days ago)  Aug 29
to Protocol Buffers
Hi,
I have created static lib proto_gen.a from all proto files that im using in my code base. im linking it to libcomm.so which uses 2 proto files and out of which 1 imports general.proto from other folder .Here i'm not explicitly using anything from general.proto im only using comm.proto files only. libcomm.so getting build successfully so im linking it with application and from application i try to print message from general.proto using ShortDebugString and DebugString then below crash occurs. But when i remove import of general.proto from comm.proto and link comm.so to application then i print ShortDebugString of general.proto message successfully without issue. Help me understand why it is happening ? Provide solution if u have faced such scenario.

Using CMake for build.

Example : comm.proto
syntax = "proto3";

import "general/general.proto";

message MyMessage {}

Output : After running application

WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
F0000 00:00:1756447204.077746 3718630 generated_message_reflection.cc:3620] Check failed: file != nullptr
*** Check failure stack trace: ***
@0x71283668effb absl::lts_20240116::log_internal::LogMessage:: PrepareToDie
@0x71283668f06b absl::1ts_20240116::log_internal::LogMessage: SendToLog()
@0x71283668eb04 absl::1ts_20240116::log_internal::LogMessage: Flush()
@0x71283668f33c absl::1ts_20240116::log_internal::LogMessage Fatal::~LogMessage Fatal()
@0x459f2f google::protobuf:: (anonymous namespace) :: AssignDescriptorsImpl()
@0x45alde google::protobuf::internal::AssignDescriptorsOnce InnerCall()
@0x503bb3 google::protobuf::Message::GetMetadataImpl() :: (lambda () #1}::operator() ()
@0x5071ae absl::1ts_20240116: :base_internal::Callable::Invoke<>()
@0x506514 absl::1ts_20240116: :base_internal::invoke<>()
@0x504ba8 absl::1ts_20240116::base_internal::CallOnce Impl<>()
@0x504ef7 absl::1ts_20240116::call_once<>()
@0x503c21 google::protobuf::Message::GetMetadataImpl()
@0x503b95 google::protobuf::Message::GetMetadata()
@0x46241c google::protobuf::Message::GetReflection ()
@0x52990e google::protobuf:: Text Format:: Printer::Print ()
@0x5291d6 google::protobuf::Text Format:: Printer::Print ()
@0x528fel google::protobuf:: Text Format:: Printer::PrintToString()
@0x5255ce google::protobuf::Message:: Short DebugString [abi:cxx11] ()
@0x4349ba main
@0x7f2833249ca3 _libc_start_main
Aborted

Thanks and Regards,
Sumit 

Reply all
Reply to author
Forward
0 new messages