Link errors when using the GHC API
Mathew Mills
mathewmills at mac.com
Wed Oct 11 15:53:00 EDT 2006
Interesting. I was unable to reproduce your problem. What platform
are you running on? Are you using a binary distribution or one you
built from source?
Seems like something didn't build right... You might use 'nm' to
examine your libHSCabal.a to see if a similarly named symbol is
present. For example, is there a leading underscore? May the
version ("m1zi1zi6") isn't present?
On Oct 11, 2006, at 12:00 PM, Bas van Dijk wrote:
> Dear GHC hackers,
>
> I would like to experiment with the GHC API. However I get link
> errors when
> using it. For example:
>
> ---------------------------------------------------------------------
> $ ghci -package ghc
> ___ ___ _
> / _ \ /\ /\/ __(_)
> / /_\// /_/ / / | | GHC Interactive, version 6.6, for
> Haskell 98.
> / /_\\/ __ / /___| | http://www.haskell.org/ghc/
> \____/\/ /_/\____/|_| Type :? for help.
>
> Loading package base ... linking ... done.
> Loading package template-haskell ... linking ... done.
> Loading package readline-1.0 ... linking ... done.
> Loading package unix-1.0 ... linking ... done.
> Loading package Cabal-1.1.6 ... linking ... done.
> Loading package regex-base-0.71 ... linking ... done.
> Loading package regex-posix-0.71 ... linking ... done.
> Loading package regex-compat-0.71 ... linking ... done.
> Loading package haskell98 ... linking ... done.
> ghc-6.6: /usr/lib/ghc-6.6/HSghc.o: unknown symbol
> `Cabalzm1zi1zi6_DistributionziPackage_a_closure'
> Loading package ghc-6.6 ... linking ... ghc-6.6: unable to load
> package
> `ghc-6.6'
> ---------------------------------------------------------------------
>
> I also get this when compiling for example the following module
> testGHC.hs:
>
> ---------------------------------------------------------------------
> module Main where
>
> import qualified GHC
> import DynFlags (defaultDynFlags)
>
> main = GHC.defaultErrorHandler defaultDynFlags $ putStrLn "Hello
> World"
> ---------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> $ ghc -package ghc --make testGHC
> [1 of 1] Compiling Main ( testGHC.hs, testGHC.o )
> Linking testGHC ...
> /usr/lib/ghc-6.6/libHSghc.a(HeaderInfo.o): In function `r6iZ_info':
> : undefined reference to
> `Cabalzm1zi1zi6_LanguageziHaskellziExtension_optional_info'
> /usr/lib/ghc-6.6/libHSghc.a(HeaderInfo.o): In function `s6r9_info':
> : undefined reference to
> `Cabalzm1zi1zi6_LanguageziHaskellziExtension_zdwshowsPrec_info'
> /usr/lib/ghc-6.6/libHSghc.a(HeaderInfo.o): In function `s6sJ_info':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziCompiler_lvl31_info'
> /usr/lib/ghc-6.6/libHSghc.a(HeaderInfo.o): In function `s6sN_info':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziCompiler_zddEq_closure'
> /usr/lib/ghc-6.6/libHSghc.a(HeaderInfo.o): In function `s6ID_0_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziCompiler_polyzugo_info'
> /usr/lib/ghc-6.6/libHSghc.a(HeaderInfo.o): In function `s6IG_0_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziCompiler_polyzugo1_info'
> /usr/lib/ghc-6.6/libHSghc.a(HeaderInfo.o):(.rodata+0x0): undefined
> reference
> to `Cabalzm1zi1zi6_LanguageziHaskellziExtension_optional_closure'
> /usr/lib/ghc-6.6/libHSghc.a(HeaderInfo.o):(.rodata+0x1cc):
> undefined reference
> to `Cabalzm1zi1zi6_LanguageziHaskellziExtension_zdwshowsPrec_closure'
> /usr/lib/ghc-6.6/libHSghc.a(HeaderInfo.o):(.rodata+0x1dc):
> undefined reference
> to `Cabalzm1zi1zi6_DistributionziCompiler_lvl31_closure'
> /usr/lib/ghc-6.6/libHSghc.a(PackageConfig.o): In function
> `s23t_1_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziPackage_a_closure'
> /usr/lib/ghc-6.6/libHSghc.a(Packages.o): In function `s77S_1_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziPackage_a_closure'
> /usr/lib/ghc-6.6/libHSghc.a(Packages.o): In function `s79E_1_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziPackage_a_closure'
> /usr/lib/ghc-6.6/libHSghc.a(Packages.o): In function `s7i7_1_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziPackage_a_closure'
> /usr/lib/ghc-6.6/libHSghc.a(Packages.o): In function `s7vI_1_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziPackage_a_closure'
> /usr/lib/ghc-6.6/libHSghc.a(Packages.o): In function `s7yi_info':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziPackage_zeze_info'
> /usr/lib/ghc-6.6/libHSghc.a(Packages.o): In function `s7GC_1_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziPackage_a_closure'
> /usr/lib/ghc-6.6/libHSghc.a(Linker.o): In function `s8TZ_1_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziPackage_a_closure'
> /usr/lib/ghc-6.6/libHSghc.a(Linker.o): In function `s8Vv_1_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziPackage_a_closure'
> /usr/lib/ghc-6.6/libHSghc.a(Finder.o): In function `s7l2_1_alt':
> : undefined reference to
> `Cabalzm1zi1zi6_DistributionziPackage_a_closure'
> collect2: ld returned 1 exit status
> ---------------------------------------------------------------------
>
> I would like to know what is causing this and how I can fix it?
> Also, should I
> file a bugreport?
>
> Greetings,
>
> Bas van Dijk
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
More information about the Glasgow-haskell-users
mailing list