[Haskell-beginners] GHC-generated executables size

. ch.gosch at googlemail.com
Sun Oct 17 07:10:32 EDT 2010


Ok, after recompiling gtk again and hiding gtk-0.11.0 (which was still
monolithic), it worked. The executable is now, after stripping, a mere
2.7MB in size (which is still large for what it does, but much better).
Thanks to all who answered for your help!

Christian

On Sat, 2010-10-16 at 22:18 +0200, Daniel Fischer wrote:
> On Saturday 16 October 2010 21:32:27, . wrote:
> > I have seen, however, that I have 2 versions of gtk (0.11.2 and 0.11.0)
> > on the system. I will try to find out which one was actually used when I
> > called "ghc --make guiMain"; how would I go about that?
> >
> 
> Normally, ghc picks the later version. When compiling, you can see which 
> version is used by giving the appropriate verbosity flag (-v2 or greater).
> After the fact, the only way I know is
> 
> $ nm executable | grep stginit_gtk | more (or less)
> 
> and then you'll see the z-encoded package version, lines like
> 
> 080ca5dc T __stginit_gtkzm0zi11zi2_Stuff
> 
> for gtk-0.11.2.
> 
> > > > 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
> >
> > I tried that, there are almost 900 matches.
> >
> 
> Hm, shouldn't nearly take you to 20M.
> 
> > > > 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?
> >
> > I am using Ubuntu 10.10, ghc 6.12.1, on a 4-core AMD Phenom.
> > The program I am compiling needs these packages:
> >  gtk, Text.Parsec, Time, Database.HDBC.Sqlite3, Locale,
> > Data.ByteString.Lazy.
> >
> 
> No obvious suspect.
> Depending on how curious you are, you could split off small sub-programmes 
> to see what's taking a lot of space. But that's going to be tedious.
> 
> You could ask on IRC (#haskell) whether anybody knows about huge 
> executables with gtk, or on haskell-cafe, on the gtk2hs mailing list, or 
> you could open a ticket at http://hackage.haskell.org/trac/gtk2hs/ or 
> http://hackage.haskell.org/trac/ghc/newticket?type=bug whichever you 
> consider more likely to be responsible (you needn't create an account for 
> either bug-tracker, both have guest accounts with the guest password in 
> plain view - though you may need to look for it a bit). But first ask 
> elsewhere.
> 
> >
> > --Christian
> 




More information about the Beginners mailing list