Howto build Mosquitto for debian 6 (Wheezy)

Update: Of course Debian 6 is “Squeeze” and “Wheezy” is Debian 7. I won’t correct it in the title (to keep the link stable).

In order to try out owntracks – a promising alternative to google latitude – I needed to install Mosquitto on my server. Mosquitto is an open source MQTT broker.

However the server machine still runs on debian 6. As there are no prebuild packages for that version I had to build mosquitto it on my own.

The build instructions given on the mosquitto site – including jsaak’s post on 2014-05-12 – don’t work because the build dependencies listed in the debian folder require more recent libraries and tools than there are available in debian 6. So I patched them on my own: 2014-07-13_mosquitto_debian_patch.txt

Besides installing the necessary build requirements I did the following:

wget http://mentors.debian.net/debian/pool/main/m/mosquitto/mosquitto_1.2.3-1.debian.tar.gz
wget http://mentors.debian.net/debian/pool/main/m/mosquitto/mosquitto_1.2.3.orig.tar.gz
# Extracts to mosquitto-1.2.3:
tar -xzf mosquitto_1.2.3.orig.tar.gz
tar -C mosquitto-1.2.3 -xzf mosquitto_1.2.3-1.debian.tar.gz
# Apply previously downloaded patch to build under debian 6:
patch -p1 -d mosquitto-1.2.3/debian/ < 2014-07-13_mosquitto_debian_patch.txt
# Finally build mosquitto:
cd mosquitto-1.2.3; debuild -uc -us
# Ready to install .deb files should now appear in the parent directory

What does the patch file do?

Basically I just adapted the dependencies to match the versions available in debian 6. In addition I removed the check for the upstart system (The variable init_is_upstart has been introduced after debian 6 and lead to an error). Also I observed build problems with the debian ut-hash package so I switched back to use the bundled ut-hash library. The last change I did was a fix for a test failing under python 2.6 because the socket API changed.

mosquitto now runs quite stable for several weeks. However I would not recommend this setup for a production system. As I plan to upgrade the server to a more recent debian version anyway I also do not have any intention to adapt the upstream debian build files.