按照thrift官网上的文档进行安装,步骤如下:
1. 安装boost
./bootstrap.sh —prefix=PATH_TO_BOOST sudo ./b2 threading=multi address-model=64 variant=release stage install2. 安装libevent
./configure —prefix=PATH_TO_LIBEVENT make sudo make install3. 安装thrift
./configure —prefix=PATH_TO_THRIFT —with-boost=PATH_TO_BOOST —with-libevent=PATH_TO_LIBEVENT make sudo make install在make时,报错no member named ‘bind‘ in namespace ’std‘。具体原因是thrift用到了c++11的特性,但是默认Mac的g++没有开启。使用g++编译时,需要传入-std=c++11选项以支持c++11的特性。
在configure之后,把lib/cpp/Makefile和lib/cpp/test/Makefile中的CXXFLAGS选项中添加上-std=c++11,然后make、sudo make install即可。
原文:http://blog.csdn.net/chosen0ne/article/details/22225527