通過brew安裝的thrift都是最新版,而團(tuán)隊(duì)里使用的版本是0.9.3炼吴;因擔(dān)心通過RPC訪問產(chǎn)生兼容性問題,自己踩了好多坑順便記錄一下---怎么在mac下安裝降級版的thrift疫衩。
一缺厉、查詢Thrift依賴包
1) 查看thrift所依賴的安裝包
brew info thrift
2)通過brew 安裝依賴包
brew install boost openssl libevent
3)安裝bison 2.5版本以上
通過brew安裝bison的時(shí)候(thrift-0.9.3版本及以上),會(huì)報(bào)“configure: error: Bison version 2.5 or higher must be installed on the system!”隧土,故需要直接下載tar包安裝
bison鏈接:http://www.gnu.org/software/bison/
wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
tar -zxvf bison-2.5.tar.gz
cd bison-2.5
./configure
make && make install
注意:這步結(jié)束后需要查詢當(dāng)前版本
bison --version
如版本不對或者報(bào)錯(cuò)Abort trap: 6提针,則說明安裝有問題
在網(wǎng)上查了很多內(nèi)容,有些辦法是替換xcode自帶的bison曹傀,但是這種辦法并不適用辐脖;
筆者的解決辦法是指定剛剛安裝的目錄
1,先通過brew list bison 查詢當(dāng)前安裝的版本和路徑
2皆愉,使用which bison查詢當(dāng)前執(zhí)行的程序目錄
3嗜价,將brew list bison 查出的路徑寫入/etc/profile,覆蓋which bison錯(cuò)誤的路徑
export PATH=/usr/local/Cellar/bison/3.3.2/bin:$PATH
二幕庐、安裝thrift
thrift鏈接:http://archive.apache.org/dist/thrift/
wget http://archive.apache.org/dist/thrift/0.9.3/thrift-0.9.3.tar.gz ?
tar -zxvf thrift-0.9.3 ?
cd thrift-0.9.3
./configure?
make?
make install ?
三久锥、驗(yàn)證
thrift -version