`
cooler1217
  • 浏览: 364497 次
  • 性别: Icon_minigender_1
  • 来自: 长春
社区版块
存档分类
最新评论

thrift-0.9.0安装 zhuan

 
阅读更多
thrift-0.9.0安装

博客分类: scribe

http://wiki.apache.org/thrift/ThriftInstallation

Basic requirements
A relatively POSIX-compliant *NIX system
Cygwin or MinGW can be used on Windows
g++ 3.3.5+
boost 1.33.1+ (1.34.0 for building all tests)
Runtime libraries for lex and yacc might be needed for the compiler.

一、安装依赖
Java代码  收藏代码
yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel 


二、安装thrift
Java代码  收藏代码
wget http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz 
tar zxvf thrift-0.9.0 
cd thrift-0.9.0 

首先运行根目录下的 $ ./bootstrap.sh,用于生成configure脚本
如果下载的直接是一个tarball,则跳过此步骤,直接运行软件根目录下的configure脚本
Java代码  收藏代码
./bootstrap.sh 
./configure 
make 
make install 


验证
查看当前版本
Java代码  收藏代码
$ thrift -version 
Thrift version 0.9.0 

输出信息和安装的版本一致,说明thrift安装成功

Maven artifact
Xml代码  收藏代码
<dependency> 
  <groupId>org.apache.thrift</groupId> 
  <artifactId>libthrift</artifactId> 
  <version>0.9.0</version> 
</dependency> 



三、安装fb303
Facebook Bassline (included in thrift/contrib/fb303/)
        fb303 r697294 or later is required.
        (已经包含在Thrift中了,重新编译一下fb303就可以)
Java代码  收藏代码
cd ./contrib/fb303/ 
./bootstrap.sh  
./configure 
make 
make install 


安装完Thirft后,记得运行一下它提供的example,看是否安装成功。
验证:
Java代码  收藏代码
cd ./thrift-0.9.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,让它们通信。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics