
I am trying to statically compile a simple haskell program so I can use it on a Linux computer without haskell and it's associated libraries. Here is a small example program that illustrates my problem:
module Main where import Network.Fancy main = do withDgram (IP "127.0.0.1" 1234) (flip send "Hello network\n")
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: /home/mightybyte/.cabal/lib/network-fancy-0.1.4/ghc-6.10.4/libHSnetwork-fancy-0.1.4.a(Fancy.o): In function `s6ks_info': (.text+0x3068): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/ghc-6.10.4/libffi.a(closures.o): In function `init_mparams': (.text+0x3e): undefined reference to `pthread_mutex_lock' /usr/lib/ghc-6.10.4/libffi.a(closures.o): In function `init_mparams': (.text+0x52): undefined reference to `pthread_mutex_unlock' /usr/lib/ghc-6.10.4/libffi.a(closures.o): In function `init_mparams': (.text+0xd3): undefined reference to `pthread_mutex_init' /usr/lib/ghc-6.10.4/libffi.a(closures.o): In function `ffi_closure_free': (.text+0x59c): undefined reference to `pthread_mutex_lock' etc... I've tried this on both Fedora and Arch Linux and I get the same error. Anyone know how to solve this problem?