티스토리 뷰

카테고리 없음

protobuf make error

4whomtbts 2019. 12. 23. 03:31

한국어는 아래에

I faced a below error, while I was building my C++ project with CMake(Which contains proto buffer as a dependency)

[libprotobuf FATAL google/protobuf/generated_message_util.cc:794] 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):

Technically, the error occurred by Makefiles.

Without further ado, You could fix this error simply by appending

a "-pthread" to your CMAKE_CXX_FLAGS that is written in your CMakeLists.txt likes a below example.

SET(CMAKE_CXX_FLAGS "-g -Wall -pthread -Werror -Wno-dev -std=c++11")

You don't need to care about other flags, "-pthread" plays important role to handle this issue.

 

proto buffer를 dependency로 사용하는 프로젝트를 빌드하면서 아래와 같은 build issue 가 발생했습니다,

[libprotobuf FATAL google/protobuf/generated_message_util.cc:794] 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):

엄밀히 말하면, Makefile 과정에서 난 오류겠지만.

어쨌든, CMake에 CMAKE_CXX_FLAGS 에 -pthread를 덧붙여주면 됩니다.

SET(CMAKE_CXX_FLAGS "-g -Wall -pthread -Werror -Wno-dev -std=c++

다른 플래그들은 신경쓸 필요 없고, -pthread가 핵심입니다.

 

댓글