您的位置:首页 > 运维架构 > Linux

centos7.1编译安装 Thrift0.9.3及boost1.6

2017-06-02 16:12 211 查看
1、不联网安装1.1安装依赖包bzip2-develkeyutils-libs-devellibcom_err-devellibsepol-develpcre-develpkgconfiglibselinux-devellibverto-devellibcom_err-devellibselinux-devellibverto-develkrb5-develzlib-developenssl-develpython-devellibstdc++libstdc++-develgcc-c++m4autoconfperl-libsperl-Thread-Queueperlbisonlibevent-develllvmllvm-libsclangautomakeflexlibtool大部分依赖包可以在安装盘里找到1.2 安装boosttar -xzvf boost_1_60_0.tar.gzcd boost_1_60_0./boostrap.sh --with-toolset=clang./b2 install --toolset=clang --cxxflags="-std=c++11" --prefix=/usr/local1.3安装thrifttar -xzvf thrift-0.9.3./configure --libdir=/usr/lib --without-javamakemake install2、通过yum安装1.1 update the System
sudo yum -y update
1.2 install the platform Development Tools
sudo yum -y groupinstall "Development Tools"
1.3
update autoconf/automake/bison
sudo yum install -y wget
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz tar xvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr
make
sudo make install
cd ..
wget http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz tar xvf automake-1.14.tar.gz
cd automake-1.14
./configure --prefix=/usr
make
sudo make install
cd ..
wget http://ftp.gnu.org/gnu/bison/bison-2.5.1.tar.gz tar xvf bison-2.5.1.tar.gz
cd bison-2.5.1
./configure --prefix=/usr
make
sudo make install
cd ..
1.4. add optional c++ language library dependenciesinstall c++ lib dependencies
sudo yum -y install libevent-devel zlib-devel openssl-devel
upgrade Boost >= 1.53(没有成功)
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
sudo ./b2 install
2. build and install the apache thrift IDL complier
git clone https://git-wip-us.apache.org/repos/asf/thrift.git cd thrift
./bootstrap.sh
./configure --with-lua=no
make
make install
2.1遇到一些错误thrift : TNonblockingServer链接错误更改了文件:src/thrift/Thrift.h  thrift/lib/cpp/src/thrift/THrift.h    #ifdef HAVE_INTTYPES_H    #define __STDC_FORMAT_MACROS    #include <inttypes.h>    #endif
g++: error: /usr/lib64/libboost_unit_test_framework.a: No such file or directory
修改方法:先查找文件 
find / -name libboost_unit_test_framework.a
,比如在 [code]/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
3、使用Thriftstruct UserProfile {1: i32 uid,2: string name,3: string blurb}service UserStorage {void store(1: UserProfile user),UserProfile retrieve(1: i32 uid)}
thrift --gen java user.thrift
thrift --gen cpp user.thrift
thrift --gen php user.thrift
thrift --gen perl user.thrift
thrift --gen csharp user.thrift
thrift --gen py user.thrift
ls
gen-cpp  gen-csharp  gen-java  gen-perl  gen-php  gen-py  user.thrift
[/code]
cd
gen-java/
[/code]
ls
[/code]
UserProfile.java  UserStorage.java
[/code]
  
 
 
  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: