Weird symbol prevents GHCi from loading my package.

Simon Marlow simonmar@microsoft.com
Thu, 14 Feb 2002 14:55:48 -0000


> I built quite a big library and turned it into a package. It=20
> works fine if
> use ghc -package gtk2 Blah.hs to compile things. But when I=20
> convert all
> the libraries to object files as described in the documentation, GHCi
> refuses to load the whole machinery:
>=20
> ~/source/mogul/fpDemo:$ ghci -package gtk2 Arabic.hs
>    ___         ___ _
>   / _ \ /\  /\/ __(_)
>  / /_\// /_/ / /  | |      GHC Interactive, version 5.02.2,=20
> for Haskell
> 98.
> / /_\\/ __  / /___| |      http://www.haskell.org/ghc/
> \____/\/ /_/\____/|_|      Type :? for help.
>=20
> Loading package std ... linking ... done.
> Loading package lang ... linking ... done.
> Loading package gtk2 ...
>=20
> GHCi runtime linker: fatal error: I found a duplicate definition for
> symbol
>    gcc2_compiled.
> whilst processing object file
>    /home/as49/local/lib/gtk2hs/gtk2hs.o

I think this is due to a bug in GHCi's linker, which has been fixed post =
5.02.2.  I tripped over it recently while trying to use Gtk+HS in GHCi =
on my RedHat 7.2 box.  There are two bugs tickled by gcc 2.96: our =
linker wasn't dealing with sections with names other than the standard =
ones (.text, .data, .rodata) properly, and there was also some =
infelicities in the local-symbol handling (Julian S. can tell you more).

The workaround I used is to compile up any .c files in your package =
*without* -O, and without -g if you were also using that.

Cheers,
	Simon