ubuntu下安装thrift

来源:互联网 发布:剑灵召唤师女捏脸数据 编辑:程序博客网 时间:2024/05/24 00:29

博主想要搭建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.gzcd thrift-0.10.0/./configuresudo makesudo 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.confldconfig

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

原创粉丝点击