static linking with ghc

Tomasz Zielonka tomasz.zielonka at gmail.com
Sun Mar 27 05:40:18 EST 2005


On Sat, Mar 26, 2005 at 03:11:43PM +0100, Patrick Scheibe wrote:
> Is it possible to tell ghc to take all stuff out of the .so libs and compile 
> my source to a "all-including" executable?
> I know that ghc just calls the linker which is doing this part. The --static 
> flag for the linker just says: "take the static library if possible for 
> linking...".
> But I don't have a static version of these libs and I don't want to recompile 
> all libraries.

I often build my applications with "ghc -optl-static", which works for
me most of the time, but:
- You need to have static (.a) versions of libraries, which you
  don't have
- At least on linux the NSS (name service switch) libraries are linked
  in dynamically even in statically linked programs. If you have
  incompatible nss libraries, your programs may crash. The workaround is
  to compile glibc with "--enable-static-nss"
- There are some licensing issues with GMP

Best regards
Tomasz


More information about the Glasgow-haskell-users mailing list