Thrift 源码编译
admin
2023-02-19 21:20:41
0

Thrfit0.11版本安装

构建Apache Thrift IDL编译器

环境准备

            yum install libtool libtool-devel libevent libevent-devel flex  byacc byacc-devel  boost boost-devel  bison bison-devel -y


下载

            wget https://github.com/apache/thrift/archive/0.11.0.tar.gz


指令执行

 ./bootstrap.sh
./configure --enable-libs=no --prefix=/home/test/
make && make install

说明 --enable-libs=no开关仅在没有lib构建的情况下构建Apache Thrift IDL编译器


configure后面可以指定如下需要编译的语言库

  --with-csharp           build the C# library [default=yes]
  --with-java             build the Java library [default=yes]
  --with-erlang           build the Erlang library [default=yes]
  --with-nodejs           build the Nodejs library [default=yes]
  --with-lua              build the Lua library [default=yes]
  --with-python           build the Python library [default=yes]
  --with-perl             build the Perl library [default=yes]
  --with-php              build the PHP library [default=yes]
  --with-php_extension    build the PHP_EXTENSION library [default=yes]
  --with-dart             build the DART library [default=yes]
  --with-ruby             build the Ruby library [default=yes]
  --with-haskell          build the Haskell library [default=yes]
  --with-go               build the Go library [default=yes]


注意

# 当make报错时,package golang.org/x/net/context: unrecognized import path "golang.org/x/net/context",可以把go关掉:
[root@node1 thrift-0.11.0]# ./configure  --with-go=no


Thrift C++动态库编译

源码目录:thrift-0.11.0/lib/cpp

只有当执行了./configure --enable-libs=no --prefix=/home/test/,进行了IDL的配置之后,才会根据Makefile.am文件生成Makefile文件。

只有执行了make &&make install,才能够正常的编译完成C++的测试例子,出错如下,原因是还没有生成IDL工具thrift:

make[1]: Entering directory '/home/dong/thrift/thrift-0.11.0/lib/cpp/test'
/home/dong/thrift/thrift-0.11.0/compiler/cpp/thrift --gen cpp ../../../test/AnnotationTest.thrift
make[1]: /home/dong/thrift/thrift-0.11.0/compiler/cpp/thrift: Command not found
make[1]: *** [Makefile:1815: gen-cpp/AnnotationTest_types.h] Error 127
make[1]: Leaving directory '/home/dong/thrift/thrift-0.11.0/lib/cpp/test'
make: *** [Makefile:1720: all-recursive] Error 1

实际上已经成功生成了libthrift动态库目录在thrift-0.11.0/lib/cpp/.libs

库:libthrift-0.11.0.so  libthrift.a  libthrift.la  libthrift.lai  libthrift.so


Thrfit0.90版本安装

1)确保系统安装了OpenSSL开发包

rpm -qa |grep openssl
openssl-libs-1.0.2k-19.el7.x86_64
openssl-1.0.2k-19.el7.x86_64
openssl-devel-1.0.2k-19.el7.x86_64

2)没有rpm源仓库,手动编译指定安装

./configure CPPFLAGS="-I /home/dong/3thrdparty/openssl-1.0.2j/include" LDFLAGS="-ldl -L /home/dong/3thrdparty/openssl-1.0.2j/"

否则编译出错

configure: error: "Error: libcrypto required."

相关内容

热门资讯

重磅消息“问鼎娱乐.怎么开挂?... 有 亲,根据资深记者爆料问鼎娱乐是可以开挂的,确实有挂(咨询软件无需打开...
今日重磅消息“欢乐岛.怎么开挂... 今日重磅消息“欢乐岛.怎么开挂?”确实真的有挂您好,欢乐岛这个游戏其实有挂的,确实是有挂的,需要了解...
终于懂了“可乐麻将.辅助开挂神... 有 亲,根据资深记者爆料可乐麻将是可以开挂的,确实有挂(咨询软件无需打开...
今日重大通报“YY棋牌.有没有... 家人们!今天小编来为大家解答YY棋牌透视挂怎么安装这个问题咨询软件客服徽9784099的挂在哪里买很...
最新引进“蜀友汇.真的有挂吗?... 网上科普关于“蜀友汇有没有挂”话题很是火热,小编也是针对蜀友汇作*弊开挂的方法以及开挂对应的知识点,...
我来教教您“情怀娱乐.怎么开挂... 家人们!今天小编来为大家解答情怀娱乐透视挂怎么安装这个问题咨询软件客服徽9752949的挂在哪里买很...
玩家分享攻略“广客账本.可以开... 您好:广客账本这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9752949】很多玩家在这款游戏...
终于了解“极酷牛牛.可以开挂吗... 您好:极酷牛牛这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9752949】很多玩家在这款游戏...
终于懂了“火神炸金花.开挂神器... 终于懂了“火神炸金花.开挂神器?”果然有透视挂您好,火神炸金花这个游戏其实有挂的,确实是有挂的,需要...
今日重大消息“福建众娱.辅助器... 您好:福建众娱这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9752949】很多玩家在这款游戏...