GHC compiling shared library linking problem

Simon Marlow marlowsd at
Mon Oct 22 13:24:40 CEST 2012

On 17/10/2012 08:43, Richard Zetterberg wrote:
> I have two parts of my application; one which builds a cli application
> which uses my module and one which builds a shared library which uses
> the same module. I have no problems compiling my cli application. And if
> I try to compile the shared library without the foreign export and the
> functions in Shared.hs I get another linker error:
>      /usr/bin/ld: ../src/Assembly.o: relocation R_X86_64_32S against
> `stg_CAF_BLACKHOLE_info` can not be used when making a shared object;
> recompile with -fPIC
>      ../src/Assembly.o: could not read symbols: Bad value
>      	collect2: error: ld returned 1 exit status
> (I forgot to add that I'm using the haskell-platform package in Debian
> sid (unstable). Here is the package and it's dependencies:

I think you're trying to make a shared library from Haskell code, right? 
  You don't say what platform, but it looks like x86_64/Linux or maybe 
OS X.  On these platforms, code that goes into a shared library must be 
compiled with -fPIC.  You will also need to compile with -dynamic, in 
order to link against the shared versions of the RTS and the other 
Haskell libraries.


> Best regards
> Richard
> On 10/15/12 6:44 PM, Carter Schonwald wrote:
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools -
> Comment: Using GnuPG with Mozilla -
> Wh1KQtgLrfcCggfeMlA/XOtUE+pgtN66uarbi9iaqLULH4fLm/h6v12zSmaqG1uU
> XKuaIRtr886+bcFG/fXO0pW7OGbaF/w0nQN06iRqbFrce0f/U3VGHp8BqJNZFhSK
> qIHRM+WweM95LV9tgrCAeI3C2sGR4GkzhUunCCAOSZ8MfEwFxPV4OsmuCjKGcCcb
> GZXXhOynGhbLa8mg29dQNytt01AMgBBiRSWLHVFW6IfUxPk7uuQp33Q6wvjOUyA4
> kJIUz9BU9IiPUeVdO2sg+fBB1ehOV2qPiqHf0xoJ1mpH6qd3KnUcJXsXrTXK4piz
> lo2lCOlqxspBiByX4HzyLE6pA+8OZcREO5GOHo5V4iI0RQAwkjaqARAU/6VVXHC0
> fQbPJf8U1CQZZamkuoTgUfKcOHLFYIqVq9p8Ar1dykT74okAyMR+FU0ExWTbr/Xs
> 7oGD+Q44geh65FkkeLUoKIUD+aV35HQE6GL9O/OjKm1aMg3yGA5bM6UUiAw2FgqE
> jfZoHc9frO/WMP1XgEkKQjtupUCH92ol/PpyPbFJqfnxMvvvI+lYEEIL90XPudmS
> 5ygqeinIVwBKGVb6D08rLC1OzaS0dFasOjOeWYM12epbZsy9WCzIl+U14TFgy/Ze
> la4rqefI8sdBK1cQslYu
> =RN8H
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at

More information about the Glasgow-haskell-users mailing list