[Haskell-beginners] Haskell exectuable size
Magnus Therning
magnus at therning.org
Tue Sep 3 15:59:06 CEST 2013
On Tue, Sep 03, 2013 at 03:53:12PM +0400, Dmitry Vyal wrote:
> On 09/03/2013 02:45 PM, Nathan Hüsken wrote:
> > I have written a small wxHaskell application. Since wxWidgets
> seems to be required to be linked dynamicly, I have to add the
> wxWidgets dlls. Those make a total of about 25MB, wow.
> >
> > Now the compiled exe (compiled with ghc -O2) has size 15MB.
> > In total I am at about 50Mb, which is just to much.
> >
> > Why is the exe so big?
> > Has anyone a suggestion on how to reduce the total size?
> Bindings for large C libraries contain a great number of Haskell
> wrapper functions for C functions. Looks like GHC is not terribly
> efficient in terms of size of generated code. Your tiny application
> gets statically linked with a huge haskell library which in turn
> dynamically linked with C library doing the actual work.
>
> In case you're having multiply haskell binaries using wxWidgets you
> can use GHC's dynamic linking feature. http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/using-shared-libs.html.
> This way actual binaries would be small but would have an additional
> run-time dependency.
>
> And my question. Does GHC try to exclude unused symbols from Haskell
> libraries it links to application code?
I'm under the impresssion that '--enable-split-objs' enables the
linker to exclude unused symbols/functions when linking to application
code. I may be completely wrong though.
/M
--
Magnus Therning OpenPGP: 0xAB4DFBA4
email: magnus at therning.org jabber: magnus at therning.org
twitter: magthe http://therning.org/magnus
I have steadily endeavored to keep my mind free, so as to give up any
hypothesis, however much beloved -- and I cannot resist forming one
on every subject -- as soon as facts are shown to be opposed to it.
-- Charles Darwin (1809-1882)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130903/a727cf9e/attachment.pgp>
More information about the Beginners
mailing list