How to install Haskell Platform for Ubuntu 13.04?

How to install Haskell Platform for Ubuntu 13.04? I get the following error when I type sudo apt-get install haskell-platform:

E: Unable to locate package haskell-platform error 

Raring is caught in a valley between having a GHC too new for Haskell Platform 2012.4.0.0 and too old for 2013.2.0.0. This valley can be bridged with some pain and duct tape.

You can install the Haskell Platform 2013.2.0.0 from source if you have GHC already installed. It's a bit of a process, but it does work.

First, install GHC 7.6.2:

sudo apt-get install ghc

Now you need GHC 7.6.3 as it is a pre-req for Haskell Platform 2013.2.0.0.

CAUTION:

You might think installing from the unknown-linux archives of GHC will work. It won't. The GHC in those archives is dynamically linked against /usr/lib/libgmp.so.3 which is unavailable on Raring which has libgmp.so.10. Do NOT be tempted to symlink this library to it's earlier version's name and location to fake out the linker. I went there and it is a path to very confusing failures and is a very bad practice so I mended my ways and built GHC from source.

Next, you need to get and build GHC 7.6.3 from source (GHC is a self-hosted compiler so it needs GHC to build it):

wget http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-src.tar.bz2
tar xjvf ghc-7.6.3-src.tar.bz2
cd ghc-7.6.3
./configure
make
sudo make install

Compiling GHC took quite a while (several hours, > halflife of Cesium isotope Cs-134m) for me so this is likely a very good time for a break or sleep. It goes through three stages (0, 1, and 2) of building the compiler and then building the compiler's next stage with the compiler that was built.

To speed the compile process up, you can use

make -j 8

in the above step to leverage multi-core CPU.

Then, get and build the Haskell Platform from source (I'll use 2013.2.0.0 as an example):

wget http://lambda.haskell.org/platform/download/2013.2.0.0/haskell-platform-2013.2.0.0.tar.gz
tar xzvf haskell-platform-2013.2.0.0.tar.gz
cd haskell-platform-2013.2.0.0
./configure
make
sudo make install

Compiling the Haskell Platform took quite >30 minutes for me so this is another good time for a break.

You should now have a working Haskell Platform 2013.2.0.0 with GHC 7.6.3 correctly linked against libgmp.so.10.


Ubuntu 13.04 repo contains GHC 7.6.2, unfortunately there's no Haskell Platform for GHC 7.6.x yet. So you'd better to build an eariler version of GHC (i.e., 7.4.x) and Haskell Platform from source for now.

See this for more information: https://launchpad.net/ubuntu/raring/i386/haskell-platform


As the excellent answer from Alain O'Dea above details, this problem is not easily fixed, and in the meantime there is no haskell-platform available for Ubuntu 13.04.

You can sort of 'fake' it by installing the packages on this list: http://packages.ubuntu.com/precise/haskell-platform

Here is a command to do this for you:

sudo apt-get install ghc alex cabal-install happy libghc-cgi-dev libghc-fgl-dev libghc-glut-dev libghc-haskell-src-dev libghc-html-dev libghc-http-dev libghc-hunit-dev libghc-mtl-dev libghc-network-dev libghc-opengl-dev libghc-parallel-dev libghc-parsec3-dev  libghc-quickcheck2-dev libghc-regex-base-dev libghc-regex-compat-dev  libghc-regex-posix-dev libghc-stm-dev libghc-syb-dev  libghc-text-dev  libghc-transformers-dev  libghc-xhtml-dev libghc-zlib-dev

The two items missing from this are the haskell-platform-doc and haskell-platform-prof packages, for obvious reasons.

Hopefully, the Ubuntu devs fix the incompatibility issue soon.

On that note:

In addition: I unfortunately don't have the reputation to leave this as a comment on this StackExchange site, but that is the most appropriate place.

There is a bug on Launchpad for all of this, but it isn't getting much attention. Please visit this and mark it as affecting you if you landed on this page because Ubuntu 13.04's Haskell packages are hosed:

https://bugs.launchpad.net/ubuntu/+source/haskell-platform/+bug/1047678

Hopefully a mod will take this answer and make it into a comment, where it belongs. Sorry - I just don't have the reputation on askubuntu yet!