For this lab, we will use Apache Thrift, which is a cross-platfrom, cross-language RPC library. For the homework task, you will use 2 different programming language to implement a client-server application. One of them will be C++ and you can choose the other one. The chosen language must support Binary and Multiplex protocols (see table https://thrift.apache.org/docs/Languages.html)
To use Thrift, we will need:
You may choose to install Thrift by:
Packages for the compiler and the C++ library may be available in your system repository. Packages for Java, Node.js, Python, and possible for other languages, are available in their respective package managers.
sudo apt install thrift-compiler
sudo apt install libthrift-dev
libthrift
from org.apache.thrift
npm install -g thrift
pip install thrift
If building from source, you can choose which languages will be supported. Disable languages that you will not use to speed up the build and avoid build errors. Support for some languages may require installing additional packages on the system.
Download the source code from http://www.apache.org/dyn/closer.cgi?path=/thrift/0.14.1/thrift-0.14.1.tar.gz .
Unzip the source code:
tar -xf thrift-0.14.1.tar.gz
cd thrift-0.14.1
Run a bootstrap script:
./bootstrap.sh
You may need to install additional packages on your system before building thrift, such as libtool
, flex
, bison
, automake
, libboost-all-dev
, libssl-dev
, libcrypto++-dev
, python3-dev
.
Configure the build, including selection of supported languages.
See the help for available options.
./configure --help
--with-XXX
flags to select supported languages.--without-XXX
flags to disable languages (to avoid errors and speed up the build).Finally, build and install the library.
make
sudo make install
On the computers in rotunda, thrift packages are not installed, so I recommend building from source for the compiler and for C++ support.
Use a --prefix
option of configure
to specify your directory where thrift will be installed, then run make install
without sudo
.
This configuration has been tested (all languages except C++ are disabled).
./configure --disable-tests --without-qt5 --without-c_glib --without-java --without-erlang --without-nodejs --without-nodets \
--without-lua --without-python --without-py3 --without-perl --without-php --without-php_extension --without-dart \
--without-ruby --without-haskell --without-go --without-swift --without-rs --without-cl --without-haxe --without-netstd \
--without-d --prefix=$HOME/thrift
Then, build and install the library:
make
make install
For Java, Node.js or Python, use the respective pacakge managers.
It is possible to enable more languages, but then make install
may fail (some languages are still disabled because those caused build errors for some reasons).
./configure --disable-tests --without-ruby --without-haskell --without-php --without-go --prefix=/afs/ms/u/d/dortv/thrift