1.安装
下载地址 https://github.com/protocolbuffers/protobuf/releases (我下载的是all版本 tar.gz)
tar zvxf ******.tar.gz
cd protobuf-******
./configure –prefix=/usr/local/
sudo make #编译时间很长
sudo make check
sudo make install
2.测试是否可用
可参考https://blog.csdn.net/lcuwb/article/details/90705397 (如果编译报错,记得回来看下面的内容)
3.报错解决
[libprotobuf FATAL google/protobuf/generated_message_util.cc:812] CHECK failed: (scc->visit_status.load(std::memory_order_relaxed)) == (SCCInfoBase::kRunning):
terminate called after throwing an instance of 'google::protobuf::FatalException'
// 解决方法: 编译时加上 -lpthread
error while loading shared libraries: libprotobuf.so.******
// 解决方法:https://blog.csdn.net/weixin_37251044/article/details/79139906
// 参考上链接的 1和3步