Mac 安装Thrift

系统:Mac Mountain Lion 10.8.2
软件:Thrift 0.9.0

解压thrift-0.9.0.tar.gz并进入当前目录,
i.Configure
需要说明的是,笔者只需要PHP,JAVA之间通信,所以将其他语言禁用。Thrift 支持的语言有:C++, C#, Cocoa, Erlang, Haskell, Java, Ocami, Perl, PHP, Python, Ruby, Smalltalk.
[thrift-0.9.0:username]$./configure --prefix=/Users/username/Develop/thrift --without-csharp --without-erlang --without-perl  --without-ruby –without-haskell

ii.Make
[thrift-0.9.0:username]$make

iii.Make Install
[thrift-0.9.0:username]$sudo make install


测试:[~:username]$~/Develop/thrift/bin/thrift -version

//以下是安装过程中遇到的错误:
1、configure: error: C compiler cannot create executables
......
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive... gnutar
checking for pkg-config... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/username/Develop/thrift-0.9.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
.......

查看config.log日志,
104 cc1: error: /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include: Not a directory
105 cc1: error: /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/i686-apple-darwin11/include: Not a directory
发现路径有问题,也就是安装的Xcode有问题。之前我将xcode安装在其他自定义目录了,看来必须要装在/Applications目录下。重装后执行./configure 即可


2、 ......./lib/rb/Rakefile:23
.......
/Users/username/Develop/thrift-0.9.0/lib/rb/Rakefile:23
(See full trace by running task with --trace)
make[3]: *** [all-local] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
.......

看来是ruby环境问题。所以在configure的时候将ruby禁用即可






你可能感兴趣的:(Mac 安装Thrift)