thrift安装 0.8.0版本

由于mac上homebrew安装的thrift是最新版本,而公司使用的是0.80版本,使用中存在兼容问题,因此需要手动安装thrift 0.80版本。Mac版本10.12

1.安装boost

Boost库是为C++语言标准库提供扩展的一些C++程序库的总称,由Boost社区组织开发、维护

下载地址:http://www.boost.org/  版本 Version 1.64.0

解压下载后的文件,进入其目录,执行如下脚本,该过程会持续5分钟左右

 

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

 

2. 安装libevent

libevent是一个轻量级的开源的高性能的事件触发的网络库,适用于windows、linux、bsd等多种平台,内部使用select、epoll、kqueue等系统调用管理事件机制

下载地址:http://libevent.org/  版本 libevent-2.1.8-stable.tar.gz

 

libevent安装
. /configure  --prefix= /usr/local
make
sudo  make  install

make的时候出现  fatal error: 'openssl/bio.h' file not found

这是由于mac默认安装了openssl但是没有安装对应的include头文件和lib库,故这里使用homebrew(参考https://brew.sh/index_zh-cn.html)来安装最新的openssl

 

安装openssl
brew  install  openssl
brew link openssl --froce
ln  -s  /usr/local/opt/openssl/bin/openssl  /usr/local/bin/openssl
ln  -s  /usr/local/opt/openssl/include/openssl  /usr/local/include/openssl
ln  -s  /usr/local/opt/openssl/lib/libssl .a  /usr/local/lib/libssl .a
ln  -s  /usr/local/opt/openssl/lib/libcrypto .a  /usr/local/lib/libcrypto .a

然后重新运行 make 和 sudo make install 命令来安装libevent

3. 安装thrift

下载thrfit 0.8.0版本:http://archive.apache.org/dist/thrift/

解压下载的文件,进入该目录,运行以下脚本

安装thrift
. /configure  --prefix= /usr/local/  --with-boost= /usr/local  --with-libevent= /usr/local  --without-ruby --without-php
make
sudo  make  install

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 查看版本,安装完成

 

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值