Mac安装Thrift

1、Install Boost

Download the boost library from http://www.boost.org/ untar compile with

./bootstrap.sh sudo ./b2 threading=multi address-model=64 variant=release stage install

2、Install libevent

Download libevent from http://libevent.org/, untar and compile with

./configure --prefix=/usr/local make sudo make install

 

3、Build Apache Thrift

Download the latest version of Apache Thrift, untar and compile with

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

 

4、Build thrift via make

make

 

5、Install thrift

sudo make install

 

安装过程出现的错误及解决办法:

1、configure命令执行过程出现的错误:

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

解决办法:

  • 安装bison: brew install bison
  • 查看path变量,获取顺序中第一个路径: echo $PATH(第一个路径为是/usr/local/bin),将bison复制到该路径下:sudo cp /usr/local/Cellar/bison/3.0.4/bin/bison /usr/local/bin/

原因:

mac本机自带了低版本bison,在运行configure命令时找到了该低版本bison,因此报错。

 

2、make命令执行过程中出现的错误:

src/thrift/transport/TSSLSocket.cpp:43:10: fatal error: 'openssl/opensslv.h' file not found 

解决办法:

  • 安装openssl: brew install openssl

brew link openssl --force

  • 重新执行configure命令,并添加参数:

./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local LDFLAGS='-L/usr/local/opt/openssl/lib' CPPFLAGS='-I/usr/local/opt/openssl/include'

  • 然后再make

 

 

你可能感兴趣的:(安装)