Ghci fails to load modules, but ghc compiles OK

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Ghci fails to load modules, but ghc compiles OK

Colin Paul Adams
I've been using ghc 6.10.3 on 64-bit Linux to compile my application,
and it runs OK, modulo bugs.

I want to debug a problem, so I load it in ghci, but when i type main
I get:

 Loading package network-2.2.1.1 ...

GHCi runtime linker: fatal error: I found a duplicate definition for symbol
   my_inet_ntoa
whilst processing object file
   /usr/lib64/ghc-6.10.3/network-2.2.1.1/HSnetwork-2.2.1.1.o
This could be caused by:
   * Loading two different object files which export the same symbol
   * Specifying the same object file twice on the GHCi command line
   * An incorrect `package.conf' entry, causing some object to be
     loaded twice.
GHCi cannot safely continue in this situation.  Exiting now.  Sorry.

Why would ghci have a problem, but not ghc?
--
Colin Adams
Preston Lancashire
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: Ghci fails to load modules, but ghc compiles OK

Duncan Coutts-4
On Thu, 2009-10-08 at 19:27 +0100, Colin Paul Adams wrote:

> I've been using ghc 6.10.3 on 64-bit Linux to compile my application,
> and it runs OK, modulo bugs.
>
> I want to debug a problem, so I load it in ghci, but when i type main
> I get:
>
>  Loading package network-2.2.1.1 ...
>
> GHCi runtime linker: fatal error: I found a duplicate definition for symbol
>    my_inet_ntoa
> whilst processing object file
>    /usr/lib64/ghc-6.10.3/network-2.2.1.1/HSnetwork-2.2.1.1.o
> This could be caused by:
>    * Loading two different object files which export the same symbol
>    * Specifying the same object file twice on the GHCi command line
>    * An incorrect `package.conf' entry, causing some object to be
>      loaded twice.
> GHCi cannot safely continue in this situation.  Exiting now.  Sorry.
>
> Why would ghci have a problem, but not ghc?

Because the system linker does not care about duplicate definitions for
symbols. It just merrily picks the first one and resolves all references
to point that first one. The GHCi linker is a tad more careful.

What you're probably doing is loading two versions of the network
package (eg indirectly as a dependencies of other packages) and they
both have an unversioned C symbol in them. The Haskell symbols are all
versioned which is why they do not clash.

Duncan

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users