如何讓thrift0.9.2 在macos上面編譯通過?


為將來跨語言通信預研,選擇了thrift來試試。結果在mac os上面安裝遇到種種困難,不知道是我選擇方法錯誤還是咋的,不管怎樣,總算是編譯過去了。

 

首先,我們來參考官網的安裝步驟:https://thrift.apache.org/docs/install/os_x

OS X Setup

The following command install all the required tools and libraries to build and install the Apache Thrift compiler on a OS X based system.

Install Boost

Download the boost library from boost.org untar compile with

./bootstrap.sh sudo ./b2 threading=multi address-model=64 variant=release stage install 

Install libevent

Download libevent, untar and compile with

./configure --prefix=/usr/local make sudo make install 

Building Apache Thrift

Download the latest version of Apache Thrift, untar and compile with

./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local 

Additional reading

For more information on the requirements see: Apache Thrift Requirements

For more information on building and installing Thrift see: Building from source

 

----------------------------------------------------------------------------------

然后,你可能會遇到下面的問題:

 

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 替換

 

終於通過了,跨平台為啥做的這么爛~

 

 


免責聲明!

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



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