Monday, March 16, 2015

HarmTrace, or: How I Learned about Cabal Hell and Hated it Ever Since

For a music visualization project I'm trying to get HarmTrace, a haskell library, working. It is what Chordify uses in their backend to detect BPM and Chord changes, and Chordify is great on that.

I did not expect, however, that it would be so hard to install a haskell package. Turns out that the "package manager", Cabal, is famous for breaking dependencies and giving developers hell. To this date I've spent 15 hours on it, and I believe it's very close, but it's been a long and winding journey.

Current progress:

Upstream Mentor (creator of HarmTrace and co-founder of Chordify!) successfully contacted.

Mentor suggestion: Install it in a linux machine, with ghc-7.6.3.

Installation progress:

Mac: using GHC 7.6.3, and custom .cabal file, build gets stuck at hmatrix-gsl-stats-0.2 bug. Someone ran into this as well. His fix didn't work on my machine.

Linux: He suggests using linux for this. Ubuntu was installed in a VirtualBox and I tried to install Haskell-Platform on it. First try with Debian distribution, it bugged out; second try, it ran out of memory after ~5 hours. Oops. Guess I'll try it on my Mint.

The author who ran into hmatrix-gsl-stats problem wrote a post about installing it on Linux. After getting Haskell-platform installed, I'll follow his post for the rest.

Oh, and fragment of a script:

To install from online:
cabal install HarmTrace --with-ghc=ghc-7.6.3 --constraint="HarmTrace-Base==" --constraint="uu-parsinglib installed" --allow-newer=uu-parsinglib,cabal

To build from local:

cabal configure --with-ghc=ghc-7.6.3
cabal build --with-ghc=ghc-7.6.3
cabal install --with-ghc=ghc-7.6.3


  1. Man, I'm very happy to have found your post. I'm going crazy trying to install harmtrace. I have the hmatrix-gsl-stats error, but your link on how to solve the problem are expired. Do you still know where can I find the solutions? Everywhere on internet people seem to use it without problems

    1. Hey! Try checking out the archived version of that guy's website: Just ctrl-F `hmatrix`. Unfortunately I didn't proceed the project that used HarmTrace after writing this blogpost. Good luck!

    2. "I just reinstall the whole things. and turn off “shared: False” in cabal config when face this linkage problem. This will turn off the linkage dynamic lib of apple , i think the problem is occur by here. And harmtrace can be succeed install."

    3. Thank you! Unfortunately this project has so many problem that I think i will have to rewrite at least a part of it! But thanks:)