
Hi all, I'm something of a Haskell newbie, and this is my first post to this list. I'm trying to do some very basic things with graphs, but can't get started with Data.Graph. In particular, linking fails - I'm wondering if something's wrong with my install. (For the record: ghc-6.4 compiled/installed fresh today on gentoo linux - it _looks_ OK to my Haskell-untrained eyes). Here follows a small example which I believe should compile just fine: ---- Code begins "Main.hs" module Main where import Data.Graph.Inductive import System.IO main :: IO () main = putStrLn "Hello, world!" ---- Code ends As you can see, this basically does nothing! Unfortunately, here's what happens: [csandy@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). If anyone can shed any light on this, or tell me what stupid thing I'm doing wrong, I'd really appreciate it. Many thanks, -Andy -- Andy Gimblett Computer Science Department University of Wales Swansea http://www.cs.swan.ac.uk/~csandy/

On 7/15/05, Andy Gimblett
Hi all, [snipped] Unfortunately, here's what happens:
[csandy@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).
Andy, 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: http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html To see what packages are available: $ ghc-pkg list To get details about the fgl package: $ ghc-pkg describe fgl Josh

On Fri, Jul 15, 2005 at 10:42:11AM -0700, Josh Hoyt wrote:
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.
*slaps forehead* Of course! I remember reading this now, but I had forgotten about it. And I've already come across this requirement in the past with Parsec, so I really should have thought of it... Many thanks for your help! -Andy -- Andy Gimblett Computer Science Department University of Wales Swansea http://www.cs.swan.ac.uk/~csandy/

On Fri, Jul 15, 2005 at 07:13:53PM +0100, Andy Gimblett wrote:
On Fri, Jul 15, 2005 at 10:42:11AM -0700, Josh Hoyt wrote:
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.
*slaps forehead*
Of course! I remember reading this now, but I had forgotten about it. And I've already come across this requirement in the past with Parsec, so I really should have thought of it...
Many thanks for your help!
You won't have to add "-package fgl" if you compile with --make: ghc --make -o Main Main.hs Best regards Tomasz

A.M.Gimblett:
Hi all,
I'm something of a Haskell newbie, and this is my first post to this list.
I'm trying to do some very basic things with graphs, but can't get started with Data.Graph. In particular, linking fails - I'm wondering if something's wrong with my install. (For the record: ghc-6.4 compiled/installed fresh today on gentoo linux - it _looks_ OK to my Haskell-untrained eyes).
Note that Data.Graph is different to Data.Graph.Inductive: module Data.Graph: -- A version of the graph algorithms described in: -- -- /Lazy Depth-First Search and Linear Graph Algorithms in Haskell/, -- by David King and John Launchbury. module Data.Graph.Inductive: -- Inductive.hs -- Functional Graph Library -- -- (c) 1999-2005 by Martin Erwig [see file COPYRIGHT] The first lives in package `base', the second in package `fgl'. -- Don
participants (4)
-
Andy Gimblett
-
dons@cse.unsw.edu.au
-
Josh Hoyt
-
Tomasz Zielonka