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

Henning Thielemann schlepptop at henning-thielemann.de
Wed Oct 13 15:28:49 EDT 2010


Andy Stewart schrieb:
> 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'

Often these linker problems arise if A was altered and recompiled and
not all depending parts of B were recompiled. However, 'cabal install'
which in turn calls 'ghc --make' should automatically find and compile
the affected modules of B. Maybe it fails in trying to do so. I would
try to remove dist/build of packages A and B and then compile and
install the packages again.



More information about the Haskell-Cafe mailing list