Skip to content

Installation of GHC 6.12.1 on Ubuntu 9.10

Neurogami edited this page Sep 13, 2010 · 20 revisions

But first ….

GHC 6.12 is new. As of 6 April 2010 it’s part of the Haskell Platform, but there are still some quirks (e.g. it appears that the Snow Leopard install will not create shared objects).

While the Haskell community is doing a good job of making the installation and use of Haskell increasingly easier, things are still rough on the cutting edge. The Haskell Platform, for example, is still primed for GHC 6.10.

But things change. What did or did not work one day may be quite different the next. As you read these notes, please keep in mind that they may age poorly. Do a bit of Googling to see what’s new before jumping in with the steps described here. Long-term, GHC 6.12 and all it’s playmates is expected to Just Work. In the meantime, some workarounds are needed.

If you find that any information here is wrong or out-of-date, please add a comment.

Getting to GHC 6.12

Hubris requires GHC 6.12.n. The current n is 1.

The current Ubuntu is 9.10, and the apt-get repos only offer 6.10.

That’s OK, because (at the moment), there is a required lib that only installs under GHC 6.10.

Here’s what seems to work, to get a proper GHC 6.12 running that works nice with Hubris:

  • Install GHC 6.10 via apt-get
  • Install cabal and cabal-install from source packages.
    • See http://www.haskell.org/cabal/download.html

(Note: That page does not link to the latest cabal-install, a fact I did not realize until later in my install process. GHC 6.12 requires cabal-install version 0.8.×. Oddly enough, the GHC 6.12 page links to a page that also does not link to the correct cabal-install. :(. You can find it on HackageDB Whether it is good or bad to just install this latest version of cabal-install with GHC 6.10, I do not know. See below for what was done.)

When you install cabal-install you’ll discover that is has some prerequisite, such as the Haskell zlib and HTTP packages.

HTTP has it’s own prerequisites, and they are fussy about order. So you really need to install:

  • zlib
  • mtl
  • parsec
  • network
  • HTTP

Look for these on HackageDB

Note

The cabal-install source comes with a script called bootstrap.sh. This is supposed to download and install the required libs.
It was not working for me (James Britt), and I had to manually install some packages (such as parsec).

NOTE: On trying this again later on I edited bootstrap.sh so that it passed --user as some extra params to Setup.hs and it worked much better. Still had to install time by hand, though, then re-run bootstrap.sh.

Here’s the catch: cabal is similar to Ruby’s rubygems and allows for installing packages either for system-wide use, or for the current user.

Because I’ve found myself have to build/rebuild/remove, etc packages while trying out various GHC setups, I’ve come to prefer having all packages installed for myself (user), and not system-wide. The bootstrap,sh script complains about missing parsec. I had installed that by hand, and installed it using the —user option, but bootstrap.sh did not find it. So I installed all the required libraries by hand, and then installed cabal-install by hand as well.

BTW, here’s something you will eventual get to know quite well:


runhaskell  Setup.hs clean
runhaskell  Setup.hs configure --user
runhaskell  Setup.hs build
runhaskell  Setup.hs install

You’ll need this for each package you install from source.

If you, dear reader, are more familiar with cabal and the whole user v system thing, please add more detail or correct any errors or suggest something else.

Also note that some of these packages may require that you have some Ubuntu devel libs and headers in place.

Preparing for Hubris-Haskell

The Ruby Hubris code relies on the Haskell code, Hubris-Haskell

That code depends on having GHC 6.12 and the c2hs package.

Right now (17 Feb 2010) c2hs does not build under GHC 6.12.1. Very sad. This will no doubt be corrected, but for the time being you need to install this package before upgrading to GHC 6.12

The cabal binary gets installed to PATH=$PATH:~/.cabal/bin (NOTE: It does if you use the --user option …)

You need to update your PATH value to account for this


PATH=$PATH:~/.cabal/bin
export PATH

With your fresh cabal install in place, run cabal update

(You may find that there is a newer version of cabal-install you can install using your new cabal.)

Now install c2hs

… but first, install language-c. But firster, install happy. Then alex

Cabal is (I think) supposed to resolve dependencies, but it seems to miss them at times. If you have trouble getting a package installed, note what dependencies it wants and grab those.

Know, too, that sometimes a package fails to install via cabal, but grabbing the package code from hackagedb and installing by hand works just fine. (Refer to the set of runhaskell Setup.hs ... steps above)

GHC 6.12

Go grab the code.

You have a choice of install binaries, or using source code. What’s the difference? That’s a good question. I believe I have this working using the binaries, but it seems that using generic binaries may not give you the best options for multicore machines. (Haskell experts, please step in!)

I believe it is safe to try either. I would suggest doing a local install to a home directory, so that if you decide to blow it away it is easier to remove.

Note: When I went ot grab the 6.12 source I saw that GHC 6.12 required cabal-install 0.8. (Not to install GHC, but once you had GHC 6.12 you would need the newer cabal-install). I opted to upgrade my cabal-install before installing GHC 6.12.1. it seems OK.

From source

Using ghc-6.12.1-src.tar.bz2, unpack the code. Rename the resulting source dir to something that identifies it as the source version (if you think you will also be trying the binary install).

I tend to make little scripts for various installs. This is one for installing GHC


make clean
sh boot
./configure --prefix=$HOME/ghc/ghc-6.12.1 --enable-shared
make -j 2

NOTE: If you copy-n-paste from this Web page then you may get borked by how this dopey Wiki software converts a double-hyphen to an em-dash character.

Note: The parameters passed to make are for the number of CPUs I have. I have not been able to find any documentation on this though.

The build takes some time. Like, a lot of some time.

YET ANOTHER NOTE: YOu may need to do sudo apt-get install libtool if you get an error about “Can’t exec libtoolize”

… then Hubris-Haskell

You’ll need to install Hubris-Haskell now

See Installing Hubris-Haskell