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

Re: OOM while building ghc 9.4.5



Hi Ilias ,

On Sat, Jul 29, 2023 at 2:44 AM Ilias Tsitsimpis <iliastsi@debian.org> wrote:
>
> On Fri, Jul 28, 2023 at 05:09PM, Jeffrey Walton wrote:
> > 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.
>
> This was suggested as a solution by upstream as well (see [1]) but they
> found it was too difficult to do and ended up using to -O0 instead.
>
> [1] https://gitlab.haskell.org/ghc/ghc/-/issues/18256

Since the compile is failing in preprocessing, I took a look at GCC
preprocessor options.[1]

These look like they could help:

   * -ftrack-macro-expansion=0
      - Don't track macro expansion. Saves memory
   * -no-integrated-cpp
      - invoke cc1 twice, once for preprocessing and
        once for actual compilation of the preprocessed input
   * -fmax-include-depth=20
      - Normally 200, don't allow deep nesting

And if it is an option, then:

   * -fno-large-source-files

-flarge-source-files is an option, but I am not sure about the -fno-*
variant in this case.

Finally, this may help, but I don't understand it. I have never used it:

   * -Mno-modules
      - Disable dependency generation for compiled module interfaces.
Jeff

[1] https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html


Reply to: