installing debian build dependencies the smart way

16 Apr 2014

The Problem

So you’re trying to build a Debian package from an upstream source tree, but you’re not sure what build dependencies you should install? I have this problem all the time. For example, if I wanted to build the unity source tree into a debian package, I’d branch it:

$ bzr branch lp:unity

…change into the directory:

$ cd unity

…and then try and build it. Needless to say, I almost never have the required build dependencies installed. You can try and use apt-get to install the build dependencies for you:

$ sudo apt-get build-dep unity

But that reads the build dependencies from whatever version is present in the distribution, not the dependencies in the source tree.

The Solution

The solution is easy. First, install a couple of packages:

$ sudo apt-get install devscripts equivs

Then run this from within the source tree to install the build dependencies:

$ sudo mk-build-deps -i

If, after this command completes you still cannot build the package, you should probably file a bug against the upstream project!