Spork Code

Code. Randomness. Sporks.

Installing the Haskell Platform in Ubuntu

with 24 comments

After my previous article about installing Haskell’s Cabal package in Ubuntu, I decided to do a bit more research on using Haskell in Ubuntu. It turns out that the debian packages in the Ubuntu repositories for Haskell and GHC are hopelessly out of date, excluding not only the added functionality of new releases, but also the Haskell Platform, which is effectively an extended set of standard libraries surrounding Haskell. Funnily enough, the Haskell platform actually includes Cabal, which effectively makes my previous post useless. In its stead, I present to you a guide on installing GHC and the Haskell platform on your Ubuntu system (though these steps should work equally well on any Linux system with apt-get as a package manager).

First things first, lets get the dependencies out of the way.

sudo apt-get install libedit2 libedit-dev freeglut3-dev libglu1-mesa-dev

Now let’s remove any haskell packages we may have installed, as these will cause conflicts.

sudo apt-get autoremove ghc6

Note that if you installed cabal as per my previous post, you can remove the executable from your $PATH by executing the following:

sudo rm /usr/local/sbin/cabal 

This will not delete the executable, which is stored in $HOME/.cabal/bin/. This just removes the sym-link that was in your $PATH.

Next, lets grab the source for GHC 6.10.3 (which is required to build the Haskell Platform)

wget http://haskell.org/ghc/dist/6.10.3/ghc-6.10.3-i386-unknown-linux-n.tar.bz2

and untar it.

tar -xvvf http://haskell.org/ghc/dist/6.10.3/ghc-6.10.3-i386-unknown-linux-n.tar.bz2

next, lets configure it and build it:

cd ghc-6.10.3/
./configure 
sudo make install

After this, installing the Haskell Platform is just more of the same:

#grab the tarball
wget http://hackage.haskell.org/platform/2009.2.0.1/haskell-platform-2009.2.0.1.tar.gz

# untar it
tar -xvvf http://hackage.haskell.org/platform/2009.2.0.1/haskell-platform-2009.2.0.1.tar.gz


# ... and install it.
cd haskell-platform-2009.2.0.1/
./configure 
make 
sudo make install

Along the way, the install scripts for the Haskell Platform will give you prompts for the next step to take.

Enjoy your Haskell Platform, and happy developing!

Advertisements

Written by John Gunderman

July 11, 2009 at 6:16 pm

Posted in Uncategorized

Tagged with , ,

24 Responses

Subscribe to comments with RSS.

  1. […] Installing the Haskell Platform in Ubuntu […]

  2. I also had to install libgmp3-dev to get haskell-platform to configure.

    David

    July 13, 2009 at 5:09 pm

    • I also had to install libgmp3-dev:
      sudo apt-get install libgmp3-dev

      td

      August 1, 2009 at 2:29 am

  3. On 64bit Ubuntu Jaunty I ran into a “missing” libgmp.so.3 problem when configuring and making ghc.

    Well, actually the 32bit Version of the lib is missing because the ghc src comes with some 32bit binaries.

    It’s easily fixed using the instructions in http://forums.devkitpro.org/viewtopic.php?f=2&t=59

    Mike

    September 30, 2009 at 4:28 am

  4. Thanks! I thought I would be stuck on 6.8.3 forever 🙂

    I had a problem with the sudo make install, though:
    Error:
    The mtl-1.1.0.2/Setup script does not exist or cannot be run

    I found a resolution at: http://trac.haskell.org/haskell-platform/ticket/84

    Chris

    October 30, 2009 at 4:47 pm

  5. Thanks for putting this together, you just saved me a few hours of trial and error.

    Luis

    November 12, 2009 at 8:17 am

  6. When running the haskell-platform install, I get:

    Installing GLUT-2.1.1.2…

    Error:
    The GLUT-2.1.1.2/Setup script does not exist or cannot be run
    make: *** [install] Error 2

    **** Installation failed. Aborting package creation.

    Restoring overwritten files from backup…OK

    Cleaning up…OK

    Bye.

    Help appreciated. Which package may I be missing? This is 64-bit ubuntu 9.10.

    Albert Cardona

    December 19, 2009 at 10:25 am

  7. Just tried doing this with ghc-6.1.04 (which is needed for the current haskell platform), and when I try to install haskell-platform, I get this:

    “Setup: The program happy is required but it could not be found”

    This on Kubuntu 8.10. Isn’t happy *part* of the haskell platform?

    James Britt

    January 22, 2010 at 10:41 am

  8. Now, how can I start programming in haskell in the terminal?

    yrazes

    August 22, 2010 at 9:20 pm

    • ghci enables prelude prompt; but I don’t know how to create a table in haskelldb to establish the connection with postgres

      yrazes

      August 22, 2010 at 9:24 pm

    • use gedit to make your programs and save them as a “.hs” file. Then run ghc in the terminal and use :load to test the program and use it!! hope that helps.

      Adam

      March 18, 2011 at 9:07 pm

  9. […] directory, gmp library, home, ld library I am following the instructions https://sporkcode.wordpress.com/2009/07/11/installing-the-haskell-platform-in-ubuntu/ for installing GHC in Ubuntu. And I want install it in my home directory. I have successfully […]

  10. hey man! everything went just fine until i tried running the configure file in the haskell platform. it gives me this error:
    checking ghc actually works… no
    configure: error: Your installation of ghc does not appear to work.
    It cannot compile a simple program (see config.log for the details).
    If you installed ghc from a generic binary tarball then it is worth
    checking that you have the ‘gmp’ C library and header files installed.
    (On debian-based systems this package is called libgmp3-dev.)

    Any help would be useful.
    Regards,

    João Rebelo

    JRebelo

    April 5, 2011 at 8:09 am

    • Have you checked that you have libgmp3-dev installed?

      If you are running a debian based system, you can run

      $ sudo apt-get install libgmp3-dev

      You can also download and install gmp from here: http://gmplib.org/

      John Gunderman

      April 5, 2011 at 8:24 am

  11. I also had to install zlib1g-dev with
    sudo apt-get install zlib1g-dev
    and only then I was able to configure haskell-platform

    Vuk Stanković

    May 22, 2011 at 2:48 am

  12. Just writing to say thanks.

    Pat

    July 6, 2011 at 4:33 pm

  13. Very useful, thanks. As other commenters, I also had to install these 2 packages:

    zlib1g-dev
    libgmp3-dev

    You might wish to add that to the post.

    Rafael

    August 5, 2011 at 12:59 am

  14. I keep getting this error:checking for path to top of build tree… ./configure: line 1932: utils/pwd/pwd: No such file or directory
    configure: error: cannot determine current directory
    Any ideas how to fix this?

    Mel

    June 6, 2012 at 2:38 am

    • Same problem! Installing libgmp3-dev and zlib1g-dev didn’t help either.

      Sam G

      March 5, 2013 at 9:20 am

  15. I don’t think the tar command needs http:// – the file is local, we fetched it with wget…

    bellringer187868

    December 23, 2012 at 8:09 pm

  16. sudo apt-get install haskell-platform

    Herp

    July 10, 2014 at 3:47 pm

  17. Thanks

    Stanko

    September 24, 2014 at 11:21 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: