logo       

Can't use home-grown packages with ghci on Mac OS X: msg#00008

lang.haskell.glasgow.bugs

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

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

Attachment: files.tar
Description: Unix tar archive


_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise