Tidal-vis is hard

17 May 2014

Installing the tidal-vis package with cabal on my macbook (osx version 10.9.2) nearly killed me, but I managed it. In the interest of making it easier for the next person, this is a blog post about how to do it, and, how not to waste loads of time not doing it right.

My first mistake was starting the install at 11:30pm thinking I'd have a couple of patterns generated and be in bed by midnight. It was not a quick install by any stretch of the imagination. I started by assuming that because tidal-vis is in a subfolder of the tidal git repo that it was contained in the tidal cabal package. It is not, it's a seperate package. You'll need to cabal install tidal-vis. I can understand why it's a seperate package, it isn't something that ordinary users of tidal will use in the course of live-coding. I don't really understand why it's in the same git repo and is registered as a submodule of tidal (Sound.Tidal.Vis) if it's a seperate thing. But, what I understand or not tends not to matter, and be right regardless of whether or not I understand it. Through some hoogling and hayooing I realised what was going on, and realised that I needed to install the seperate package. That was fine, I ran cabal install tidal-vis once I figured it out. ERROR (computer says no). So, it's complaining about not having cairo installed. Ok, cabal install cairo). ERROR (I'm sorry Hugh, I'm afraid I can't do that). Another prerequisite. gtk-buildtools (and gtk2hs, this bit is a bit fuzzy and may be mixed in with the following bits), and tried to install cairo again. Not sure why cabal couldn't just do that for me itself. That's when cabal told me that = does not exist. It just said something along the lines of = does not exist. If cabal was a person, I would have done my utmost to assure them that the concept of equality does in fact exist and is fundamental to mathematics, computer science, and philosophy, then rushed them to the nearest mental health clinic. Regardless, cabal is not intelligent enough for that. Did some googling, the general consensus among stack overflow users was to update cabal. I ran cabal update, afterwhich cabal spat out the most bizarre instruction ever. It read: "Please run cabal install cabal-install". What? Who designed this thing? What is even going on here. So I ran the command, cabal installed itself, but it installed itself without regard to the previous cabal installation (done by homebrew), and messed up its location in my path. What a n00b. I fixed it for it, and ran cabal install cairo again. No dice. Same problem. Something about equality. It was at this point that I realised that Cario is a library written in C++ and must be installed manually on the system (it seems) before cabal can install the haskell bindings for the library. Great error reporting there cabal, very informative. At this stage, it was well past 1am. I still thought I could make it work, so I persevered, sure that cabal would not beat me. I installed Cairo manually by downloading the source code and ./configure, make, make install (possibly as sudo, can't remember), because obviously there's no existing Mac binaries.

That was a long install. But finally, I can now install the haskell bindings, then tidal-vis, then run the example code. NO! (I ran out of funny disobedient computer videos). Equality still doesn't exist or something. Then, I found some really weird advice on stack overflow: Install a new version of GCC. What? Why? No. I don't want to do that. (and then the rest of the stages of grief). I installed GCC 4.8 (or 4.2.something, can't remember), then managed to finally get the haskell bindings to cairo to install. Now all the prerequisistes were installed. Excellent! I downloaded the example tidal-vis script at 2:30 am or thereabouts, and ran ghc -o textures textures.hs. NO. DICE. WHAT. Type error. Sound.Tidal.Vis was requiring a type specific to version 0.3.8 of Sound.Tidal for one of it's functions, possibly in render. I had tidal 0.3.9, and it was causing an issue. I gave up and went to bed, annoyed with myself that I couldn't make it work.

The next morning (ok, it was the afternoon) I woke up, and got straight back to it. cabal unregister tidal. cabal unregister tidal-vis. cabal install tidal. cabal install tidal-vis. The script compiled. Then it ran. Then I had 6 patterns on my desktop in pdf format. Nice. 5 minutes in the morning. Moral of the story is: if unable to do anything at 3am, go to sleep and it'll work in the morning. There was still something weird going on in that the patterns were not rendering as I would've expected going by alex's blog post, but a quick chat on the tidal forums and the post was extended to include the short code snipped to make the patterns repeat (this time in svgs). I was surprised by how massive the final svg files were, but I guess that's the nature of intricate complex patterns rendered in a format in which each vertex is specified. I guess there are optimizers and such to do that sort of thing.

Reading over this, it doesn't actually seem very useful. I intended to be able to write a definitive step by step instruction set at the end, but I've said 'I can't remember' too much to reliably distill that mess of prose into 'this is what you should do'. I intend to do an OS reinstall soon, and will make sure I document things absolutely perfectly next time. In summary, it was hard, but I made it work in the end (after a lot of effort!)

PS: Yes, I know, I should use a real, free OS, but I bought this computer when I was starting out a degree that for the first year (although my impression was that throughout the course) I was required to use Max/MSP which is proprietary and not available on Linux. I also overestimated the amount of time I'd be expected to spend in DAWs, and those have a much better user experience on macs than on linux (as far as I can tell from plenty of research online). I spent far too much money on this computer for it to not be my primary (or even only) machine. Yes, I know about the falsehoods of 'sunk costs', but psychologically I can't make myself sell it and get a spiffing new machine running arch.