[Haskell-cafe] Make shared library - questions

Sergiy Nazarenko nazarenko.sergiy at gmail.com
Fri Aug 26 14:52:22 CEST 2011

Hi !

I'm trying to compile shared library. This library will use as part of
plugin for some program.
If I compile library with option -dynamic my library has links for HS
libraries like libHSbase- and so on.
But program has crashed constantly.

Is it possible to make shared library without -dynamic flag? I want to try
to make library without dependencies.

According to http://www.well-typed.com/blog/30 theoretically I can do this
but I found this impossible -
My options to compile:
ghc -O2 --make -no-hs-main -dynamic -shared -fPIC -optl '-shared' -optc
'-DMODULE=MyLib' -o MyLib.so MyLib.hs module_init.c  -optl-Wl

If I try compile without -dynamic I get error:
relocation R_X86_64_32 against
`base_GHCziConc_ensureIOManagerIsRunning1_closure' can not be used when
making a shared object; recompile with -fPIC
/usr/local/lib/ghc-6.12.3/base- could not read
symbols: Bad value
collect2: ld returned 1 exit status

My system is:
Cenos 5.6

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110826/eb8720ad/attachment.htm>

More information about the Haskell-Cafe mailing list