1. git clone source code
git clone -b v3.0.0 https://github.com/protocolbuffers/protobuf.git
2. add third party
cd protobuf && git submodule update --init --recursive
3. add gmock
git clone https://github.com/paulsapps/gmock-1.7.0
mv gmock-1.7.0 gmock #手动修改文件夹名的跳过此步骤
4. edit autogen.sh
vim autogen.bash
#comment below codes
# Check that gmock is present. Usually it is already there since the
# directory is set up as an SVN external.
#if test ! -e gmock; then
# echo "Google Mock not present. Fetching gmock-1.7.0 from the web..."
# curl $curlopts -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip
# unzip -q gmock-1.7.0.zip
# rm gmock-1.7.0.zip
# mv gmock-1.7.0 gmock
#fi
5. make and install
./autogen.sh
./configure CFLAGS="-fPIC" CXXFLAGS="-fPIC"
make -j16
sudo make install
sudo ldconfig
6. clarify
protoc --version