您好,登錄后才能下訂單哦!
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."
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。