Failed execution of C++ example program on Linux platform

1,022 views
Skip to first unread message

Thiago Palmieri

unread,
Sep 26, 2019, 9:19:42 AM9/26/19
to Protocol Buffers
Hello,

I have installed protocol buffers for c++ as recommended from the following page: https://github.com/protocolbuffers/protobuf/blob/master/src/README.md

The installation  went fine without any error. Current version is libprotoc 3.9.2.

I have then created a basic eclipse project including the example .proto from https://developers.google.com/protocol-buffers/docs/cpptutorial

The generation of .c/.h classes went well also.

I have then included the generated classes into the project and created a basic executable:

#include "test.pb.h"     // this is the generated header from .proto file
#include <fstream>

int main()
{
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  tutorial::Person person;
  person.set_name("John Doe");
  person.set_id(1234);
  person.set_email("jd...@example.com");
  std::ofstream output;
  output.open("myfile", std::ios::out | std::ios::binary);
  person.SerializeToOstream(&output);
  output.close();

  google::protobuf::ShutdownProtobufLibrary();
}

The project is compiling without any flaws, but when I try to execute it the following error returns:

[libprotobuf FATAL google/protobuf/generated_message_util.cc:818] CHECK failed: (scc->visit_status.load(std::memory_order_relaxed)) == (SCCInfoBase::kRunning): 
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  CHECK failed: (scc->visit_status.load(std::memory_order_relaxed)) == (SCCInfoBase::kRunning): 
Aborted (core dumped)

Can someone help me with that error?

Adam Cozzette

unread,
Sep 27, 2019, 5:40:04 PM9/27/19
to Thiago Palmieri, Protocol Buffers
I suspect your program is linking against a different version of libprotobuf. If you're using Linux then there's a good chance your system has its own copy of libprotobuf installed somewhere, so it's important to make sure you're consistently using the version you installed yourself and not mixing with the system-installed version.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/8d8b58a0-d9af-4f21-90a0-9083e0106f23%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages