[Haskell-cafe] A cabal odyssey

Andrew Coppin andrewcoppin at btinternet.com
Mon Aug 16 15:27:42 EDT 2010


And so today, just for giggles, I tried to get Sifflet to work. Along 
the way, I encountered a number of... "glitches", if you will.

First of all, I tried to get it to work on Windows. I fired up a new 
Windows VM and installed Haskell Platform 2010.1.0.0. It seems that 
(finally) this includes the cabal-install tool, which is nice. It seems 
it includes cabal-install 0.8.0, so as soon as I tried "cabal update", 
it tells me a new version is available. It claims I just need to "cabal 
install cabal-install" (which is amusingly riddle-like). Unfortunately, 
although doing this *does work*, the new cabal.exe is installed lower 
down the search path than the existing one, so you still get the old 
version (unless you manually fiddle with the search path). In fact, it 
seems that the HP install folder is higher up the search path than the 
"global" binary target, which is higher than the "local" binary target. 
It seems to me like this ought to be the other way around.

The next problem is that "cabal install sifflet" gets mighty confused 
and outright fails. Basically it can't figure out how to resolve all the 
dependencies. It seems that Sifflet demands GTK 0.11.0 (i.e., 
gtk-0.11.0, pango-0.11.0, glib-0.11.0, etc.) However, Cabal looks at 
gtk-0.11.0, sees it depends on (say) "glib-0.11.*", and wants to use 
glib-0.11.1 (the latest one). But then Sifflet wants glib-0.11.0, not 
glib-0.11.1, and it seems Cabal just can't figure out what the heck to 
do. Which is slightly surprising, really.

The solution (of sorts) is to painstakingly resolve the dependencies by 
hand, by asking Cabal to install the correct packages one at a time in 
the correct order. (I still love the way Gtk2hs *actually compiles* on 
Windows now. That's pretty sweet!)

That reminds me. What the heck is actually *in* file 126? I don't know 
why, but compiling file 126 (Graphics.UI.Gtk.Gdk.Cursor) takes up 75% of 
the entire Gtk2hs build time! What's that all about?

Anyway, having finally built Gtk2hs version 0.11.0 successfully, I 
continued trying to get Sifflet working... only to discover it wants the 
"curl" package. And when I ask Cabal to build it, it just retorts that 
it has a configure script. *sigh* So that's the end of that. I have 
absolutely no idea why a tool like Sifflet would need access to the Curl 
library. Presumably this is just another one of those obscure 
dependency-chasing artifacts that happen from time to time? (After 
dealing with Linux, I'm used to this kind of weirdness.)

OK, so it's only possible to run Sifflet under Linux. Let's give that a 
try...

So I fire up a new OpenSUSE VM. I quickly discovered that gtk seems to 
want Alex and Happy, but cabal-install is defaulting to doing a "local" 
rather than "global" install, and thereafter it can't "find" Alex or 
Happy, even though they're installed. (Yeah, great, thanks for that...) 
So I rewind the VM, build the latest version of cabal-install, and edit 
the configuration to do global installs instead of local. The amusing 
part is, if you "sudo cabal install" so it has permission to put the 
installed files into place, it then uses root's configuration file 
instead. *sigh* Well anyway, I managed to work around that. But... Cabal 
*still* fails to find Alex or Happy, even though they're now in the 
search path.

Oh, wait. They're in *my* search path. They're not in root's search 
path. (As per good security practise, root's search path is rather 
short.) I can pass some CLI switches to tell it where these are, but 
then gtk2hs-buildtools makes a whole bunch of stuff which Cabal also 
can't find. Eventually, the easiest thing I could come up with was to do 
"cabal unpack" to get a source tree, configure and build as me, and sudo 
for the install. Except that then it tries to reconfigure...? Wuh? So 
instead of "sudo cabal install", I tried "sudo runhaskell Setup 
install", which works just fine (although obviously it's rather wordy!)

So, I manually hold Cabal's hand through the process of building all the 
0.11.0 packages one at a time, in a way that it can find all the stuff 
at configure-time. Gosh this is a faff! Well anyway, it worked. Trips 
over when I reach Curl, but that's because I need to ask YaST to install 
the curl-devel package. And, finally, I can build and install Sifflet 
itself.

After 4 hours or so of typing commands, it was nice to do some stuff 
with my mouse. ;-) I spent about 20 minutes trying to figure out how to 
build high-order functions before I discovered that you can't. Still, 
the stated design goal of Sifflet is "to teach beginners about 
recursion". Clearly it's design achieves this goal quite well. Equally 
clearly, Haskell has damaged my mind. I actually cannot think of *any* 
interesting low-order functions! 5 years of programming in Pascal with 
low-order *monomorphic* functions, and today I can't think of a single 
interesting use for such a thing. ;-)

Heh, well anyway... I don't know how many of the things I've mentioned 
are known or likely to be fixed. Just thought I'd share.



More information about the Haskell-Cafe mailing list