ubuntu下安装thrift

博主想要搭建thrift来使用python访问集群hbase,但是在centos6.5下编译的时候往往会出各种问题,比如如下这个问题就是其中的一种,但苦于太菜,至今没有解决,所以决定使用ubuntu来安装thrift了。

/usr/include/event2/event_struct.h:123: error: redefinition of ‘struct event’
/usr/include/event.h:213: error: previous definition of ‘struct event’
In file included from src/thrift/server/TNonblockingServer.cpp:24:
./src/thrift/server/TNonblockingServer.h:73: error: multiple types in one declaration
./src/thrift/server/TNonblockingServer.h:73: error: declaration does not declare anything

环境介绍

操作系统:Ubuntu 14.04.4
thrift版本:thrift-0.10.0

开始安装

大家可参考官网针对Ubuntu的thrift安装教程:去看Ubuntu官网教程,当然也有针对于centos6.5的教程:去看centos6.5官网教程,但是本博主在centos6.5一直没有安装成功过。
1. 首先安装依赖项:

sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev

2.将thrift安装包下载下来,并解压安装

tar -zxvf thrift-0.10.0.tar.gz
cd thrift-0.10.0/
./configure
sudo make
sudo make install

安装成功后可通过如下命令来验证,如果出现Thrift version 0.10.0则代表安装成功

thrift -version

可能出现的问题

当执行thrift -version的时候可能出现如下错误:

thrift: error while loading shared libraries: libthriftc.so.0: cannot open shared object file: No such file or directory

此时首先去查看一下/usr/local/lib下是否有libthriftc.so.0文件

ll /usr/local/lib/libthriftc.so.0

如果没有请在网上下载并安装。
如果有则需要将该文件所在的路径添加到到/etc/ld.so.conf即可:
(以下命令需要切换到root用户)

echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig

此时切换回普通用户输入thrift -version命令应该可以看到相应的版本了。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值