[Haskell-cafe] Static Linking Problem

Ketil Malde ketil at malde.org
Tue Nov 10 16:29:26 EST 2009

MightyByte <mightybyte at gmail.com> writes:

> After a bit of googling, I came to the conclusion that I needed to
> compile it with "ghc --make -static -optl-static Foo.hs".  Using only
> "-static" or "-optl-static" by themselves did not generate a
> statically linked binary.  But when I compile with both those
> parameters I get a bunch of linker errors:
> (.text+0x59c): undefined reference to `pthread_mutex_lock'

For some reason, GHC doesn't link with the pthreads library, so you need
to compile (link) with two options: -opt-static -optl-pthread 

If I haven't seen further, it is by standing in the footprints of giants

More information about the Haskell-Cafe mailing list