doctest + libghc-lens-dev (and other debian haskell libs I guess, on ghc8/testing) = unhandled ELF relocation(RelA) type 42
very simple testfile FooBar.hs as follows:
--------------------
{-# LANGUAGE TemplateHaskell #-}
module FooBar where
import Control.Lens
data FooBar =
Foo
| Bar
makeLenses ''FooBar
--------------------
I have libghc-lens-dev, doctest, and libghc-doctest-dev installed
loading the above in ghci works fine
rx@laptop ~ $ ghci FooBar.hs
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rx/cfg/hs/dot-ghci
[1 of 1] Compiling FooBar ( FooBar.hs, interpreted )
Ok, modules loaded: FooBar.
*FooBar >
trying to run doctest on FooBar results in
rx@laptop ~ $ doctest FooBar.hs
doctest: /usr/lib/haskell-packages/ghc/lib/x86_64-linux-ghc-8.0.1/lens-4.14-9dVzUyOAXSjIX3UgJ3NnoU/libHSlens-4.14-9dVzUyOAXSjIX3UgJ3NnoU.a: unhandled ELF relocation(RelA) type 42
doctest: Could not on-demand load symbol 'lenszm4zi14zm9dVzzUyOAXSjIX3UgJ3NnoU_ControlziLensziTH_makeLenses_closure'
doctest:
ByteCodeLink.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
lenszm4zi14zm9dVzzUyOAXSjIX3UgJ3NnoU_ControlziLensziTH_makeLenses_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
rx@laptop ~ $
on ghc 7.10.3 I don't have these problems:
rx@softland ~ $ doctest --version
doctest version 0.11.0
using version 7.10.3 of the GHC API
using /usr/bin/ghc-7.10.3
rx@softland ~ $ doctest FooBar.hs
Examples: 0 Tried: 0 Errors: 0 Failures: 0
rx@softland ~ $
not sure what is causing these issues, and how to handle them (work around them) properly:
have tried various things, like eg "-opta-Wa,-mrelax-relocations=no"
as suggested in https://github.com/DanielG/ghc-mod/issues/762
with no luck so ar
purging libghc-doctest-dev and instead cabal installing lens from
hackage resulted in other similar relocation(RelA) type 42 problems,
if I remember right, and is just not feasible for my larger projects
(want to rely on debian haskell packages in as much as possible)
Can anyone confirm these issues, has a solution maybe?
Thanks
Andreas
Reply to: