1.安装boost
Boost库是为C++语言标准库提供扩展的一些C++程序库的总称,由Boost社区组织开发、维护
下载地址:http://www.boost.org/ 版本 Version 1.64.0
解压下载后的文件,进入其目录,执行如下脚本,该过程会持续5分钟左右
2. 安装libevent
libevent是一个轻量级的开源的高性能的事件触发的网络库,适用于windows、linux、bsd等多种平台,内部使用select、epoll、kqueue等系统调用管理事件机制
下载地址:http://libevent.org/ 版本 libevent-2.1.8-stable.tar.gz
make的时候出现 fatal error: 'openssl/bio.h' file not found
这是由于mac默认安装了openssl但是没有安装对应的include头文件和lib库,故这里使用homebrew(参考https://brew.sh/index_zh-cn.html)来安装最新的openssl
然后重新运行 make 和 sudo make install 命令来安装libevent
3. 安装thrift
下载thrfit 0.8.0版本:http://archive.apache.org/dist/thrift/
解压下载的文件,进入该目录,运行以下脚本
make的时候会出现 fatal error: 'tr1/functional' file not found,此时应该
1.需要修改如下文件,将#include <tr1/functional>改为#include <boost/tr1/functional.hpp>
{thrift目录}/lib/cpp/src/concurrency/ThreadManager.h line:24
{thrift目录}/lib/cpp/src/async/TAsyncChannel.h line:23
{thrift目录}/lib/cpp/src/async/TAsyncChannel.cpp line:21
{thrift目录}/lib/cpp/src/async/TAsyncProcessor.h line:23
{thrift目录}/lib/cpp/src/async/TAsyncBufferProcessor.h line:23
2.用 boost::shared_ptr 替换 shared_ptr(一共有两处),需要修改的文件如下,
{thrift目录}/lib/cpp/test/Benchmark.cpp
修改完成后再重新运行make和make install,安装完成
运行 thrift -version 查看版本,安装完成