代码改变世界

thrift安装脚本

2012-05-12 13:07  zhenjing  阅读(1868)  评论(0编辑  收藏  举报
#! /bin/bash

# install libtool
tar xzvf libevent-1.4.13-stable.tar.gz

cd libevent-1.4.13-stable/

./configure

make

make install

cd ..

# install boost
tar xzvf boost_1_48_0.tar.gz

cd boost_1_48_0/

./bootstrap.sh

./b2 install

cd ..

# install openssl

tar xzvf openssl-1.0.1.tar.gz

cd openssl-1.0.1

./config --prefix=/usr/local shared threads   # must generate so lib

./make

make install

cd ..


# install thrift

tar xvzf thrift-0.8.0.tar.gz

cd thrift-0.8.0

./configure --with-java=no --with-python=no --with-perl=no   # not generate java tool

# make config.h is right
sed -i -e 's!#define HAVE_MALLOC 0!#define HAVE_MALLOC 1!'  config.h
sed -i -e 's!#define HAVE_REALLOC 0!#define HAVE_REALLOC 1!'  config.h
sed -i -e 's!#define malloc rpl_malloc!/*#define malloc rpl_malloc*/!'  config.h
sed -i -e 's!#define realloc rpl_realloc!/*#define realloc rpl_realloc*/!'  config.h

make

make install

thrift安装的注意事项:

1)libevent,boost, openssl需要先安装;

2) openssl默认安装路径非标准,且不生成动态库, 采用如下配置:./config --prefix=/usr/local shared threads;

3)请禁止thrift不需要的生成工具,如java;

4) 注意thrift生成的config.h是否重定义malloc和realloc。

注:

1)上述脚本只生成C++生成工具。

2)系统为linux,假定系统已安装g++,lex,yacc工具库。