Possible bug in GHCi archive loading:
I'm not sure if this is a bug or an error in my understanding.
In trying to work around http://hackage.haskell.org/trac/hackage/ticket/791. I forced Cabal to install the library with a dummy .o file. Opening the library with GHCi caused the error:
*Main> :m Text.Highlighting.Kate.Syntax
Prelude Text.Highlighting.Kate.Syntax> languages
Loading package array-0.3.0.2 ... linking ... done.
Loading package containers-0.4.0.0 ... linking ... done.
Loading package filepath-1.2.0.0 ... linking ... done.
Loading package parsec-2.1.0.1 ... linking ... done.
Loading package bytestring-0.9.1.8 ... linking ... done.
Loading package transformers-0.2.2.0 ... linking ... done.
Loading package mtl-2.0.1.0 ... linking ... done.
Loading package regex-base-0.93.2 ... linking ... done.
Loading package regex-pcre-builtin-0.94.2.1.7.7 ... linking ... done.
Loading package xhtml-3000.2.0.1 ... linking ... done.
Loading package highlighting-kate-0.2.8.1 ... <interactive>: mmap 0 bytes at 0x0: Invalid argument
<interactive>: Try specifying an address with +RTS -xm<addr> -RTS
So GHCi must prefer objects to archives. Fine. However, after I delete the object file totally I get this error:
Loading package highlighting-kate-0.2.8.1 ... linking ... done.
During interactive linking, GHCi couldn't find the following symbol:
highlightingzmkatezm0zi2zi8zi1_TextziHighlightingziKateziSyntax_languages_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session. Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
glasgow-haskell-bugs@haskell.org
I'm sure the symbol exists (admittedly with a _ prefix), because nm reports it in the archive:
$ nm libHShighlighting-kate-0.2.8.1.a | grep highlightingzmkatezm0zi2zi8zi1_TextziHighlightingziKateziSyntax_languages_closure
00009e24 D _highlightingzmkatezm0zi2zi8zi1_TextziHighlightingziKateziSyntax_languages_closure
I tried doing as the error suggested, and supplying a -l flag to GHCi. However, this was also unsuccessful:
mbolingbroke@equinox /usr/local/lib/highlighting-kate-0.2.8.1/ghc-7.0.1.20101215
$ ghci -L. -lHShighlighting-kate-0.2.8.1
GHCi, version 7.0.1.20101215: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Loading object (dynamic) HShighlighting-kate-0.2.8.1 ... failed.
<command line>: user specified .o/.so/.DLL could not be loaded (dlopen(libHShighlighting-kate-0.2.8.1.dylib, 9): image not found)
Whilst trying to load: (dynamic) HShighlighting-kate-0.2.8.1
Additional directories searched: .
How do I use the GHCi archive loading functionality? If it works, we could stop Cabal from generating the object files and hence close bug 791, which is preventing libraries like highlighting-kate from being installed on OS X.
Trac metadata
Trac field | Value |
---|---|
Version | 7.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |