Mac 安装thrift

首先要参考官方文档

https://thrift.apache.org/docs/install/

https://thrift.apache.org/docs/install/os_x

https://thrift.apache.org/docs/BuildingFromSource

主要的坑,升级bison, mac自带2.3 要升到2.5以上。

否则会报以下错误 

Bison version 2.5 or higher must be installed on the system!

1 brew upgrade bison

仍然报错,因为虽然升级了,但是系统仍然调用的老的bison,可以通过如下命令查看版本

bison -V

可以通过如下方式解决,参考

https://stackoverflow.com/questions/10778905/why-not-gnu-bison-upgrade-to-2-5-on-macosx-10-7-3

brew unlink bison
brew link bison --force

重新link 之后还不好使,还得加一下环境变量,这个得看使用的哪个bash,我用的是zshrc, 在.zshrc 文件中加入以下代码(就是配置环境变量),然后source 一下。版本更新成功。

export PATH="/usr/local/opt/bison/bin:$PATH"
source .zshrc
bison -V

 

下载安装boost,安装要较长的时间 

https://dl.bintray.com/boostorg/release/1.67.0/source/

安装 libevent

http://libevent.org/

 

处理上述完成之后。在下载的thrift 源码路径下运行以下命令

./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local

make

sudo make install

thrift --help

成功!!

如果要生成java的话。光有java和javac是不够的,还需要ant,安装,再配置上环境变量。source一下,就可以成功了。

 

 

 

 

 

 

 

 

posted on 2018-05-24 15:00  cococooder  阅读(2106)  评论(0)    收藏  举报