[Haskell-beginners] GHC-generated executables size

Daniel Fischer daniel.is.fischer at web.de
Sat Oct 16 15:09:56 EDT 2010


On Saturday 16 October 2010 15:03:52, . wrote:
> Hi Daniel,
> thanks for the explanations.
> I have tried reinstalling with
> cabal --reinstall gtk,
> having set
> split-objs: True
> in ~/.cabal/config before.
>
> However, the compile yielded a single .o file again,

Yes, there's the single .o file for the package, the question is, what's in 
the archive (libHSxxx.a). Rule of thumb, if it's more than twice as large 
as the HSxxx.o, it contains the split object files (you can verify by 
looking at it with nm).

> and recompiling and re-linking my little program does not change
> its size ...

Possibly the packages have been built with -spilt-objs originally, or your 
GHC doesn't support split-objs, in either case, sorry for the inconvenience 
:-/

gtk contains apparently hundreds of thousands of modules, so it may be the 
module-initialisation functions. Quick test:

$ nm yourexecutable | grep stginit | wc -l

> Any other idea what I might be doing wrong?

Nothing, probably.

What ghc version are you using, on which platform (OS, arch), which 
packages does your executable need?

> Also, I saw in the ghc documentatio about -split-objs that one should
> only use it "if you know exactly what you're doing".
> Do you know what the caveats are?

Doesn't work on all platforms (Sparc seems to have some problems iirc), 
slower compile times. That's what I'm aware of.

>
> Thanks again,
> Christian



More information about the Beginners mailing list