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步