[Haskell-cafe] Problem linking against Data.Graph

Josh Hoyt joshhoyt at gmail.com
Fri Jul 15 13:42:11 EDT 2005

On 7/15/05, Andy Gimblett <A.M.Gimblett at swansea.ac.uk> wrote:
> Hi all,
> [snipped] Unfortunately, here's
> what happens:
> [csandy at cspcag spa_haskell] ghc -o Main Main.hs
> Main.o(.text+0x145): In function `__stginit_Main_':
> : undefined reference to `__stginit_DataziGraphziInductive_'
> collect2: ld returned 1 exit status
> I get similar errors whatever I try to do with Data.Graph.  Trying to
> compile ghc-6.4/libraries/fgl/test/test.hs (from the source tree)
> gives me multiple errors of the above type (though not identical).


I'm pretty new myself, but I ran into a similar problem using a
different library. The problem is that some parts of the library are
hidden by default, and you have to tell ghc to include them. To solve
your immediate problem, add "-package fgl" to your compilation line.

This page has all of the nitty-gritty details:

To see what packages are available:
$ ghc-pkg list

To get details about the fgl package:
$ ghc-pkg describe fgl


More information about the Haskell-Cafe mailing list