[Haskell-cafe] more on my ghc package issues

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Apr 13 05:54:35 EDT 2008

On Sat, 2008-04-12 at 23:33 -0500, Galchin, Vasili wrote:

> 2) This strongly looks like the package database manager, i.e.
> ghc-pkg. Source please so I can understand where this d*amn "unknown
> package: unix-" message is coming from and why?

Yes, ghc/ghc-pkg is giving this message because you're trying to use a
package that depends on a package that you unregistered. In your case,
you unregistered unix- but process- depended on that.
Cabal depends on process- which means you now cannot runghc
Setup.hs scripts because they all import Cabal.

Look at the output of ghc-pkg list. It marks in {} the packages that are
broken due to missing dependencies.

Remember you also have two package databases, the per-user one and the
global one. The per-user one is stored under ~/.ghc  You can see the
exact path in the ghc-pkg list output. The packages from the user db
mask those from the global db, so if you have messed up the per-user one
then you will still get problems even if you reset the global one to
default. If you're just trying to get back to a known state then you can
delete the per-user ghc package db. ghc-pkg will re-create it next time
you register a package as a user.

> 3) Serious rant mode on ... I am a computer industry veteran(decades)
> who is trying to convince, coggle, etc. younger colleagues about the
> usefulness of FPLs for correctness, etc, and then => "unknown
> package ....".

The error messages from ghc-pkg are not very helpful and it does not
prevent you from removing packages which other packages still depend on.
The best advice at the moment is, don't un-register packages, at least
not without considering what other packages still depend on them.
There's no easy way of doing a reverse dependency lookup I think yet via
ghc-pkg. You can see direct dependencies, eg
$ ghc-pkg field containers depends
depends: base- array-

As it happens, the latest version of Cabal gives a much better error
message in the case that you try to configure a package that depends on
a broken package. It says exactly which package is broken due to which
missing dependency.

In this case we'd get a message like:
        The following installed packages are broken because other
        they depend on are missing. These broken packages must be
        before they can be used.
        package process- is broken due to missing package unix-

It would be nice if ghc/ghci/runghc could give a similarly helpful error


More information about the Glasgow-haskell-users mailing list