Feb
27
2009
1

Installing Apache Thrift on Ubuntu 8.04

In a recent post, I explained how to install the Thrift RPC framework on OS X 10.5. Another scenario that doesn’t install as advertised out of the box is building Thrift on Ubuntu server. Again, an issue with pkg.m4 is to blame – follow the steps below to get Thrift built on your Ubuntu system:

As in the previous guide start by getting the latest revision of the Thrift library, and extract the archive.

Install the necessary prerequisites, which is much easier than on OS X thanks to apt. Fire up a terminal, and use apt-get to pull everything. Substitute java5 with your favorite jdk, if you’re not a fan of the Sun implementation.

apt-get install libboost-dev libevent-dev build-essential
python-dev automake pkg-config libtool flex bison sun-java5-jdk

Now, for the pkg.m4 workaround!

cd [thrift root]
cp /usr/share/aclocal/pkg.m4 aclocal/

At this point, all that remains is to build Thrift. (If you want Ruby support, add ruby-dev to the apt-get list above, and get rid of the ruby flag below.)

./bootstrap.sh
./configure --with-ruby=no
make
sudo make install

Enjoy!

Feb
23
2009
9

Installing Apache Thrift on Mac OS X 10.5 Leopard

Thrift is a efficient framework for cross-language serialization and RPC that recently became an Apache Incubator project. It’s definately a cool project to check out if you are building a high traffic web application or are writing distributed computing code. Installing the framework on OS X isn’t currently totally straightforward, provided below is a guide to get Thrift built on OS X Leopard.

First, gather required sources – Thrift depends on the Boost and libevent libraries, grab the latest revisions of each and then download the latest Thrift snapshot.

Build Boost first:

cd [boost root]
./configure
sudo make install

This takes a while, go make a cup of coffee – and when it finishes build libevent, which takes much less time:

cd [libevent root]
./configure
make
sudo make install

At this point is where most Thrift builds will run into trouble, as the pkg.m4 file required by autoconf in upcoming steps does not get correctly found.The following error will be encountered when trying to configure the package:

./configure: line 21183: syntax error near
unexpected token `MONO,'
./configure: line 21183: `  PKG_CHECK_MODULES(MONO, mono >= 1.2.6,
have_mono=yes, have_mono=no)'

The official faq says that in order to get this file, one should install macports, and then use it to install pkg-config – but as macports is a colossal pain in the ass, we’ll do something else.  The pkg.m4 file is also installed when X11 is installed off the OS install disc, and since X11 is something you can’t live without if you’re working on or with mainstream open source software, that is the route we will take. After installing X11 (not shown here, because it just consists of running the installer package on the OS X disc), do the following to get pkg.m4 where it needs to be:

cd [thrift root]
cp /usr/X11/share/aclocal/pkg.m4 aclocal/

After doing this, Thrift can build without issues, which will take some time, but not nearly as long as Boost did:

./bootstrap.sh
./configure
make
sudo make install

Hope this helps anyone trying to write Thrift code on OS X!

Powered by WordPress | Theme: Aeros 2.0 by TheBuckmaker.com