centos7 thrift安装实录

centos7.2 thrift安装实录

本文出自阿哥论坛:http://it.agoit.com/thread-468535-1-1.html

安装步骤:

1.安装centos需要的扩展

yum install -y automake libtool flex bison pkgconfig gcc-c++ libevent-devel zlib-devel python-devel ruby-devel openssl-devel

2.安装boost,本地源码安装最安全

wget http://sourceforge.net/projects/boost/files/boost/1.53.0/boost_1_53_0.tar.gz

tar -xvf boost_1_53_0.tar.gz

cd boost_1_53_0

./bootstrap.sh

./b2 install

在安装boost的时候,使用的yum install boost-devel,在最终安装thrift包的时候,会报找不到libboost_unit_test_framework.a文件,并不是google中表述的把/usr/lib64/libboost_unit_test_framework.a 软连接下就好,而是安装后的boost连/usr/lib64/目录下都不存在这个文件libboost_unit_test_framework.a文件;

3.源码安装thrift

wget http://apache.fayea.com/thrift/0.10.0/thrift-0.10.0.tar.gz tar -xvf thrift-0.10.0.tar.gz cd thrift-0.10.0 ./configure --with-lua=no make && make install

安装报错及解决办法:

报错一:

libtool: link: g++ -std=c++11 -Wall -Wextra -pedantic -g -O2 -o .libs/processor_test processor/ProcessorTest.o processor/EventLog.o processor/ServerThread.o  -L/usr/lib64 ./.libs/libprocessortest.a ../../../lib/cpp/.libs/libthrift.so ../../../lib/cpp/.libs/libthriftnb.so /usr/lib64/libboost_unit_test_framework.a -levent -lrt -lpthread -Wl,-rpath -Wl,/usr/local/thrift/lib

g++: error: /usr/lib64/libboost_unit_test_framework.a: No such file or directory

make[5]: *** [processor_test] 错误 1

make[5]: 离开目录“/opt/soft/thrift-0.12.0/lib/cpp/test”

make[4]: *** [all] 错误 2

make[4]: 离开目录“/opt/soft/thrift-0.12.0/lib/cpp/test”

make[3]: *** [all-recursive] 错误 1

make[3]: 离开目录“/opt/soft/thrift-0.12.0/lib/cpp”

make[2]: *** [all-recursive] 错误 1

make[2]: 离开目录“/opt/soft/thrift-0.12.0/lib”

make[1]: *** [all-recursive] 错误 1

make[1]: 离开目录“/opt/soft/thrift-0.12.0”

make: *** [all] 错误 2

解决方案1:

修改方法:先查找文件find / -name libboost_unit_test_framework.a,比如在/usr/local/lib/libboost_unit_test_framework.a,就可以做如下操作,sudo ln -s /usr/local/lib/libboost_unit_test_framework.a /usr/lib64/libboost_unit_test_framework.a,然后重新执行make。

解决方案2:

源码本地编译boost安装;

wget http://sourceforge.net/projects/boost/files/boost/1.53.0/boost_1_53_0.tar.gz tar -xvf boost_1_53_0.tar.gz cd boost_1_53_0 ./bootstrap.sh ./b2 install

报错二:

gcc宏编译问题__STDC_FORMAT_MACROS

不要用git包,昂~,因为使用git包在安装的时候会报

src/thrift/server/TNonblockingServer.cpp:460:16:

错误:expected ‘)’ before ‘PRIu32’

"(%" PRIu32 " > %" PRIu64

                ^

你可能感兴趣的:(centos7 thrift安装实录)