[Haskell-cafe] Static Linking Problem

MightyByte mightybyte at gmail.com
Wed Nov 11 09:22:29 EST 2009

On Tue, Nov 10, 2009 at 4:29 PM, Ketil Malde <ketil at malde.org> wrote:
> 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

Excellent, that appears to have solved my problem.  It still gives me
the warning:

(.text+0x3068): warning: Using 'getaddrinfo' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking

But glibc is pretty standard, so I don't think this will be a problem
for me.  Thanks for the help.

More information about the Haskell-Cafe mailing list