Compiling packages in Ubuntu

Brad was asking me the other night to try and compile wormux (yes we both loved Worms Armageddon) because he was having some issues with it. Now I guess I’ve been using Ubuntu for a while but I have yet to actually do any development on it, and it has mostly been just to keep my server up and running. In Gentoo, if you installed a package you’re pretty much promised to have all the development files needed to compile the package again later. Ubuntu doesn’t even come with a compiler intially! No problem though, all the things you could need for compiling c/c++ programs can be easily installed with:

sudo apt-get install build-essentials

That little command will get you set up with autoconf, make, gcc a couple of libraries and a few other things you’ll be needing. However it’s not enough to actually compile wormux. We need more libraries, specifically wormux lists, libsdl (and several other libs that extend sdl), libxml and libcurl. Hrm, cool enough, Ubuntu has libsdl-dev, libxml-dev, and libcurl4-openssl-dev (somehow I figured out that was the package I needed as wormux lists libcurl3-dev). You can go about installing each dev package as you need ie:

sudo apt-get install libsdl1.2-dev libcurl4-openssl-dev

But there is a much easier way. If the package you want to compile has a source package you can do this:

sudo apt-get build-dep wormux

And boom, there you go. Use ./configure followed by make and you should have a fresh binary to run through your cpu. Though once I was finished with this I ran into some issues and a couple questions. For example look at the output from initally running the above build-dep command:

The following NEW packages will be installed:
cdbs comerr-dev debhelper fdupes html2text intltool intltool-debian
libcurl4-gnutls-dev libfreetype6-dev libgcrypt11-dev libgl1-mesa-dev
libglib2.0-dev libglibmm-2.4-dev libglu1-mesa-dev libglu1-xorg-dev
libgnutls-dev libgnutlsxx13 libgpg-error-dev libidn11-dev libjpeg62-dev
libkadm55 libkrb5-dev libldap2-dev liblzo2-dev libogg-dev libopencdk10-dev
libpng12-dev libpthread-stubs0 libpthread-stubs0-dev libsdl-gfx1.2-dev
libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev
libsdl1.2-dev libsigc++-2.0-dev libsmpeg-dev libsmpeg0 libtasn1-3-dev
libtiff4-dev libtiffxx0c2 libvorbis-dev libx11-dev libxau-dev
libxcb-xlib0-dev libxcb1-dev libxdmcp-dev libxml++2.6-dev libxml2-dev
mesa-common-dev patchutils po-debconf x11proto-core-dev x11proto-input-dev
x11proto-kb-dev xtrans-dev zlib1g-dev
0 upgraded, 57 newly installed, 0 to remove and 0 not upgraded.
Need to get 4231kB/15.3MB of archives.
After this operation, 56.5MB of additional disk space will be used.
Do you want to continue [Y/n]?

A lot of these development libraries are completely unneeded for compiling wormux and while initially conveinent using build-deps does not give you an easy method for removal. There is no “apt-get remove build-dep package-name.” Which most of the time that’s not a problem, when people decide to compile software they usually have plans to work on it for a while. However, in my case (just installing the deps to help a buddy out with some compile issues) it would be nice to have a way to remove these packages.

So to end this tale, the best way to install development packages if you’re feeling lazy is to use apt-get to install (and later remove) the dev packages individually (as done in the first example). You would then use apt-get build-dep for when you’re actually doing more serious work (presumably managing packages/releases for Ubuntu/Debian). The ideal solution is to install each package manually, cluttering your system the least amount and giving you full control. But as I’ve been told while looking into this, there’s no reason to sweat the small stuff, so I’ll probably stick with installing dev packages individually and removing them when I get in the mood for cleaning my system later.

Comments are closed.