当安装完protobuf时,输入protoc --version却报错了,报错内容是
error while loading shared libraries: libprotobuf.so.10: cannot open shared object file: No such file or directory
解决办法:
sudo ldconfig
ubuntu18.04最好使用protobuf3.0.0版本。
附:
https://github.com/protocolbuffers/protobuf/releases/tag/v3.5.1
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig
protoc --version
如果是3.0.0里面没有./configure则手动去gmock下载它,git clone https://github.com/paulsapps/gmock-1.7.0
改名为gmock,放到protobuf中即可
sudo rm -rf /usr/local/bin/protoc
sudo rm -rf /usr/include/google/protobuf #头文件
sudo rm -rf /usr/local/include/google/protobuf #头文件
sudo rm -rf /usr/lib/libproto* #库文件
sudo rm -rf /usr/local/lib/libproto* # 库文件