1. 程式人生 > >在linux(CentOS)上安裝Thrift+Scribe

在linux(CentOS)上安裝Thrift+Scribe

原創文章,請轉載時註明出處:

費了九牛二虎之力,遇到各種問題,終於把thrift+Scribe裝好了,記錄一下安裝過程:

首先安裝一個最新版本的autoconf,否則後面編譯的時候會出問題(提示說autoconf版本要2.65以上才行)

wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz

tar xvf autoconf-2.69.tar.gz 

cd autoconf-2.69

./configure --bindir=/usr/bin

make && make install

更新依賴庫

yum install libevent libevent-develpython-devel

yum install gcc-c++

yum install libtool

yum install automake

yum install byacc flex

安裝boost(推薦選擇1.45版本,否則後面會碰到問題,折騰)

wget http://jaist.dl.sourceforge.net/project/boost/boost/1.45.0/boost_1_45_0.tar.gz

tar -xf boost_1_45_0.tar.gz 

cd boost_1_45_0

./bootstrap.sh 

./bjam install --prefix=/usr/local/bootstrap

安裝thrift

wget --no-check-certificate https://dist.apache.org/repos/dist/release/thrift/0.8.0/thrift-0.8.0.tar.gz

tar xzf thrift-0.8.0.tar.gz 

 cd thrift-0.8.0

--with-php-config=/usr/local/php/bin/php-config 

./configure --with-boost=/usr/local/bootstrap/ --with-java --prefix=/usr/local/thrift

make && make install

安裝fb303(注意,fb303是thrift的一個子目錄,在thrift-0.8.0裡面)

cd thrift-0.8.0/contrib/fb303

./bootstrap.sh --prefix=/usr/local/thrift/fb303 --with-boost=/usr/local/bootstrap/ --with-thriftpath=/usr/local/thrift/ 

./configure --prefix=/usr/local/thrift/fb303 --with-boost=/usr/local/bootstrap/ --with-thriftpath=/usr/local/thrift/ CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"

安裝Facebook-scribe

wget --no-check-certificate  https://nodeload.github.com/facebook/scribe/tarball/master

tar xf facebook-scribe-63e4824.tar.gz 

cd facebook-scribe-63e4824

export BOOST_ROOT=/usr/local/bootstrap/

export LD_LIBRARY_PATH=/usr/local/thrift/lib:/usr/lib:/usr/local/lib:/usr/local/bootstrap/lib/

./bootstrap.sh --prefix=/usr/local/scribe --with-boost=/usr/local/bootstrap/ --with-thriftpath=/usr/local/thrift/  --with-fb303path=/usr/local/thrift/fb303 

注意,安裝thrift或者scribe的時候,可能會遇到編譯不過的問題thrift/protocol/TBinaryProtocol.tcc:147: error: there are no arguments to 'htons' that depend on a template parameter, so a declaration of 'htons' must be available

需要自己修改一下檔案:

vim /usr/local/thrift/include/thrift/protocol/TBinaryProtocol.tcc

在首行新增標頭檔案引用: #include <arpa/inet.h>

參考資料:

http://mail-archives.apache.org/mod_mbox/thrift-user/201112.mbox/%[email protected].com%3E

http://www.cnblogs.com/hitwtx/archive/2012/02/10.html

http://abentotoro.i.sohu.com/blog/view/190515962.htm

https://github.com/facebook/scribe

http://kpumuk.info/development/installing-and-using-scribe-with-ruby-on-mac-os/

http://wudaolin.com/?tag=php

http://flysky.fm1062.com/post/20100911-1.aspx

https://github.com/facebook/scribe/downloads

https://bitbucket.org/chrta/thrift/src/32433af09b99/bootstrap.sh

http://slaytanic.blog.51cto.com/2057708/716580

https://bitbucket.org/chrta/thrift/src/32433af09b99/bootstrap.sh

http://thrift.apache.org/download/

http://hi.baidu.com/izouying/item/9690fc355792d6d76d15e912