天天看点

thrift-0.9.0安装

[url]http://wiki.apache.org/thrift/ThriftInstallation[/url]

[size=x-large]Basic requirements[/size]

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.

[size=x-large]一、安装依赖[/size]

[size=x-large]二、安装thrift[/size]

首先运行根目录下的 $ ./bootstrap.sh,用于生成configure脚本

如果下载的直接是一个tarball,则跳过此步骤,直接运行软件根目录下的configure脚本

./bootstrap.sh
./configure
make
make install
           

[size=large]验证[/size]

查看当前版本

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

Maven artifact

<dependency>
  <groupId>org.apache.thrift</groupId>
  <artifactId>libthrift</artifactId>
  <version>0.9.0</version>
</dependency>
           

[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 
./configure
make
make install
           

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

验证:

运行完之后会在当前目录看到一个gen-cpp目录,其中就是thrfit命令生成的代码。这时你cd到tutorial/cpp目录,运行make,生成相应的CppServer与CppClient程式。

此时你可以分别运行CppServer和CppClient,让它们通信。