您的位置:首页 > 其它

thrift安装手记

2010-05-07 14:51 274 查看
由于项目需要集成多语言开发的东西,我们选择了使用thrift,它是facebook的核心框架之一,所以花了几天时间来研究安装,折腾的精疲力尽,终于搞定,安装步骤如下:

install jdk for linux(如果需要集成java,可以不装)

1、去官方网站下载安装包,如果是64位系统,记得选择linux x64,现在是1.6版,

java1.5下载:http://java.sun.com/products/archive/j2se/5.0_22/index.html,安装同1.6

2、下载 xxx.bin的版本,比如:jdk-6u20-linux-x64.bin

3、修改运行权限,chmod a+x jdk-6u20-linux-x64.bin

4、运行jdk-6u20-linux-x64.bin,前面是授权声明,直接按空格跳过

5、在/etc/profile配置java_home,jre_home,classpath,e.g:

export JAVA_HOME=/usr/local/java/jdk1.5.0_22

export TOMCAT_HOME=/usr/local/apache-tomcat-5.5.29

export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

install ant(如果需要集成java,可以不装)

1、下载最新版的ant

2、tar xzvf apache-ant-1.8.0-bin.tar.gz

3、vim /etc/profile,添加export ANT_HOME=/usr/java/apache-ant-1.8.0,在PATH里添加 $ANT_HOME/bin

4、保存退出,执行 source /etc/profile

install ivy

1、下载apache ivy

2、tar xzvf apache-ivy-2.1.0-bin.tar.gz

3、cp ivy-2.1.0.jar to ANT_HOME/lib

4、goto apache-ivy-2.1.0/src/example/hello-ivy, and run ant

install thrift

安装过程参见http://wiki.apache.org/thrift/ThriftInstallation,但可能不会成功,需要按以下步骤:

1、安装需求

1) g++ 3.3.5+,一般系统缺省就可以

# boost 1.33.1+ (1.34.0 for building all tests),

需要使用yum search boost来查询,执行 yum install boost.x86_64来安装,如果是32位系统,改为yum install boost.i386

2) Runtime libraries for lex and yacc might be needed for the compiler. (flex库),

需要使用yum search flex来查询,执行 yum install flex.x86_64 来安装

2、编译需求

1) GNU build tools: autoconf 2.59+ (2.60+ recommended), automake 1.9+, libtool 1.5.24+

需要卸载autoconf,执行 yum remove autoconf,它会一起卸载automake,libtool 等库,

去http://www.gnu.org/software/autoconf/下载最新的安装文件,安装过程:./configure,make,make install

去http://www.gnu.org/software/automake/下载最新的安装文件,安装过程:./configure,make,make install

安装缺省安装在/usr/local/bin/下,因此需要配置环境变量

vi /etc/profile, 在path里添加/usr/local/bin/

执行source /etc/profile,激活配置

2)pkg-config autoconf macros (pkg.m4) (Use MacPorts for Mac OS X)

3) lex and yacc (developed primarily with flex and bison)

3、下载http://incubator.apache.org/thrift/download/

4、解压缩

5、./bootstrap.sh,哈哈,运气好的话,可以通过,运气不好,会报警告或错误,安装不成功,

解决方法参见http://mail-archives.apache.org/mod_mbox/incubator-thrift-user/200907.mbox/%3C4A673E6F.5020205@facebook.com%3E。

它提供两个方案:upgrade your autoconf to 2.61 or download an

instant release from http://instant.thrift-rpc.org/ and skip bootstrap.sh

第一个方案我没有搞定,于是下载instant版,http://gitweb.thrift-rpc.org/?p=thrift.git;spfx=thrift-instant-r940936;a=snapshot;h=147123e29fb3c6fd4fbbad601c131b0a08d1c8b7;sf=tgz

6、解压

7、./configure

8、./configure CXXFLAGS='-g -O2'

9、make

10、make install

哈哈,成功了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: