[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OOM while building ghc 9.4.5



Hi Ilias,

On Fri, Jul 28, 2023 at 4:27 PM Ilias Tsitsimpis <iliastsi@debian.org> wrote:
>
> On Wed, Jul 26, 2023 at 01:02PM, Jeffrey Walton wrote:
> > [...]
> > I found two things helped or fixed the problem. First, I would build
> > with only one make job. That is, 'make -j 1'. 'make -j 3' or 'make -j
> > 5' was sure to break the build.
> >
> > Second, I would add a swap partition that provided enough space to run
> > the compiler. For a dev board with 512MB of RAM, I would setup a 2GB
> > swap partition. I would also set swappiness to 1 or 2 to keep things
> > in memory. zram would not help because even compressed, the compiler
> > needed a fair amount of space.
>
> Thanks for the hints. Unfortunately none of them have worked so far. I
> am trying to compile just this file and nothing else, and I am using a
> host with 8G of RAM and 8G of Swap. The problem seems to be the fact
> that mipsel is limited to only 2G RAM space for user processes.

Oh, that's an interesting twist. But I see it could make sense since
this is a 32-bit platform.

> Unfortunately I cannot see a way forward here, other than removing ghc
> (and every Haskell program) from mipsel.

I'm spit-balling here, since I don't recall doing this in C/C++ for
this problem... Based on:

    virtual memory exhausted: Cannot allocate memory
    `gcc' failed in phase `C Compiler'. (Exit code: 1)

Break that source file up into two or three more manageable pieces.

If I am parsing the command line correctly, the source file is
Instances.hs and the output file is Instances.p_o. I would try to
create Instances_1.hs, Instances_2.hs and Instances_3.hs, and then let
the linker combine their object files later.

What I don't know is, is it possible to do that in Haskell. Some
languages are picky about things like that. C# and Java come to mind.

Jeff


Reply to: