[Haskell-cafe] How to fix "undefined reference" error with getDataDir?

Andy Stewart lazycat.manatee at gmail.com
Mon Oct 11 06:20:44 EDT 2010


Hi all,

I have two package A and B, and B depend A.

I use below code snippets in package A:

------------------------------> code start <------------------------------
...
import Paths_manatee_ircclient
import System.FilePath
...
  dir <- getDataDir
  let imagePath imageName = dir </> "icons" </> (imageName ++ ".png")
...
------------------------------> code end   <------------------------------

Anyway, package A compile fine, but when i compile package B, i got
below error:

------------------------------> error start <------------------------------
Linking dist/build/manatee/manatee ...
/home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): In function `s6sP_info':
(.text+0x3bea): undefined reference to `manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir3_closure'
/home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): In function `s6sP_info':
(.text+0x3bf0): undefined reference to `manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir2_closure'
/home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): In function `s6Uf_info':
(.text+0x560f): undefined reference to `__stginit_manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_'
/home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): In function `r5Mp_closure':
(.data+0x9d8): undefined reference to `manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir3_closure'
/home/andy/.cabal/lib/manatee-ircclient-0.0.1/ghc-6.12.3/libHSmanatee-ircclient-0.0.1.a(Smile.o): In function `r5Mp_closure':
(.data+0x9e0): undefined reference to `manateezmircclientzm0zi0zi1_Pathszumanateezuircclient_getDataDir2_closure'
collect2: ld returned 1 exit status
cabal: Error: some packages failed to install:
manatee-0.0.1 failed during the building phase. The exception was:
ExitFailure 1
------------------------------> error end   <------------------------------

How to fix above error? 

Thanks!

  -- Andy
  

Below is .cabal file for package A:

------------------------------> A.cabal start <------------------------------
name:			manatee-ircclient
version:		0.0.1
Cabal-Version:	>= 1.6
license:		GPL-3
license-file:	LICENSE
copyright:		(c) 2009 ~ 2010 Andy Stewart
synopsis:		IRC client extension for Manatee.
description:    manatee-ircclient is IRC client extension for Manatee (Haskell/Gtk+ Integrated Live Environment)
author:			Andy Stewart
maintainer:		Andy Stewart <lazycat.manatee at gmail.com>
stability:		provisional
category:		Development, Other

tested-with:	GHC==6.12.3
build-type:		Simple
extra-source-files: Setup.lhs

data-dir: icons
data-files: angry.png
            confused.png
            crying.png
            embarrassed.png
            inlove.png
            kiss.png
            sleepy.png
            sad.png
            laugh.png
            smile.png
            surprised.png
            tired.png
            tongue.png
            whistling.png
            wink.png

Library
     build-depends: base >= 4 && < 5, manatee-core >= 0.0.1, dbus-client >= 0.3 && < 0.4, stm >= 2.1.2.0,
                    containers >= 0.3.0.0, gtk-serialized-event >= 0.11.0, gtk >= 0.11.0, 
                    text >= 0.7.1.0, bytestring >= 0.9.1.5,
                    dbus-core, template-haskell, gtksourceview2 >= 0.11.0, unix >= 2.4.0.0,
                    network, groom, fastirc >= 0.2.0, split >= 0.1.2, nano-md5 >= 0.1.2, filepath,
                    regex-posix >= 0.94.1, array >= 0.3.0.0, GoogleTranslate >= 0.0.3, utf8-string, mtl, Cabal
     exposed-modules:
       Manatee.Extension.IrcClient
       Manatee.Extension.IrcClient.Types
       Manatee.Extension.IrcClient.DBus
       Manatee.Extension.IrcClient.Daemon
       Manatee.Extension.IrcClient.HighlightNick
       Manatee.Extension.IrcClient.IrcBuffer
       Manatee.Extension.IrcClient.IrcView
       Manatee.Extension.IrcClient.Smile
     other-modules:							
     extensions:
     ghc-options: -O -fwarn-unused-matches -fwarn-unused-binds -fwarn-unused-imports -fwarn-overlapping-patterns -fwarn-duplicate-exports -threaded -fwarn-unrecognised-pragmas -fwarn-hi-shadowing 
     
Executable manatee-irc-daemon
     main-is: Main.hs

     ghc-options: -threaded 
------------------------------> A.cabal end   <------------------------------



More information about the Haskell-Cafe mailing list