[Haskell-cafe] trouble installing ghc 6.6: xargs: /usr/bin/ar: terminated by signal 11

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Jan 7 08:37:33 EST 2007

On Sat, 2007-01-06 at 15:30 -0800, tphyahoo wrote:
> I'm having trouble installing ghc 6.6. On ubuntu, virtual server (user mode
> linux).
> Something seems to be killing the process, no idea why.
> Anyone seen this? 


> /usr/bin/ar: creating libHSbase.a
> xargs: /usr/bin/ar: terminated by signal 11

What is happening is that the ghc build system is linking thousands and
thousands of tiny .o files into libHSbase.a. GNU ar isn't optimised for
this use-case and it takes far more memory than it really needs to. So
what happens is that ar takes >500Mb of memory and your virtual
machine / virtual server probably isn't configured with that much memory
and so the linux kernel OOM killer terminates the ar process.

To make this worse, since there are so many .o files, it takes several
invocations of ar to link them all. On each invocation ar is building
the symbol index (-q is ignored) and this is what takes the most time
and memory. It's a good deal quicker to use a custom program (100 lines
of Haskell) to build libHSbase.a and then use ranlib just once to build
the symbol index.

I submitted a patch to gnu binutils to make ar take less memory when
linking 1000's of files so it now only takes around 100Mb rather than
500Mb when linking libHSbase.a. That patch is included in version 2.17 I
think (in other words most systems don't have it yet).

What you can do in the mean time is either configure your virtual
machine with more memory or turn off the split-objs feature when you
configure ghc. Just add SplitObjs=NO" to your mk/build.mk file (which
may not exist to start with). (The Gentoo ebuild does this


More information about the Haskell-Cafe mailing list