[Haskell-beginners] about installation of Haskell

Dave Bayer bayer at cpw.math.columbia.edu
Thu Mar 18 11:07:51 EDT 2010


On Mar 18, 2010, at 5:25 AM, Yitzchak Gale wrote:

> You seem to be trying to compile the GHC compiler manually.
> For most platforms, that is not the recommended way to start
> out. It is somewhat complicated, takes a long time, and is not
> even all that you need. There is probably a much easier way,
> depending on what operating system you are using.

If I may offer a contrary opinion for others reading this, one could be a "beginner at Haskell" but otherwise confident with their system, and have a strong preference for manual installs.

Across the board with Mac OS X and various flavors of Linux, my experience with package managers has been that I would have saved time if I'd never heard of them. Telling other people to use such a package manager is like telling them to use your neighborhood fishmonger. If enough people actually take this advice, maybe the fish will stop smelling! ;-)

I'll set up the core part of a Linux release, and various standard components I don't really care about, using the package management system. I care about Haskell. There's no way I'd let a package manager anywhere near Haskell. I've been building from source since I was a Haskell (and Linux) beginner. One needs to understand one's axe. If there's a problem one doesn't understand at the core of one's system, it will surely fester and come back to haunt you.

There's a "rows vs columns" organizational issue with installing any package one cares about. For a Unix distribution, it makes sense to spread out pieces into /usr/local/lib and /usr/local/bin and so forth. One keeps a single version of these components, and tries never to look at them. But did any early adopter of GHC 6.12 want to give up on GHC 6.10? Does anyone really want to type sudo to a pile of scripts one doesn't understand, and hasn't read? For a component one cares about it, it is better to isolate all files in a single directory.

Alas, no canned distribution works this way for global installs, to my knowledge. I'm not sure of the psychology at play here. This is another assumption I'd like to see questioned.

This is one beef I have with package managers and binary installers. For example, to bootstrap a build from source on OS X Snow Leopard, I needed to use the binary installer, which made some unconventional and undocumented choices for file locations. To monitor this (a variant should work on any Unix) I create a file called "timestamp" before such an install, and afterwards run the Unix command

sudo find -x / -newer timestamp -print >snapshot.txt

This documents every file that was created or changed across the system during the install. There's a bunch of line noise one gets used to (no system is quiet) but one can easily use this information to rip an install cleanly back out after bootstrapping is complete.

My /usr/local includes

lrwxr-xr-x   1 root  wheel    10 Jan 11 21:05 ghc -> ghc-6.12.1
drwxr-xr-x   7 dave  wheel   238 Dec 25 07:46 ghc-6.10.4
drwxr-xr-x   7 dave  wheel   238 Jan  8 18:52 ghc-6.12.1

The symbolic link points to the currently selected active GHC directory, which is **user writeable** so I don't have to sudo to install into it. This gives me assurance that I'm not writing files elsewhere in the system; my install script doesn't even have permission. This also lets me toggle versions of GHC. I use this same approach to every system like GHC that I install for myself.

I then need to put /usr/local/ghc/bin on my path. That's ok; as I said, I care about GHC.

To build this way, use the --prefix flag for ./configure, as in

./configure --prefix=$prefix
make -j3
make install
make clean






More information about the Beginners mailing list