下載thrift依賴的東西
yum -y install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel crypto-utils
openssl openssl-devel
下載最新版本thrift,網址:http://thrift.apache.org
tar -zxvf thrift-0.8.0.tar.gz
移到預設安裝目錄
cp -r thrift-0.2.0 /usr/local/ (預設安裝目錄?否則可能影響到產生的thrift bin檔案雖然有產生,但是找不到,安裝在這裡的話可以產生的thrift就在/usr/local/bin裡了,這時終端輸入thrift就有了,否則command not found.當然/usr/local/bin原先應該設定在$PATH裡)
cd /usr/local/thrift-0.2.0
./bootstrap.sh (有You should add the contents of `./aclocal/libtool.m4' to `aclocal.m4'. glibtoolize: You should add the contents of `./aclocal/ltoptions.m4' to `aclocal.m4'. glibtoolize ...關於libtoolize,不管,繼續下面的命令)
./configure --with-boost=/usr/include/ 因為boost安裝在/usr/include裡?
非常重要:可能這裡有一個關於libtool的錯誤Version mismatch error. This is libtool 2.2.4, but the libtool: definition of this LT_INIT comes from libtool 2.2.6. libtool: You should recreate aclocal.m4 with macros from libtool 2.2.4 libtool: and run autoconf again.
這是由於libtool版本不一致引起的,終端輸入libtool --version可以看出我們的版本是libtool 2.2.4(在/usr/bin裡)。但是/usr/local/thrift-0.2.0裡的libtool是2.2.6的,所以用/usr/bin的libtool複製到/usr/local/thrift-0.2.0中,覆蓋原來的版本。再執行上面的./configure --with-boost=/usr/include/ 命令,ok~~
make
make install
在終端輸入thrift,有下面的東東,ok,install thrift success.
thrift bin檔案在/usr/local/bin裡
Usage: thrift [options] file
Options:
-version Print the compiler version
-o dir Set the output directory for gen-* packages
(default: current directory)
-I dir Add a directory to the list of directories
searched for include directives
-nowarn Suppress all compiler warnings (BAD!)