Saturday, May 25, 2019

Build Thrift compiler (without libraries)

最近在 Linux 與 OS X 上編了 Thrift 0.12.0 要用,跟之前 0.10.0 狀況好像不太一樣了。

Built Thrift 0.12.0 on Linux and OS X recently. The steps to get successful build is different from 0.10.0.

我只需要 Thrift 的 IDL 編譯器,不需要語言的函式庫,用下面的方法可以建置出來:

All I need is Thrift compiler. I excluded libraries for languages to speed-up the build process. Here is the commands to complete the build:

  1. 將會需要 C++ 編譯器,系統上要有基本的建置環境。另外比較特殊的是 Flex 與 Bison (>= 2.5) 這兩個工具,也需要事先安裝好。

    Essential build environment is required. Flex and Bison (>= 2.5) are also required.

    Ref: Apache Thrift Requirements

  2. 會需要 Boost 的標頭檔,因此要先建置出 Boost 標頭檔:

    We will need Boost. Headers are good enough for completing build. Generate Boost headers first:

    $ ./bootstrap.sh --prefix=/tmp/p

    $ ./b2 --with-headers

  3. 開始正式建置 Thrift 編譯器:

    Configure and build the Thrift compiler:

    $ ./configure CXXFLAGS=-I/private/tmp/b/boost_1_70_0 --enable-libs=no --enable-tests=no --enable-tutorial=no --with-boost=/tmp/p --prefix=/target/thrift-0.12.0

    $ make

    $ make install

    比較特殊的是要使用 CXXFLAGS= 來讓建置過程可以找到 Boost 標頭檔,說明文件中的 --with-boost= 似乎是完全沒作用。

    The most tricky part is instructing build process to reach Boost header with CXXFLAGS= flag. The --with-boost= flag in help message does not work for me.

1 comment:

Anonymous said...

12bet | Slots & Games | 13Bet | Thakasino
Online Casino. 24 Hour. No matter the day of operation, 24 hours are a sure bet for you. 24 hours from now rb88 on at 12Bet Casino 12bet - play Slots and william hill