ubuntu 14.04 安装 Apache Thrift 0.10

1、到官网下载源码压缩文件

https://thrift.apache.org/download

2、安装依赖软件,可以参考

https://thrift.apache.org/docs/install/

我参考的是 Debian/Ubuntu install 这一项

sudo apt-get install automake bison flex g++ git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config

但在安装libboost-all-dev 的时候又遇到了许多其他依赖

libboost-all-dev : Depends: libboost-date-time-dev but it is not going to be installed
                    Depends: libboost-filesystem-dev but it is not going to be installed
                    Depends: libboost-iostreams-dev but it is not going to be installed
                    Depends: libboost-log-dev but it is not going to be installed
                    Depends: libboost-python-dev but it is not going to be installed
                    Depends: libboost-regex-dev but it is not going to be installed
                    Depends: libboost-system-dev but it is not going to be installed
                    Depends: libboost-thread-dev but it is not going to be installed
                    Depends: libboost-wave-dev but it is not going to be installed
 

可以用下面的方法解决

sudo apt-get install aptitude
sudo aptitude install libboost-all-dev

过程中第一个选N,意思是同意降级使用本机软件,后续选项用Y

3、开始安装thrift

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

4、检验是否安装成功

thrift -version

成功会显示

Thrift version 0.10.0

可能会出现错误: (解决错误来自:https://blog.csdn.net/huanbia/article/details/77098205)

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命令应该可以看到相应的版本了。

猜你喜欢

转载自www.cnblogs.com/longjmp/p/9706059.html