如何让thrift0.9.2 在macos上面编译通过?

时间:2015-04-24 12:27:09   收藏:0   阅读:2089

为将来跨语言通信预研,选择了thrift来试试。结果在mac os上面安装遇到种种困难,不知道是我选择方法错误还是咋的,不管怎样,总算是编译过去了。

 

首先,我们来参考官网的安装步骤:https://thrift.apache.org/docs/install/os_x

OS X Setup

The following command install all the required tools and libraries to build and install the Apache Thrift compiler on a OS X based system.

Install Boost

Download the boost library from boost.org untar compile with

./bootstrap.sh
sudo ./b2 threading=multi address-model=64 variant=release stage install

Install libevent

Download libevent, untar and compile with

./configure --prefix=/usr/local 
make
sudo make install

Building Apache Thrift

Download the latest version of Apache Thrift, untar and compile with

./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local

Additional reading

For more information on the requirements see: Apache Thrift Requirements

For more information on building and installing Thrift see: Building from source

 

----------------------------------------------------------------------------------

然后,你可能会遇到下面的问题:

 

make[4]: *** [src/thrift/transport/TSSLSocket.lo] Error 1

openssl版本过旧导致, 在mac下面可以升级一下:

brew update
brew install openssl
brew link --force openssl

openssl version -a

 

processor/ProcessorTest.cpp:26:10: fatal error: ‘tr1/functional‘ file not found

The problem here is that libc++ has been written after c++11 was "released".
You could try this:

#if __cplusplus >= 201103L
#include <functional>
#else
#include <tr1/functional>
#endif

and compile with CXXFLAGS="-std=c++11".

[thrift dir]/lib/cpp/test/processor/ProcessorTest.cpp 

---------------------------------------------------------------------

library not found for -l:libboost_unit_test_framework.a thrift

为啥不能找到lib目录呢?

fuck,修改:

vim  [thrift dir]/lib/cpp/test/Makefile.am 

暂时用绝对路径:/usr/local/lib/ibboost_unit_test_framework.a 替换

 

终于通过了,跨平台为啥做的这么烂~

 

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!