Tuesday, June 3, 2014

How to build an LLVM pass using SCons

LLVM provides some nice documentation on how to build a simple pass using CMake, but if you want to build your project using SCons, this is not very useful. 

Luckily, there is an easy configuration tool "llvm-config" which gives you all the information you need to build against llvm.  Simply add the line
env.ParseConfig("llvm-config-3.5 --cppflags --cxxflags")
to your SConstruct file, and it should handle all of the llvm compiler flags for you.

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).


$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 $@

        dh_auto_build -B -Smakefile -- doc


Finally, from the mlpack directory run

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