RE: Weird symbol prevents GHCi from loading my package.

I built quite a big library and turned it into a package. It works fine if use ghc -package gtk2 Blah.hs to compile things. But when I convert all the libraries to object files as described in the documentation, GHCi refuses to load the whole machinery:
~/source/mogul/fpDemo:$ ghci -package gtk2 Arabic.hs ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 5.02.2, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help.
Loading package std ... linking ... done. Loading package lang ... linking ... done. Loading package gtk2 ...
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

On Thu, 14 Feb 2002, Simon Marlow wrote: <--snip-->
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).
I tried to build the head of GHC and it works fine the first time around. Compiling it with itself fails to build GHCi due to the new library system: /home/as49/local/bin/ghc-5.03 -DGHCI -cpp -fglasgow-exts -Rghc-timing -I. -IcodeGen -InativeGen -Iparser -iutils:basicTypes:types:hsSyn:prelude:rename:typecheck:deSugar:coreSyn:specialise:simplCore:stranal:stgSyn:simplStg:codeGen:absCSyn:main:profiling:parser:usageSP:cprAnalysis:compMan:ndpFlatten:nativeGen:ghci -package concurrent -package posix -package util -recomp -Rghc-timing -H16M -O -fvia-C -monly-3-regs -c utils/PrimPacked.lhs -o utils/PrimPacked.o utils/PrimPacked.lhs:55: Ambiguous occurrence `unsafePerformIO' It could refer to either `PrelIOBase.unsafePerformIO', imported from Foreign at utils/PrimPacked.lhs:40 or `GHC.IOBase.unsafePerformIO', imported from GlaExts at utils/PrimPacked.lhs:33 Removing the import from PrimPacked will raise a similar error somewhere else. Is there a special trick to compile 5.03? (E.g. subscribing to cvs-ghc?) Thanks, Axel.
participants (2)
-
Axel Simon
-
Simon Marlow