C++ 是否可以在没有pthread的情况下构建protobuf?

C++ 是否可以在没有pthread的情况下构建protobuf?,c++,pthreads,protocol-buffers,C++,Pthreads,Protocol Buffers,在没有pthread的实时操作系统上,需要使用协议缓冲区。我能够以这种方式静态链接protobuf g++ -g -Wall example.pb.cc example.cc -o example -static -lprotobuf -lpthread 但是如果没有pthread,我会得到链接错误。是否可以将protobuf配置为在没有pthread的情况下工作?不太可能。见未解决的问题 有人修补了一个较旧的protobuf版本,使其不依赖于pthreads,请参阅-如果您确实需要它,您可以

在没有pthread的实时操作系统上,需要使用协议缓冲区。我能够以这种方式静态链接protobuf

g++ -g -Wall example.pb.cc example.cc -o example -static -lprotobuf -lpthread
但是如果没有pthread,我会得到链接错误。是否可以将protobuf配置为在没有pthread的情况下工作?

不太可能。见未解决的问题

有人修补了一个较旧的protobuf版本,使其不依赖于pthreads,请参阅-如果您确实需要它,您可以查看它,还可以查看转发端口

还要注意,在使用protobuf时,您应该使用pkg_config来获取正确的编译器和链接器标志,例如

pkg-config --cflags protobuf         # compiler flags
pkg-config --libs protobuf           # linker flags

奇怪的文档是否指明了pthread的用途?否。文档中没有说明pthread。如果没有pthread,我会看到一大堆这样的错误:>
/home/ghost/protobuf-2.4.1/src//google/protobuf/stubs/once。h:115:对“pthread_once”的未定义引用/
注意,有些错误,如protobuf-c和nanopb,在没有pthread的情况下也可以工作。