Haskell Plugins and cabal sandbox
Asked Answered
W

1

6

So, I'm trying to use the Plugins package to dynamically load a haskell function from a source file. The source file depends on a package foo with module Foo.Bar. I'm running my project in a Cabal sandbox, where I have foo installed. Both my main program, and the module I'm loading with plugins, depend on foo. I always get one of the following two errors:

When I have foo installed in ~/.cabal, I get the error:

GHCi runtime linker: fatal error: I found a duplicate definition for symbol
  aizmvszmaizmlibzm0zi1_FooziBar_zdfTypeableBazzuds2_closure
whilst processing object file
  /home/joey/.cabal/lib/foo-0.1/ghc-7.6.3/HSfoo-0.1.o
This could be caused by:
  * Loading two different object files which export the same symbol
  * Specifying the same object file twice on the GHCi command line
  * An incorrect `package.conf' entry, causing some object to be
    loaded twice.
GHCi cannot safely continue in this situation.  Exiting now.  Sorry.

When I don't have it installed in ~/.cabal, I get a standard "module not found" error. And when I don't have it installed in my sandbox, I get the same module not found error trying to compile my main program code.

The plugins documentation is scarce at best. Any thoughts on how to solve this?

Whoa answered 21/1, 2014 at 4:58 Comment(3)
It would be helpful if you gave a minimum, compiling, example.Reimpression
I'll do this tomorrow. It's currently inside of a rather large yesod project, I'll need to extract the minimal part.Whoa
I'm having trouble coming up with a minimal example. Any ideas?Whoa
W
1

I got this working by using System.Plugins.Make to actually do the compliation, instead of relying on pre-existing object files. Not a complete solution, doesn't explain the problem, but it works for me for now.

Whoa answered 27/1, 2014 at 6:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.