thrift-0.5.0安装

yum install python python-devel

[size=X-large]一、安装libevent[/size]
[url]http://www.monkey.org/~provos/libevent/[/url]
解压缩安装

wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar zxvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make
make install



[size=X-large]二、安装boost[/size]
[url]http://www.boost.org[/url]
(版本>=1.36) boost_1_45_0.tar.bz2
解压

wget http://jaist.dl.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.gz
tar zxvf boost_1_55_0.tar.gz
cd boost_1_55_0
./bootstrap.sh
./bjam -s HAVE_ICU=1 --prefix=/usr/local/boost --includedir=/usr/local/boost/include --libdir=/usr/local/boost/lib
./bjam install --prefix=/usr/local/boost


添加环境变量
export BOOST_ROOT=/usr/local/boost
export LD_LIBRARY_PATH=/usr/local/boost/lib:/usr/local/lib/:/usr/lib/


[size=X-large]三、安装thrift[/size]

[size=large]1.安装php环境[/size]
1)必须先安装 libxml2 ,然后在安装 php,
下载:ftp://xmlsoft.org/libxml2/ ,下载libxml2-2.7.8.tar.gz
tar -xvf libxml2-2.7.8.tar.gz
./configure
make
make install


2)下载 php: http://cn.php.net/downloads.php ,下载php-5.3.6.tar.gz
tar -vxf  php-5.3.6.tar.gz
./configure --prefix=/usr/local/php5 --with-php-config=/usr/local/php5/bin/php-config
make
make install

(因为在 scribe 的一些版本中用到 php-config ,所以这里面要用 —with-php-config ,但是在我的安装过程没有用到,所以这个可以忽略)


[size=large]2.安装thrift[/size]
[url]http://incubator.apache.org/thrift/[/url]
(版本>=0.5.0)
1)先安装thrift,
解压并进入thrift目录
./configure --prefix=/usr/local/thrift --with-boost=/usr/local/boost --with-php-config=/usr/local/php5/bin/php-config
make
make install


验证

$ thrift -version
Thrift version 0.5.0


[size=X-large]四、安装fb303[/size]
如果不需要,可以省略该步骤
Facebook Bassline (included in thrift/contrib/fb303/)
fb303 r697294 or later is required.
(已经包含在Thrift中了,重新编译一下fb303就可以)
cd ./contrib/fb303/
./bootstrap.sh --with-boost=/usr/local/boost
./configure --with-boost=/usr/local/boost --with-thriftpath=/usr/local/thrift
make
make install


安装完Thirft后,记得运行一下它提供的example,看是否安装成功。
验证:

cd ./thrift-0.5.0/tutorial
thrift -r -gen cpp tutorial.thrift // -r对其中include的文件也生成服务代码 -gen是生成服务代码的语言

cd cpp
make

运行完之后会在当前目录看到一个gen-cpp目录,其中就是thrfit命令生成的代码。这时你cd到tutorial/cpp目录,运行make,生成相应的CppServer与CppClient程式。
此时你可以分别运行CppServer和CppClient,让它们通信。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值