[Haskell-beginners] GHC-generated executables size

Aleksandar Dimitrov aleks.dimitrov at googlemail.com
Sat Oct 16 06:43:59 EDT 2010


Hi Christian,

> I was playing around with ghc again, and I was wondering what makes
> the executables so large and how I could make them smaller (strip works,
> but is there anything more I can do?)
> More specifically, I am compiling a program that uses the GTK+ bindings,
> HDBC, and some things from Prelude.
> The program simply displays a window, and reads and writes values
> from/into a data base file. Not much, really.
> Anyway, the program size is 20MB without stripping, and 10MB after
> stripping ...

GHC links statically. There is some effort to bring dynamic linking to GHC:
http://hackage.haskell.org/trac/ghc/wiki/SharedLibraries/PlatformSupport?redirectedfrom=DynamicLinking

You'll have to ask more knowledgeable people about its status and if it's  
recommended for current projects. Since the GTK libraries are so vast,  
even including one call (which forces the libs to be linked into the  
executable) will dramatically increase the statically linked executable's  
size.

Regards,
Aleks


More information about the Beginners mailing list