Thrift 0.9.2 官方文檔中對於Mac OS X上的安裝描述比較簡陋,很多問題都不能解決。
Homebrew macport
經過實驗,安裝步驟如下:
(安裝步驟中如果出現缺少目錄的提示,就手動創建目錄)
1、安裝 autoconf2.65 automake 1.11.6,采用默認安裝方式
brew install autoconf
bew install automake
2、設置java環境變量 JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Home
安裝 Boost,此步驟可以按照官方文檔進行
安裝 libevent,此步驟可以按照官方文檔進行
brew install libevent
3、從github 獲得thrift-0.9.2.zip(不要使用官方提供的安裝包否則會遇到n多坑),https://github.com/apache/thrift/releases/tag/0.9.2
4、在解壓后的thrift目錄中運行./bootstrap.sh
5、執行 export CXXFLAGS="-std=c++11"
6、編譯
./configure --prefix=/usr/local/thrift-0.9.2 --disable-static --with-boost=/usr/local --with-libevent=/usr/local --without-python --without-csharp --without-ruby --without-perl --without-php --without-haskell --without-erlang LDFLAGS='-L/usr/local/opt/openssl/lib' CPPFLAGS='-I/usr/local/opt/openssl/include' CXXFLAGS="-std=c++11"
(參數根據需要進行設定)
7、make
8、sudo make install
安裝完成
