[Haskell-cafe] Haskell plugin dynamic linking issue

Harendra Kumar harendra.kumar at gmail.com
Mon Apr 10 18:41:10 UTC 2017

You can try using ghc directly (instead of cabal) so that you have full
control over what flags are passed, like this:

ghc -fPIC -dynamic -package xx -c plugin.hs
ld -shared -Bsymbolic -L<path to rts lib> -lHSrts-ghc8.0.2 -o plugin.so

If this works then you can find what is wrong/different with your cabal
setup by using verbose flags and looking at what is being passed to ghc.


On 10 April 2017 at 18:14, Lana Black <lanablack at amok.cc> wrote:

> Hello,
> I'm working on a Haskell plugin (a shared library) for a C program. When
> I load the plugin, I get the following error:
> > ./open
> dlopen() failed:
> /usr/lib64/ghc-8.0.2/ghc-prim-
> undefined symbol: stg_thawArrayzh
> open is just a testing wrapper around dlopen(). I found out that
> stg_thawArrayzh symbol is exported by the rts, and my library isn't
> linked to it, and neither is ghc-prim. How do I fix that? Adding
> -lHSrts-ghc8.0.2 to ld-options doesn't seem to have any effect.
> Thanks.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170411/30870e00/attachment.html>

More information about the Haskell-Cafe mailing list