Skip to content

Instantly share code, notes, and snippets.

@wting
Last active April 1, 2020 10:50
Show Gist options
  • 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
@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