Skip to content

Instantly share code, notes, and snippets.

@wting
Last active April 1, 2020 10:50
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save wting/8498731 to your computer and use it in GitHub Desktop.
Save wting/8498731 to your computer and use it in GitHub Desktop.
Installing ghc, haskell-platform, cabal-install on Ubuntu 12.04.

Choices

  1. Install ghc 7.6.3 and Haskell Platform
  2. Install ghc 7.8.4 and Cabal

Option GHC 7.6.3 + Haskell Platform

GHC 7.6.3

Install Ubuntu 12.04 depencies:

$ sudo aptitude install -y libgmp3c2

Symlink the library:

$ sudo ln -s /usr/lib/libgmp.so.3 /usr/lib/libgmp

Afterwards, download, configure, and install GHC.

$ wget https://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-x86_64-unknown-linux.tar.bz2
$ tar xvf ghc-7.6.3-x86_64-unknown-linux.tar.bz2
$ cd ghc-7.6.3
$ ./configure --prefix=/opt/ghc
$ make install      # sudo might be necessary

Add /opt/ghc/bin to $PATH.

Haskell Platform 2013.2.0.0

Install Ubuntu 12.04 depencies:

$ sudo aptitude install -y libgmp3-dev libglc-dev freeglut3 freeglut3-dev

Haskell Platform Ubuntu dependencies:

$ wget http://lambda.haskell.org/platform/download/2013.2.0.0/haskell-platform-2013.2.0.0.tar.gz
$ tar xvf haskell-platform-2013.2.0.0.tar.gz
$ cd haskell-platform-2013.2.0.0
$ ./configure --prefix=/opt/haskell-platform --enable-unsupported-ghc-version
$ make -j4
$ make install      # sudo might be necessary

Add /opt/haskell-platform/bin to $PATH.

Cabal

Cabal is included as part of Haskell Platform. Go ahead and update it:

$ cabal update && cabal install cabal-install

Some useful packages:

$ cabal install ghc-mod hoogle hlint pointfree

Option GHC 7.8.4 + Cabal

GHC 7.8.4

You cannot currently build Haskell-Platform with 7.8.4, so ignore these build instructions.

Install Ubuntu 12.04 depencies:

$ sudo aptitude install -y libgmp3-dev

Afterwards, download, configure, and install GHC. This is for the x86_64 version. For the 32 bit version please download the appropriate source from here.

$ wget https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-x86_64-unknown-linux-deb7.tar.xz
$ tar xvf ghc-7.8.4-x86_64-unknown-linux-deb7.tar.xz
$ cd ghc-7.8.4
$ ./configure --prefix=/opt/ghc
$ make install      # sudo might be necessary

Add /opt/ghc/bin to $PATH.

Cabal

If you are running Ubuntu 12.04 AMD64 you can bootstrap cabal from this binary image.

Otherwise build it from source:

$ wget http://www.haskell.org/cabal/release/cabal-1.18.1.3/Cabal-1.18.1.3.tar.gz
$ tar xvf Cabal-1.18.1.3.tar.gz
$ cd cabal-1.18.1.3
$ ./bootstrap.sh --user

Update cabal:

$ cabal update && cabal install cabal-install

Some useful packages:

$ cabal install ghc-mod hoogle hlint pointfree
@LemmingAvalanche
Copy link

Shouldn't $PATH be set to

/opt/haskell-platform-2013.2.0.0/bin

instead of

/opt/haskell-platform-2013.2.0.0/

@wting
Copy link
Author

wting commented Apr 12, 2014

Yup, thanks for catching that.

@ThomWright
Copy link

I needed to run $ sudo aptitude install -y libgmp3-dev to ./configure Haskell Platform 2013.2.0.0. Just a quick FYI :)

@wting
Copy link
Author

wting commented Jan 18, 2015

Sorry for the long response time, updated!

@LemmingAvalanche
Copy link

./bootstrap.sh --user is wrong in my case; there is no such file in the Cabal-1.18.1.3 directory (or the newer Cabal-1.22.0.0, for that matter). But there is one in directory you get if you download cabal-install-*. Is that the one you mean?

@MLabusquiere
Copy link

From the README of downloaded Cabal :

Installing as a user (no root or administrator access)

ghc --make Setup 
./Setup configure --user
./Setup build
./Setup install

@vijeth-aradhya
Copy link

This is after following GHC 7.8.4 + Cabal setup procedure
For cabal update && cabal install cabal-install, I get this error :/

Configuring cabal-install-1.24.0.2...
Failed to install cabal-install-1.24.0.2
cabal: Error: some packages failed to install:
cabal-install-1.24.0.2 failed during the configure step. The exception was:
ExitFailure 11

@rajeev02101987
Copy link

For cross compile build also we need to follow same procedure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment