-staticlib flag for building standalone static libraries producing very large libraries

Yuras Shumovich shumovichy at gmail.com
Sat Mar 7 11:46:28 UTC 2015


On Sat, 2015-03-07 at 22:18 +1100, Sean Seefried wrote:
> Hi all,
> 
> Can anyone explain the following problem I'm having?
> 
> I'm currently writing a game in Haskell. When I produce a plain old
> executable (for local testing) it's about 23M. However, when I create a
> static lib using the -staticlib flag it is 54M.

Most likely that is because executable contains only necessary/used
definitions, while static lib is just an archive of all object files,
including all dependencies.

Note also that by default core libs are compiled using --split-objs, so
when linking executable, all unused top level definitions are filtered
out. (And you can decrease size of the executable even more by compiling
it and all its dependencies using --split-objs if you are not using it
already.) Without the flag, unused definitions are filtered out on per
module basis.

(I'm not an expert here, so the above description can be partially or
totally wrong :) )

Thanks,
Yuras

> 
> Why the discrepancy?
> 
> Sean
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users




More information about the Glasgow-haskell-users mailing list