爲未來跨語言通訊預研,選擇了thrift來試試。結果在mac os上面安裝遇到種種困難,不知道是我選擇方法錯誤仍是咋的,無論怎樣,總算是編譯過去了。c++
首先,咱們來參考官網的安裝步驟:https://thrift.apache.org/docs/install/os_xgit
The following command install all the required tools and libraries to build and install the Apache Thrift compiler on a OS X based system.apache
Download the boost library from boost.org untar compile withbootstrap
./bootstrap.sh sudo ./b2 threading=multi address-model=64 variant=release stage install
Download libevent, untar and compile withvim
./configure --prefix=/usr/local make sudo make install
Download the latest version of Apache Thrift, untar and compile withui
./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local
For more information on the requirements see: Apache Thrift Requirementsthis
For more information on building and installing Thrift see: Building from sourcespa
----------------------------------------------------------------------------------code
而後,你可能會遇到下面的問題:
make[4]: *** [src/thrift/transport/TSSLSocket.lo] Error 1
openssl版本過舊致使, 在mac下面能夠升級一下:
brew update
brew install openssl
brew link --force openssl
openssl version -a
processor/ProcessorTest.cpp:26:10: fatal error: 'tr1/functional' file not found
The problem here is that libc++ has been written after c++11 was "released".
You could try this:
#if __cplusplus >= 201103L
#include <functional>
#else
#include <tr1/functional>
#endif
and compile with CXXFLAGS="-std=c++11".
[thrift dir]/lib/cpp/test/processor/ProcessorTest.cpp
---------------------------------------------------------------------
library not found for -l:libboost_unit_test_framework.a thrift
爲啥不能找到lib目錄呢?
fuck,修改:
vim [thrift dir]/lib/cpp/test/Makefile.am
暫時用絕對路徑:/usr/local/lib/ibboost_unit_test_framework.a 替換
終於經過了,跨平臺爲啥作的這麼爛~