Thrift的安装与错误解决
简介
Thrift是Facebook的核心技术框架之一,使不同语言开发的系统可以通过该框架进行通信。开发者使用thrift提供的格式来定义数据和服务脚本。thrift可以通过定义的脚本自动生成不同语言的代码以支持不同语言之间的通信。thrift支持多种数据通信协议,比如xml,jason,binnary等等。
Thrift并不是唯一的跨语言通信框架,像google的protocol buffers也是与之类似的框架。关于两者之前的比较可以去股沟一下。
Trift安装
1.安装thrift所依赖的linux包 autoconf automake sysconftool boost boost-devel libtool byacc flex bison这一步请根据相关系统进行按装,因为现在用的是red hat5服务器版,所以我直接从光盘里找rpm包直接安装 通过rpm -ivh 包名.rpm进行安装。
2.下载thrift的代码:http://incubator.apache.org/thrift/download/
3.解压代码包tar -zxvf thrift-0.2.0-incubating.tar.gz
4.拷贝thrift到安装目录 cp -r thrift0.2.0 /usr/local/
5.cd /usr/local/thrift0.2.0 运行该目录下的./bootstrap.sh shell脚本。这一步你可能遇到这两种错误
错误一
[root@localhost thrift]# ./bootstrap.sh --enable-m4_pattern_allow
libtoolize: You should add the contents of `./aclocal/libtool.m4' to `aclocal.m4'.
libtoolize: You should add the contents of `./aclocal/ltoptions.m4' to `aclocal.m4'.
libtoolize: You should add the contents of `./aclocal/ltsugar.m4' to `aclocal.m4'.
libtoolize: You should add the contents of `./aclocal/ltversion.m4' to `aclocal.m4'.
libtoolize: You should add the contents of `./aclocal/lt~obsolete.m4' to `aclocal.m4'.
configure.ac:50: error: possibly undefined macro: AC_PROG_MKDIR_P
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:144: error: possibly undefined macro: AC_TYPE_INT16_T
configure.ac:145: error: possibly undefined macro: AC_TYPE_INT32_T
configure.ac:146: error: possibly undefined macro: AC_TYPE_INT64_T
configure.ac:147: error: possibly undefined macro: AC_TYPE_INT8_T
configure.ac:151: error: possibly undefined macro: AC_TYPE_SSIZE_T
configure.ac:152: error: possibly undefined macro: AC_TYPE_UINT16_T
configure.ac:153: error: possibly undefined macro: AC_TYPE_UINT32_T
configure.ac:154: error: possibly undefined macro: AC_TYPE_UINT64_T
configure.ac:155: error: possibly undefined macro: AC_TYPE_UINT8_T
configure.ac: installing `./install-sh'
configure.ac: installing `./missing'
compiler/cpp/Makefile.am: installing `./depcomp'
configure.ac:44: installing `./config.guess'
configure.ac:44: installing `./config.sub'
这个错误可以忽略,不影响使用。
错误二
required file `./ltmain.sh' not found
解决方法 安装libtool包
6.运行 ./configure
7.运行 ./make 这一步可能会遇到两个错误
错误一
. /bin/sh http://www.cnblogs.com/libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/include -I./src -Wall -g -O2 -MT Thrift.lo -MD -MP -MF .deps/Thrift.Tpo -c -o Thrift.lo `test -f 'src/Thrift.cpp' || echo './'`src/Thrift.cpp
http://www.cnblogs.com/libtool: line 841: X--tag=CXX: command not found
http://www.cnblogs.com/libtool: line 874: libtool: ignoring unknown tag : command not found
http://www.cnblogs.com/libtool: line 841: X--mode=compile: command not found
http://www.cnblogs.com/libtool: line 1008: *** Warning: inferring the mode of operation is deprecated.: command not found
http://www.cnblogs.com/libtool: line 1009: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
http://www.cnblogs.com/libtool: line 1152: Xg++: command not found
http://www.cnblogs.com/libtool: line 1152: X-DHAVE_CONFIG_H: command not found
http://www.cnblogs.com/libtool: line 1152: X-I.: command not found
http://www.cnblogs.com/libtool: line 1152: X-I../..: No such file or directory
http://www.cnblogs.com/libtool: line 1152: X-I/usr/include: No such file or directory
http://www.cnblogs.com/libtool: line 1152: X-I./src: No such file or directory
http://www.cnblogs.com/libtool: line 1152: X-Wall: command not found
http://www.cnblogs.com/libtool: line 1152: X-g: command not found
http://www.cnblogs.com/libtool: line 1152: X-O2: command not found
http://www.cnblogs.com/libtool: line 1152: X-MT: command not found
http://www.cnblogs.com/libtool: line 1152: XThrift.lo: command not found
http://www.cnblogs.com/libtool: line 1152: X-MD: command not found
http://www.cnblogs.com/libtool: line 1152: X-MP: command not found
http://www.cnblogs.com/libtool: line 1152: X-MF: command not found
http://www.cnblogs.com/libtool: line 1152: X.deps/Thrift.Tpo: No such file or directory
http://www.cnblogs.com/libtool: line 1152: X-c: command not found
http://www.cnblogs.com/libtool: line 1205: XThrift.lo: command not found
http://www.cnblogs.com/libtool: line 1210: libtool: compile: cannot determine name of library object from `': command not found
解决办法:libtool的问题,目前只在服务器上有这个问题
(1)卸载原服务器的libtool
(2)下载最新的libtool安装,wget http://ftp.gnu.org/gnu/libtool/libtool-2.2.6b.tar.gz./configure ;make;make install
(3)重新thrift安装步骤的第四步即可
错误二
编译java包出错,是由于没有链接网络不能maven所致,可以忽略,待以后用到java,进行手动编译。
8.安装完成,在终端输入thrift 会提示thrift的用法,说明安装成功。