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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Sean Seefried-2
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.

Why the discrepancy? 

Sean

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

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

Yuras Shumovich
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
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users