官網(wǎng)教程:
http://thrift.apache.org/docs/install/os_x
不建議使用 brew,不要從官網(wǎng)下載安裝岭辣,使用github
1. 安裝依賴
libevent
boost
bison也需要,自帶的是2.3 仑濒,使用 /usr/local/Cellar/bison/3.*里面替換掉/usr/bin/bison
和yacc
2. 安裝 thrift
git clone https://github.com/apache/thrift.git
./bootstrap.sh
./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local? CPPFLAGS="-I/usr/local/Cellar/openssl/1.0.2j/include" LDFLAGS="-ldl -L/usr/local/Cellar/openssl/1.0.2j/lib" --with-openssl=/usr/local/Cellar/openssl/1.0.2j/bin
--with-openssl=/usr/local/Cellar/openssl/1.0.2j/bin
./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local CXXFLAGS='-g -O2' CFLAGS='-g -O2' CPPFLAGS='-DDEBUG_MY_FEATURE'
CPPFLAGS="-I/usr/local/Cellar/openssl/1.0.2j/include" LDFLAGS="-ldl -L/usr/local/Cellar/openssl/1.0.2j/lib"?
注意:參數(shù)CPPFLAGS 和 LDFLAGS解決 libcrypto required error
make -j4
這個(gè)時(shí)候 下載 https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-macosx.zip
好慢墩瞳,之后 跨越TGW
下一步:
1. thrift -r --gen php testc.thrift
2. thrift -r --gen php:server tests.thrift