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

Andy Stewart lazycat.manatee at gmail.com
Wed Oct 13 15:31:43 EDT 2010


Henning Thielemann <schlepptop at henning-thielemann.de> writes:

> 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.
Hi Henning, thanks for reply.

I have fix this problem: I forgot add 'Paths_manatee_ircclient' in
"other-modules" of A.cabal , then package A compile fine, but package B
can't found path of module ''Paths_manatee_ircclient', then link failed.

After i add "Paths_manatee_ircclient" in A.cabal, problem fix.

Cheer,

  -- Andy


More information about the Haskell-Cafe mailing list