For a computer music seminar, we wanted to look at harmtrace.
This package is somewhat dated: it has constraint base<4.7
, that implies ghc-7.6.3
, released in 2013). Here is how to build it anyway.
./configure --prefix=/opt/ghc/ghc-7.6.3 ; make ; sudo make install
. Depending on the distribution you are running, this might fail with missing libgmp.so.3
(if you have newer libgmp.so.10
only). Maybe your distribution has a package that provides the old version - if not, you can boldly symlink sudo ln -s libgmp.so.10 libgmp.so.3
in /usr/lib64
.cabal
(not necessarily compiled by the old ghc)PATH=/opt/ghc/ghc-7.6.3/bin:$PATH cabal install harmtrace
. This will do some stuff, but then fail to compile hmatrix-gsl-stats-0.4.1.1
due to Ambiguous occurrence unsafePerformIO
. Therefore -cabal unpack hmatrix-gsl-stats-0.4.1.1
, this creates a directory, go down there, type cabal install
, but using the old ghc, like this: PATH=/opt/ghc/ghc-7.6.3/bin:$PATH cabal install
. This will try to install hmatrix-gsl-stats-0.4.1.1
from local sources. Initially, you’ll get the same errors as before. Remove (or comment) each line import System.IO.Unsafe(unsafePerformIO)
(alternatively, replace import Foreign
by import Foreign hiding (unsafePerformIO)
).PATH=/opt/ghc/ghc-7.6.3/bin:$PATH cabal install harmtrace
. (why do the failing cabal install harmtrace
two steps back? It helps to avoid cabal hell.) On my system, I was running into a linker error (unknown relocation), but I could solve this by using some older version of C compiler/linker (not gcc-6.3
).harmtrace parse --help
shows a help text, see also http://foswiki.cs.uu.nl/foswiki/GenericProgramming/HarmTrace Sadly, the page says “Examples - to be written.” But there is a grammar, giving a “simplified (and somewhat informal) description of the expected syntax” of input files. Well, let’s try:
harmtrace parse -g pop -c "C:maj C:maj F:maj G:maj C:maj"
[Piece[PT[T_1_1[I_0[C:maj]]]][PD[D_1_1[S_3_1[IV_0[F:maj]]][D_3_1[V_0[G:maj]]]]][PT[T_1_1[I_0[C:maj]]]]]
This looks OK, and hopefully can be matched to the productions of the grammar in the paper.