Blog-like notes

Installing pandoc on Slackware

I’ve just spent several hours getting Pandoc to work on my Slackware64 system, so I thought I would quickly document what I needed to do before I forget it.

The Glasgow Haskell Compiler

Bad news, Pandoc is written in Haskell—surely a great programming language, but a language for which there is no compiler in Slackware.

Fortunately, installing the Glasgow Haskell Compiler was quite easy, once I got past the fact that I would not be able to build it from source on my system without a Haskell compiler—but if I had a Haskell compiler on my system, then I would not try to build one… I took the binary distribution for the “x86_64-unknown-linux” platform, which happened to work fine on Slackware64-14.1 (the 7.8.2 release did not, because of a missing libtinfo library 1).

The Haskell Platform

Then I needed to install the Haskell Platform, a collection of Haskell “packages”. It provides several packages required by Pandoc (not all, though), and more importantly it provides the cabal tool, which allows to install more packages, even though it is reportedly not a package manager—the subtlety is beyond me, but then I’m not a Haskell programmer.

Installing the Haskell Platform was more difficult, due to several problems in its build system:

A small patch (inspired by the one submitted by “AlainODea”, in the above-mentioned bug report) allows to overcome these issues.

After installation, update the cache of Haskell packages by running the following command:

# ghc-pkg recache

If you forget to do that, the compiler will ignore all the packages you have just installed, and as a result, attempts to compile supplementary packages will inevitably fail due to “insatisfied dependencies”.3

I now provide SlackBuilds for both the GHC compiler and the Haskell Platform, as well as binary packages built on Slackware64-14.1. The post-install script for the haskell-platform package takes care of running the above command.

Beware, these two packages take up to nearly one gigabyte after decompression.

Pandoc

I quickly renounced to prepare SlackBuilds for all Haskell packages required to run Pandoc, and for Pandoc itself. I chose instead to use the cabal “not-a-package-manager” tool, as recommended:

$ cabal update
$ cabal install pandoc

But I ran into a last problem: one of Pandoc’s dependencies, the temporary package (version 1.2.0.2), failed to build due to a compile-time error in System/IO/Temp.hs. Since patching Haskell code is way beyond my abilities, I ended up forcing cabal to use the previous version of the package (hoping the compile-time error was introduced in the last release, which seemed to be the case):

$ cabal install --constraint=temporary==1.2.0.1 pandoc

Then everything went fine and I got the pandoc tool I wanted from the beginning.

  1. It seems that symlinking libtermcap to libtinfo is enough to allow the 7.8.2 release to work—thanks to G. Smith.
  2. Most build systems, and all proper build systems—including those generated by the Autotools—can provide that feature.
  3. This may sound obvious, but I actually lost one hour because of that…