protobuf安装旧版本(适用于mac)

  之前我们项目采用的是protobuf 低版本的开发(开发当初是最新的),但后面电脑换了,再安装protobuf时,发现那个版本已经没法直接像最新版本那样安装了,后面弄了很久才把问题搞定,所以觉得有必要记录一下。

  没法安装部分版本的原因是,github上面下载的没有configure文件。此时需要先在该文件夹内运行./autogen.sh命令。

1、protobuf git项目下载地址:https://github.com/google/protobuf

git clone https://github.com/google/protobuf.git

 

2、进入刚下载的文件里面,运行./autogen.sh 命令,(但在运行autogen.sh之前需要先安装一些软件管理工具包:autoconf automake libtool curl make),此时本电脑用的是mac环境,采用brew安装(如果没有安装brew,在终端输入:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  

  进行安装)

cd protobuf
git fetch origin 3.3.x     #(这个是切换到想要到版本)
brew install  autoconf automake libtool curl make 
./autogen.sh

  

3、要构建并安装C ++协议缓冲区运行时和协议缓冲区编译器(protoc):  

./configure
make
make check
sudo make install

  

4、如果上述步骤都没问题都话,那就可以检查是否安装成功了,本人安装了并且安装成功

protoc --version

  

  最后出现你想要的版本。

 

参考链接:https://github.com/google/protobuf/blob/master/src/README.md

posted on 2018-03-12 21:23  我亦未曾饶岁月  阅读(2413)  评论(0编辑  收藏  举报

导航