1. 官网下载v3.0.0.tar.gz;
地址:https://github.com/protocolbuffers/protobuf/archive/v3.0.0.tar.gz
2. 解压到指定目录;
tar -zxvf v3.0.0.tar.gz
note:tar -zxvf 为解压指令 例如: tar -zcvf v3.0.0.tar.gz ./ (解压到当前文件夹)
tar -zcvf 压缩指令 例如: tar -zcvf v3.0.0.tar.gz protobuf-3.0.0 (v3.0.0.tar.gz 是压缩文件名 swig-3.0.12 被压缩文件)
3、进入解压后的目录,依次运行指令:
./autogen.sh
4.如果出现Google Mock not present. Fetching gmock-1.7.0 from the web...
则修改autogen.sh
vim autogen.sh
在文中加入 加粗的字段
if test ! -e gmock -o && ! -e googlemock-release-1.7.0; then
echo "Google Mock not present. Fetching gmock-1.7.0 from the web..."
curl $curlopts -L -O https://github.com/google/googlemock/archive/release-1.7.0.zip
unzip -q release-1.7.0.zip
rm release-1.7.0.zip
mv googlemock-release-1.7.0 gmock
curl $curlopts -L -O https://github.com/google/googletest/archive/release-1.7.0.zip
unzip -q release-1.7.0.zip
rm release-1.7.0.zip
mv googletest-release-1.7.0 gmock/gtest
fi
然后再次执行autogen.sh
make && make install