centos 安裝thrift


Thrift介紹

Thrift是一個軟件框架,用來進行可擴展且跨語言的服務的開發。它結合了功能強大的軟件堆棧和代碼生成引擎,以構建在 C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml 這些編程語言間無縫結合的、高效的服務。

安裝開發工具集

sudo yum -y groupinstall "Development Tools"

 

安裝autoconf

 
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 ..
 

 

安裝automake

 
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 ..
 

 

安裝bison

 
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 ..
 

 

安裝C++依賴庫

sudo yum -y install libevent-devel zlib-devel openssl-devel

 

安裝boost

wget http://iweb.dl.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.gz
./bootstrap.sh --prefix=/usr
./b2 install 
cd ..

 

安裝libevent

wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
./configure --prefix=/usr
make
sudo make install
cd ..

 

安裝Thrift

git clone https://git-wip-us.apache.org/repos/asf/thrift.git
cd thrift
./configure --prefix=/usr --with-libevent=/usr --with-boost=/usr
sudo make
sudo make install

 

安裝過程中容易碰到的問題:

1.下面這個錯誤可能是因為DOS(Windows)和Unix文件格式問題:
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=c++11... no
configure: No compiler with C++11 support was found
./configure: line 16746: syntax error near unexpected token `fi'
./configure: line 16746: `fi'
解決方法是設置好git:
[core]
autocrlf = false
safecrlf = true
eol = lf
對應的命令為:
git config --global core.autocrlf false
git config --global core.safecrlf true
git config --global core.eol lf


完成后,刪除再重新從git上clone出來。

 

2..ibtoolize: AC_CONFIG_MACRO_DIR([./aclocal]) conflicts with aclocal_AMFLAGS=-I ./aclocal 執行libtoolize遇到上面提示的錯誤時,可能是因為configure.ac和Makefile.am文件是dos格式導致的。這個問題跟上面那個解決方案一致,或者直接修改文件格式見:http://www.cnblogs.com/573583868wuy/p/4009546.html(不太建議這樣干,單個文件可以這樣,文件多了就比較坑了)。

 

3.

g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report

 

具體步驟請參見 <http://bugzilla.redhat.com/bugzilla>。
make[3]: *** [src/thrift/generate/thrift-t_c_glib_generator.o] 錯誤 1
make[3]: Leaving directory `/home/will/thrift-0.10.0/compiler/cpp'
make[2]: *** [all-recursive] 錯誤 1
make[2]: Leaving directory `/home/will/thrift-0.10.0/compiler/cpp'
make[1]: *** [all-recursive] 錯誤 1
make[1]: Leaving directory `/home/will/thrift-0.10.0'
make: *** [all] 錯誤 2

主要原因大體上是因為內存不足,可以 臨時使用交換分區來解決,最好是添加物理內存

sudo dd if=/dev/zero of=/swapfile bs=64M count=16 
sudo mkswap /swapfile 
sudo swapon /swapfile

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM