为未来跨语言通讯预研,选择了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 替换
终于经过了,跨平台为啥作的这么烂~