Can't use home-grown packages with ghci on Mac OS X

Mark Tullsen tullsen at galois.com
Fri Apr 30 17:08:17 EDT 2004


Platform: Mac OS X (10.3.3)
   (works fine on Linux)

Ghc Version: 6.2.1
   (same error with both
     the binary built by Wolfgang Thaller
     and version built from source using darwinports)

gcc version: 3.3

Problem:
   ghci doesn't work with user generated packages.

Details:

   While trying to track down why I'm getting this error message for
   a user-built package (which seems a little suspicious):

     ghci -package galois
        ___         ___ _
       / _ \ /\  /\/ __(_)
      / /_\// /_/ / /  | |      GHC Interactive, version 6.2.1, for 
Haskell 98.
     / /_\\/ __  / /___| |      http://www.haskell.org/ghc/
     \____/\/ /_/\____/|_|      Type :? for help.

     Loading package base ... linking ... done.
     Loading package haskell98 ... linking ... done.
     Loading package lang ... linking ... done.
     Loading package concurrent ... linking ... done.
     Loading package QuickCheck ... linking ... done.
     Loading package readline ... linking ... done.
     Loading package unix ... linking ... done.
     Loading package posix ... linking ... done.
     Loading package util ... linking ... done.
     Loading package network ... linking ... done.
     Loading package net ... linking ... done.
     Loading package galois ...

     GHCi runtime linker: fatal error: I found a duplicate definition 
for symbol
        __module_registered
     whilst processing object file
        /Users/tullsen/r/gd/src/build/lib/galois.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.

   I created a trivial package and now I get the following (bus error):

     $ ghci -package mytest
        ___         ___ _
       / _ \ /\  /\/ __(_)
      / /_\// /_/ / /  | |      GHC Interactive, version 6.2.1, for 
Haskell 98.
     / /_\\/ __  / /___| |      http://www.haskell.org/ghc/
     \____/\/ /_/\____/|_|      Type :? for help.

     Loading package base ... linking ... done.
     Loading package mytest ... Bus error

In both of these cases, I can compile, link, and run without problems.
My files are as follows (also attached as tar file):

------- Makefile -------
libmytest.a: Test.hs
         ghc -package-name mytest -c Test.hs
         rm libmytest.a
         ar qvs libmytest.a Test.o

install: libmytest.a mytest.pkg
         rm mytest.o  # -g not updating this
         ghc-pkg -u -g < mytest.pkg
         ghc-pkg -s mytest

testghci:
         ghci -package mytest Main.hs

testghc:
         ghc -o main -package mytest Main.hs

------- Test.hs -------
module Test where

succ2 :: Int -> Int
succ2 x = x + 2

------- Main.hs -------
module Main where
import Test

main = print $ succ2 0

------- mytest.pkg -------
Package { name = "mytest",
           import_dirs  = ["${PWD}"],
           source_dirs  = [],
           library_dirs = ["${PWD}"],
           hs_libraries = ["mytest"],
           extra_libraries = [],
           include_dirs = [],
           c_includes   = [],
           package_deps = ["base"],
           extra_ghc_opts = [],
           extra_cc_opts  = [],
           extra_ld_opts  = []}

--------------------------

Thanks,

- Mark

-------------- next part --------------
A non-text attachment was scrubbed...
Name: files.tar
Type: application/x-tar
Size: 10240 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20040430/1d196a49/files.tar
-------------- next part --------------



More information about the Glasgow-haskell-bugs mailing list