Installing gearmand, libgearman and pecl gearman extension for php from source in Debian 6 & 7

I had a pretty rough evening today. No, not because the waiter forgot to add sugar in my tea, but because it was so boring to go through the trial and errors of installing gearman daemon and pecl gearman extension for php.

First I tried with the pretty-obvious-awe-fucking-some way.

apt-get update
apt-get install gearman 
pecl install gearman

In above steps, “apt-get install gearman” ran smoothly. But then “pecl install gearman” failed saying that it doesn’t have libgearman. Eh? so I installed libgearman4 (in Debian Squeezy. It was libgearman6 in Wheezy) and libgearman-dev. But pecl failed again to compile the extension saying that libgearman is missing. Strange! So I googled about this issue and found that it could be a link error where a symbolic link might be required of “/usr/include/libgearman” as “/usr/include/libgearman-1.0″. Still no luck.

So I decided to compile gearmand from the source. And libgearman is also included with that, so it will fix two errors at once. I downloaded the latest gearman package from launchpad and tried to compile it

wget https://launchpad.net/gearmand/1.2/1.1.11/+download/gearmand-1.1.11.tar.gz
tar -zxvf gearmand-1.1.11.tar.gz
cd gearmand-1.1.11
./configure

Failure 1:
At this step, configure stopped showing the following error

configure: error: cannot find Boost headers version >= 1.39.0

To fix this, I had to install “libboost-all-dev” by following command

apt-get install libboost-all-dev

And I tried to compile gearman and it failed again

Failure 2:
At this step, configure stopped showing that it cannot find gperf. That’s fine – I have installed gperf and tried to configure gearman again

apt-get install gperf

Failure 3:
Now it failed again, showing that libevent is missing. Hmm! Had to fix it anyway

apt-get install libevent-dev

Failure 4:
Heck! Another failure. Now it’s showing that it can’t find libuuid. This part was a little tricky to solve, but finally fixed with the following package

apt-get install uuid-dev

Let’s configure again. And sweet that the configure script ran smoothly. Let’s compile using make

Failure 5:
Grrr! At this point the make script failed with a bunch of text, where the following lines were at the top

libgearman/backtrace.cc: In function 'void custom_backtrace()':
libgearman/backtrace.cc:64:6: sorry, unimplemented: Graphite loop optimizations can only be used if the libcloog-ppl0 package is installed

So it cannot find a library named libcloog-ppl. Let’s fix this problem by

apt-get install libcloog-ppl-dev

Now I’ve tried to run the make script, and it was good. So i also ran make install to complete the installation.

make
make install

Now gearmand and libgearman both are installed. So I tried to install pecl-gearman with the following extension and voila! it worked. No more missing libgearman anymore.

pecl install gearman

Now all I had to do is add the line “extension=gearman.so” in my php.ini .

The process was tedious and boring and took me more time than writing this article. If you have seen “Despicable Me 2″ when Lucy and Gru went to ElMacho’s restaurant and were attacked by that crazy chicken and finally Lucy exclaimed “What’s wrong with that chicken!”

I really wanted to say “What’s wrong with this chicken” after gearman was installed at last.

Enjoy!

About these ads

4 thoughts on “Installing gearmand, libgearman and pecl gearman extension for php from source in Debian 6 & 7

  1. It’s at the times you have to compile some stuff from source that you remind yourself how cool it is to have debian package everything-and-the-kitchensink for you – once you go apt you never go back! I recently tried to compile mysql server from source on centos to add a storage plugin and in fact gave up

  2. Had the same problems and i add also i was missing the libpq (PostgreSql library for the Queue) so i’ve installed it via:
    apt-get install libpq-dev

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s