thrift安装
thrift的安装方法在thrift的官网上已经有比较详细的安装流程,我在参照官方说明安装的时候遇到一些错误,特做个笔记记录一下方便以后查询。我的系统是
安装流程
- Update the System
sudo yum -y update
- Install the Platform Development Tools
sudo yum -y groupinstall "Development Tools"
-
Upgrade autoconf/automake/bison
-
Upgrade autoconf
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz tar xvf autoconf-2.69.tar.gz cd autoconf-2.69 ./configure --prefix=/usr make sudo make install cd ..
Upgrade automake
wget http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz tar xvf automake-1.14.tar.gz cd automake-1.14 ./configure --prefix=/usr make sudo make install cd ..
- Upgrade bison
wget http://ftp.gnu.org/gnu/bison/bison-2.5.1.tar.gz tar xvf bison-2.5.1.tar.gz cd bison-2.5.1 ./configure --prefix=/usr make sudo make install cd ..
-
install bzip
sudo yum whatprovides */bzlib.h
yum install bzip2-devel-1.0.5-7.el6_0.x86_64
-
Add Optional C++ Language Library Dependencies
Install C++ Lib Dependencies
sudo yum -y install libevent-devel zlib-devel openssl-devel
-
install libevent2
wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz tar xvf libevent-2.0.22-stable.tar.gz cd libevent-2.0.22-stable ./configure --prefix=/usr/local make make install cd ..
-
Upgrade Boost >= 1.53
wget http://sourceforge.net/projects/boost/files/boost/1.53.0/boost_1_53_0.tar.gz tar xvf boost_1_53_0.tar.gz cd boost_1_53_0 ./bootstrap.sh sudo ./b2 install
Build and Install the Apache Thrift IDL Compiler
git clone https://git-wip-us.apache.org/repos/asf/thrift.git
cd thrift
./bootstrap.sh
./configure ***--with-lua=no --with-libevent=/usr/local --with-boost-libdir=/usr/local/lib***
make
sudo make install
备注
在我安装的过程中,按照官网的安装说明并没有一次安装成功。主要遇到一下问题
- 缺少一些必备的基本依赖库,比如bzip、libevent2库,特别是libevent2库是Thrift支持并发的依赖库
- 默认配置会出错,在安装时如果不指定libevent的安装位置,使用默认配置会导致无法找到libevent库。为了避免少走弯路,最好是直接指定libevent库的安装位置
- thrift版本问题,我安装时最新的稳定版是0.9.3,checkout到0.9.3按照博客中的方法能安装成功,但是直接使用master分支的代码安装无法编译通过,具体的原因还抽出时间查找。后续再研究研究。