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."

相关内容

热门资讯

服务六大场景 机器人公园上岗 玉渊潭公园投用水面割草机器人。(刘平 摄) 天坛公园的智能巡护机器人上岗。(刘平 摄) 盛夏七月,...
力箭一号遥十五运载火箭圆满完成... 红星新闻网7月24日讯2026年7月24日07时33分,我国在东风商业航天创新试验区使用力箭一号遥十...
特朗普:美方正与伊朗谈判,不排... 当地时间7月24日,美国总统特朗普在白宫谈及对伊朗战争的“退出战略”时表示,美国有两种选择:一是继续...
小伙相亲2天后花33万闪婚,一... 极目新闻记者 邓波2025年4月,安徽安庆小伙何攀到贵州贵阳花果园相亲,并与相识两天的贵阳籍女子陆某...
丘成桐:王虹和邓煜都在MIT待... 当地时间7月23日,在美国费城举行的2026年国际数学家大会开幕式上,中国数学家邓煜、王虹获得菲尔兹...
欧盟对俄制裁列单中企,中国驻欧... 问:2026年7月23日,欧盟通过第21轮对俄罗斯制裁方案,新增列单制裁中国企业。中方对此有何评论?...
特朗普预警9月政府“停摆”,美... 一国总统公开预警自家联邦政府即将“停摆”,这种魔幻剧情又双叒叕要在华盛顿上演?当地时间7月22日,特...
视频丨2026年APEC数字和... 昨天(23日),2026年亚太经合组织数字和人工智能部长会议在四川成都举行。本届会议的主题为“数字和...
海南商发二期发射区土建完工,建... 7 月 24 日消息,海南商发今日宣布,海南商业航天发射场二期发射区建设项目土建工作完成,全面转入设...
菲律宾,没有以色列的命,得了以... 菲律宾,马尼拉。美国国务卿鲁比奥来了。菲律宾期盼已久的“救星”来了。菲律宾认为的“阳光”来了。从机场...