Linux 下编译 thrift

 thrift编译需要依赖 openssl,首先按照文章《Openssl在Linux下编译/交叉编译》编译openssl。

网上有文章说thrift编译还需要依赖Boost,libevent,但是我发现不依赖这两个库也能把thrift编译出来。在 https://github.com/apache/thrift/releases 下载thrift源码。

Linux 下编译 thrift_第1张图片

比如这里下载 0.15.0版本的源码,将其拷贝进Linux,比如Ubuntu中,解压。然后进入源码目录:

./configure --prefix=$(pwd)/install --disable-tests --enable-shared --disable-tutorial --with-cpp --without-python --without-java --without-lua --without-csharp --without-erlang --without-php --without-php_extension --without-haskell --without-perl --without-go --without-c_glib --enable-static LDFLAGS="-L/home/cjc/company/Sunmnet/xiangmu2/trunk/avs/third_party/openssl-1.1.1s/install/lib -lssl -lcrypto" CPPFLAGS="-I/home/cjc/company/Sunmnet/xiangmu2/trunk/avs/third_party/openssl-1.1.1s/install/include"

这里只编译thrift C++相关的库,所以指定选项with-cpp --without-python --without-java --without-lua --without-csharp --without-erlang --without-php --without-php_extension --without-haskell --without-perl --without-go。

使用选项LDFLAGS="-L/home/cjc/company/Sunmnet/xiangmu2/trunk/avs/third_party/openssl-1.1.1s/install/lib -lssl -lcrypto" CPPFLAGS="-I/home/cjc/company/Sunmnet/xiangmu2/trunk/avs/third_party/openssl-1.1.1s/install/include"指定openssl的路径。

make
make install

执行完后,即生成thrift的库文件

参考:

《Mac安装Thrift》

https://github.com/apache/thrift/blob/master/lib/cpp/README.md

《linux的thrift编译指南详细版(64位 + 32位)》

你可能感兴趣的:(linux)