[Haskell-cafe] Cabal

Stephen Tetley stephen.tetley at gmail.com
Mon Nov 9 08:08:06 EST 2009


Hello Gregory and Philippos

Gregory, methinks you are a unix user as "Cabal" gives you a carefree
existence (the scare quotes do highlight that it's not poor Cabal's
fault).


Philippos, the problems you are having aren't which cabal per-se but
Haskell libraries that bind C libraries. On Windows I strongly
recommend you install Cygwin, outside of the Microsoft toolchain
(Visual Studio, C# etc.) any serious development on Windows really is
troublesome without it, some development still is but that's another
story.

Installing Cygwin will pull in a huge amount of code first time round
but after that it it manageable.

Once you have Cygwin – here's how to install the pcre and readline bindings.

Re-run the cygwin installer.
For pcre you will need Devel/pcre and Libs/libpcre.
For readline you will need Devel/readline and Lib/libreadlineN – I
have both libreadline5 and libreadline6 installed, so clearly they can
coexist.

To build the Haskell bindings you want to be running Cygwin naturally.
I'd make a directory in /usr/local tagged to the version of GHC I'm
using eg Haskell_ghc_6_10_3 and copy the tar.gz's there (having a
directory for a particular GHC version makes it easier to track which
packages you are depending upon across GHC updates).

Untar the packages with tar (some Windows archivers don't handle
Unixed archives well)

> tar xvfz readline-1.0.1.0.tar.gz
> tar xvfz pcre-0.3.1.tar.gz

At this point I'd edit the *.cabal files in each component – this is
not 'the done thing', but both libraries need extra flags and as I
have to compile them rarely I tend to forget the format (which appears
to be Windows style full paths even though you are running Cygwin).

Append this to the end of readline.cabal

  extra-lib-dirs:
    C:\cygwin\lib
  include-dirs:
    C:\cygwin\usr\include\readline
    C:\cygwin\usr\include

Append this to the end of pcre-light.cabal

   extra-lib-dirs:
      C:\cygwin\lib
    include-dirs:
      C:\cygwin\usr\include

Provide you have cygwin at the root of C: (which is very wise!), you
should be able to build with the usual runhaskell Setup.lhs {
configure | build | install | hadock }

Best wishes

Stephen


More information about the Haskell-Cafe mailing list