Sunday, April 6, 2014

Building mlpack .deb

mlpack is a nice C++ library for machine learning, but unfortunately it doesn't have widely available Debian packages.  A few years ago someone made packaging, but his attempts to get it included in Debian is sadly documented here.  I wasn't able to find ready-built packages for Debian, and the build instructions on the mlpack website don't tell you how to build a deb.  Luckily, I did some snooping around and figured out how to do it.


First, download the latest tarball, and save it in a folder named "tarballs".  We then want to check out an svn directory (in the same folder the contains the tarballs folder).

Run 

$svn co http://svn.cc.gatech.edu/fastlab/mlpack/conf/packages/mlpack/trunk mlpack
 
Now make sure you have svn-buildpackage installed, along with all the other mlpack dependencies.


There is a bug in  the packaging, in that the default make target does not build the documentation, but the package tries to install it anyway, causing the package to fail to build.  I also found that the 1.08 version test suite fails, also halting the build, so I disabled it.

To fix these things, enter the mlpack directory you just checked out and edit debian/rules .  At the bottom of the file, modify it so it looks like


%:
        dh $@

override_dh_auto_build:
        dh_auto_build
        dh_auto_build -B -Smakefile -- doc

override_dh_auto_test:

Finally, from the mlpack directory run

$sh debian/build-from-svn.sh
 
This still might not work... I'll update this later