Иван
Иван

Reputation: 434

Is it possible to build protobuf without pthread?

There is a need to use Protocol Buffers on the real-time OS where there is no pthread. I am able to link protobuf statically this way

g++ -g -Wall example.pb.cc example.cc -o example -static -lprotobuf -lpthread

However without pthread I get link errors. Is it possible to configure protobuf to work without pthread?

Upvotes: 8

Views: 1884

Answers (1)

nos
nos

Reputation: 229058

Not really. See this unresolved issue.

Someone has patched an older protobuf version to not depend on pthreads, see here - which you might take a look at if you really need it, and possibly forward port.

Also note that you're supposed to use pkg_config to get the proper compiler and linker flags when using protobuf, e.g.

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

Upvotes: 7

Related Questions