Cabal semantics for multiple compilers

Duncan Coutts duncan.coutts at
Sun Mar 9 15:45:10 EDT 2008

On Sun, 2008-03-09 at 12:12 +0200, Yitzchak Gale wrote:
> In anticipation of the upcoming release of the
> Mac OS X Tiger installer for GHC 6.8.2, the
> following questions arise:
> I currently have GHC 6.8.2 installed via MacPorts
> in /opt/local. When I use Cabal to install packages
> manually, they install into /usr/local. I think that
> is the correct behavior - if that package someday
> becomes a supported port, the port will install
> into /opt/local and I don't want to conflict with that.
> In general, I leave the entire /opt/local tree under
> the control of the automated port system.
> Now, what will happen when I install a second
> copy of GHC 6.8.2 into /usr/local using the installer?
> First question: What will --with-compiler=ghc-6.8.2
> now mean if I forget to specify the full path? Will Cabal
> do something reasonable and not get confused?
> (Will it not get confused if I do remember to specify
> the full path?)

It will use whichever is the ghc-6.8.2 on the $PATH. Alternatively you
can specify the full path.

It'll also look for a ghc-pkg-6.8.2 in the same directory in which it
found ghc-6.8.2 (unless you override using --with-hc-pkg=). It'll use
that to discover what packages are registered.

So it's quite possible to have multiple installations of ghc of various
versions and indeed of other Haskell implementations.

> Second question: When I install packages, both copies
> of GHC 6.8.2 will want to install them into /usr/local. Cabal
> uses directory names like "ghc-6.8.2" to keep installations
> for different compilers separate from each other. But what
> if both of the compilers are called "ghc-6.8.2"?

Then they will clash. Don't do that :-)

You can have two instances of the same version of GHC installed (though
quite why you'd want to do that I'm not sure) but you will have to
ensure that you use different places to install packages for each or
they will clash and you will get mysterious linker errors or worse.


More information about the Libraries mailing list