mac 上可以用
brew install thrift 进行安装
$thrift -version
Thrift version 0.11.0
但是我们需要 0.9.2
1,
brew versions install
和
brew tap homebrew/homebrew-versions
都不可用
https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula
因此手动安装:
2,
brew uninstall thrift
axel -n 30 http://archive.apache.org/dist/thrift/0.9.2/thrift-0.9.2.tar.gz
tar -zxvf thrift-0.9.2.tar.gz
cd thrift-0.9.2
./configure
configure: error: Bison version 2.5 or higher must be installed on the system!
brew install Bison
echo ‘export PATH=”/usr/local/opt/bison/bin:$PATH”’ » ~/.bash_profile
$source .bash_profile
./configure
make
fatal error: ‘openssl/err.h’ file not found
brew install openssl
Updating Homebrew…
Warning: openssl 1.0.2n is already installed
brew link openssl –force
Warning: Refusing to link: openssl
./configure –prefix=/usr/local/ –with-boost=/usr/local –with-libevent=/usr/local
3,
github
https://github.com/apache/thrift/tree/0.9.2
git clone https://github.com/apache/thrift.git
$git branch -a
$git checkout remotes/origin/0.9.2
./bootstrap.sh
./configure
make
src/thrift/transport/TSSLSocket.cpp:33:10: fatal error: ‘openssl/err.h’ file not found
官网的安装步骤: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
This snippet was generated by Apache Thrift’s source tree docs: doc/install/os_x.md
下载boost
axel -n 30 https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
bufferevent_openssl.c:66:10: fatal error: ‘openssl/bio.h’ file not found
axel -n 30 https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
tar -zxvf boost_1_66_0.tar.gz
./bootstrap.sh
sudo ./b2 threading=multi address-model=64 variant=release stage install
axel -n 20 https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -zxvf libevent-2.1.8-stable.tar.gz
./configure –prefix=/usr/local
make
src/thrift/transport/TSSLSocket.cpp:33:10: fatal error: ‘openssl/err.h’ file not found
which openssl
cd ../thrift/
ln -s /Users/didi/anaconda/bin/openssl openssl
make
git clone https://github.com/openssl/openssl.git
都失败了
4,利用brew安装
git clone https://github.com/Homebrew/homebrew-core.git
太慢,切换中国科大镜像
git clone https://mirrors.ustc.edu.cn/homebrew-core.git/
git log ./Formula/thrift.rb | less
git checkout 56d8c1eba1e5ac30290dd0c486f4bba37f821e42
brew install ./Formula/thrift.rb
Error: Calling BottleSpecification.revision is disabled! Use BottleSpecification.rebuild instead. homebrew-core/Formula/thrift.rb:25:in `block in <class:Thrift>'
vi Formula/thrift.rb +25
bottle do
cellar :any
rebuild 2
#revision 2
$thrift -version
Thrift version 0.9.2
安装成功