public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Out of memory while building GCC 12.1.0
@ 2022-06-10 11:55 Fiodar Stryzhniou
  2022-06-10 12:14 ` Xi Ruoyao
  0 siblings, 1 reply; 11+ messages in thread
From: Fiodar Stryzhniou @ 2022-06-10 11:55 UTC (permalink / raw)
  To: gcc-help

OS - Devuan Chimaera 4.0 stable release

Config:
configure  --target=$TARGET --prefix=$PREFIX  --without-headers \
	--enable-languages="c,c++,lto" --enable-lto --enable-interwork \
	--enable-long-long --enable-tls --enable-multilib --enable-wchar_t \
	--enable-c99 --with-newlib --with-dwarf2 --with-static-standard-libraries \
	--disable-hosted-libstdcxx --disable-libstdcxx-pch --disable-shared \
	--disable-option-checking --disable-threads --disable-nls \
	--disable-win32-registry --disable-libssp --disable-libquadmath

Build GCC 11.2.0 without problem.

I tried to build 12.1.0 several times. Result always same.

I build with "make -j6 -k 2> make-gcc.log". This help catch build 
errors. I sit and wait while memory usage grows over 4 Gb. Then 
terminate console flow with 'ctrl-c'. I see in make-gcc.log:

g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
/bin/bash: line 2: 17472 Killed                  build/genautomata 
../../gcc-12.1.0/./gcc/common.md 
../../gcc-12.1.0/./gcc/config/arm/arm.md insn-conditions.md > 
tmp-automata.cc
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** Deleting file 'doc/gccint.info'
make[2]: *** [Makefile:2492: s-attrtab] Interrupt
make[2]: *** [Makefile:1143: c/c-lang.o] Interrupt
make[2]: *** [Makefile:1143: c-family/stub-objc.o] Interrupt
make[2]: *** [Makefile:1143: attribs.o] Interrupt
make[2]: *** [Makefile:1143: c/c-errors.o] Interrupt
make[2]: *** [Makefile:1143: c/c-decl.o] Interrupt
make[2]: *** [Makefile:1143: c/c-typeck.o] Interrupt
make[2]: *** [Makefile:1143: c/c-convert.o] Interrupt
make[2]: *** [Makefile:1143: c/c-aux-info.o] Interrupt
make[2]: *** [Makefile:1143: c/c-objc-common.o] Interrupt
make[2]: *** [Makefile:1143: c/c-parser.o] Interrupt
make[2]: *** [Makefile:1143: c/c-fold.o] Interrupt
make[2]: *** [Makefile:1143: c/gimple-parser.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-common.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-cppbuiltin.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-dump.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-format.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-gimplify.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-indentation.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-lex.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-omp.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-opts.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-pch.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-ppoutput.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-pragma.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-pretty-print.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-semantics.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-ada-spec.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-ubsan.o] Interrupt
make[2]: *** [Makefile:1143: c-family/known-headers.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-attribs.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-warn.o] Interrupt
make[2]: *** [Makefile:1143: c-family/c-spellcheck.o] Interrupt
make[2]: *** [../../gcc-12.1.0/./gcc/config/arm/t-arm:168: arm-c.o] 
Interrupt
make[2]: *** [Makefile:2317: default-c.o] Interrupt
make[2]: *** [Makefile:1143: gimple-match.o] Interrupt
make[2]: *** [Makefile:1143: generic-match.o] Interrupt
make[2]: *** [Makefile:1143: insn-emit.o] Interrupt
make[2]: *** [Makefile:1143: insn-extract.o] Interrupt
make[2]: *** [Makefile:1143: insn-modes.o] Interrupt
make[2]: *** [Makefile:1143: insn-opinit.o] Interrupt
make[2]: *** [Makefile:1143: insn-output.o] Interrupt
make[2]: *** [Makefile:1143: insn-peep.o] Interrupt
make[2]: *** [Makefile:1143: insn-preds.o] Interrupt
make[2]: *** [Makefile:1143: insn-recog.o] Interrupt
make[2]: *** [Makefile:1143: ggc-page.o] Interrupt
make[2]: *** [Makefile:1143: adjust-alignment.o] Interrupt
make[2]: *** [Makefile:1143: alias.o] Interrupt
make[2]: *** [Makefile:1143: alloc-pool.o] Interrupt
make[2]: *** [Makefile:1143: auto-inc-dec.o] Interrupt
make[2]: *** [Makefile:1143: auto-profile.o] Interrupt
make[2]: *** [Makefile:1143: bb-reorder.o] Interrupt
make[2]: *** [Makefile:1143: bitmap.o] Interrupt
make[2]: *** [Makefile:1143: builtins.o] Interrupt
make[2]: *** [Makefile:1143: caller-save.o] Interrupt
make[2]: *** [Makefile:1143: calls.o] Interrupt
make[2]: *** [Makefile:1143: ccmp.o] Interrupt
make[2]: *** [Makefile:1143: cfg.o] Interrupt
make[2]: *** [Makefile:1143: cfganal.o] Interrupt
make[2]: *** [Makefile:1143: cfgbuild.o] Interrupt
make[2]: *** [Makefile:1143: cfgcleanup.o] Interrupt
make[2]: *** [Makefile:1143: cfgexpand.o] Interrupt
make[2]: *** [Makefile:1143: cfghooks.o] Interrupt
make[2]: *** [Makefile:1143: cfgloop.o] Interrupt
make[2]: *** [Makefile:1143: cfgloopanal.o] Interrupt
make[2]: *** [Makefile:1143: cfgloopmanip.o] Interrupt
make[2]: *** [Makefile:1143: cfgrtl.o] Interrupt
make[2]: *** [Makefile:1143: ctfc.o] Interrupt
make[2]: *** [Makefile:1143: ctfout.o] Interrupt
make[2]: *** [Makefile:1143: btfout.o] Interrupt
make[2]: *** [Makefile:1143: symtab.o] Interrupt
make[2]: *** [Makefile:1143: symtab-thunks.o] Interrupt
make[2]: *** [Makefile:1143: symtab-clones.o] Interrupt
make[2]: *** [Makefile:1143: cgraph.o] Interrupt
make[2]: *** [Makefile:1143: cgraphbuild.o] Interrupt
make[2]: *** [Makefile:1143: cgraphunit.o] Interrupt
make[2]: *** [Makefile:1143: cgraphclones.o] Interrupt
make[2]: *** [Makefile:1143: combine.o] Interrupt
make[2]: *** [Makefile:1143: combine-stack-adj.o] Interrupt
make[2]: *** [Makefile:1143: compare-elim.o] Interrupt
make[2]: *** [Makefile:1143: context.o] Interrupt
make[2]: *** [Makefile:1143: convert.o] Interrupt
make[2]: *** [Makefile:1143: coroutine-passes.o] Interrupt
make[2]: *** [Makefile:1143: coverage.o] Interrupt
make[2]: *** [Makefile:1143: cppbuiltin.o] Interrupt
make[2]: *** [Makefile:1143: cppdefault.o] Interrupt
make[2]: *** [Makefile:1143: cprop.o] Interrupt
make[2]: *** [Makefile:1143: cse.o] Interrupt
make[2]: *** [Makefile:1143: cselib.o] Interrupt
make[2]: *** [Makefile:1143: data-streamer.o] Interrupt
make[2]: *** [Makefile:1143: data-streamer-in.o] Interrupt
make[2]: *** [Makefile:1143: data-streamer-out.o] Interrupt
make[2]: *** [Makefile:1143: dbxout.o] Interrupt
make[2]: *** [Makefile:1143: dbgcnt.o] Interrupt
make[2]: *** [Makefile:1143: dce.o] Interrupt
make[2]: *** [Makefile:1143: ddg.o] Interrupt
make[2]: *** [Makefile:1143: debug.o] Interrupt
make[2]: *** [Makefile:1143: df-core.o] Interrupt
make[2]: *** [Makefile:1143: df-problems.o] Interrupt
make[2]: *** [Makefile:1143: df-scan.o] Interrupt
make[2]: *** [Makefile:1143: dfp.o] Interrupt
make[2]: *** [Makefile:1143: digraph.o] Interrupt
make[2]: *** [Makefile:1143: dojump.o] Interrupt
make[2]: *** [Makefile:1143: dominance.o] Interrupt
make[2]: *** [Makefile:1143: domwalk.o] Interrupt
make[2]: *** [Makefile:1143: double-int.o] Interrupt
make[2]: *** [Makefile:1143: dse.o] Interrupt
make[2]: *** [Makefile:1143: dumpfile.o] Interrupt
make[2]: *** [Makefile:1143: dwarf2asm.o] Interrupt
make[2]: *** [Makefile:1143: dwarf2cfi.o] Interrupt
make[2]: *** [Makefile:1143: dwarf2ctf.o] Interrupt
make[2]: *** [Makefile:1143: dwarf2out.o] Interrupt
make[2]: *** [Makefile:1143: early-remat.o] Interrupt
make[2]: *** [Makefile:1143: emit-rtl.o] Interrupt
make[2]: *** [Makefile:1143: et-forest.o] Interrupt
make[2]: *** [Makefile:1143: except.o] Interrupt
make[2]: *** [Makefile:1143: explow.o] Interrupt
make[2]: *** [Makefile:1143: expmed.o] Interrupt
make[2]: *** [Makefile:1143: expr.o] Interrupt
make[2]: *** [Makefile:1143: fibonacci_heap.o] Interrupt
make[2]: *** [Makefile:1143: file-prefix-map.o] Interrupt
make[2]: *** [Makefile:1143: final.o] Interrupt
make[2]: *** [Makefile:1143: fixed-value.o] Interrupt
make[2]: *** [Makefile:1143: fold-const.o] Interrupt
make[2]: *** [Makefile:1143: fold-const-call.o] Interrupt
make[2]: *** [Makefile:1143: function.o] Interrupt
make[2]: *** [Makefile:1143: function-abi.o] Interrupt
make[2]: *** [Makefile:1143: function-tests.o] Interrupt
make[2]: *** [Makefile:1143: fwprop.o] Interrupt
make[2]: *** [Makefile:1143: gcc-rich-location.o] Interrupt
make[2]: *** [Makefile:1143: gcse.o] Interrupt
make[2]: *** [Makefile:1143: gcse-common.o] Interrupt
make[2]: *** [Makefile:1143: ggc-common.o] Interrupt
make[2]: *** [Makefile:1143: ggc-tests.o] Interrupt
make[2]: *** [Makefile:1143: gimple.o] Interrupt
make[2]: *** [Makefile:1143: gimple-array-bounds.o] Interrupt
make[2]: *** [Makefile:1143: gimple-builder.o] Interrupt
make[2]: *** [Makefile:1143: gimple-expr.o] Interrupt
make[2]: *** [Makefile:1143: gimple-if-to-switch.o] Interrupt
make[2]: *** [Makefile:1143: gimple-iterator.o] Interrupt
make[2]: *** [Makefile:1143: gimple-fold.o] Interrupt
make[2]: *** [Makefile:1143: gimple-harden-conditionals.o] Interrupt
make[2]: *** [Makefile:1143: gimple-laddress.o] Interrupt
make[2]: *** [Makefile:1143: gimple-loop-interchange.o] Interrupt
make[2]: *** [Makefile:1143: gimple-loop-jam.o] Interrupt
make[2]: *** [Makefile:1143: gimple-loop-versioning.o] Interrupt
make[2]: *** [Makefile:1143: gimple-low.o] Interrupt
make[2]: *** [Makefile:1143: gimple-predicate-analysis.o] Interrupt
make[2]: *** [Makefile:1143: gimple-pretty-print.o] Interrupt
make[2]: *** [Makefile:1143: gimple-range.o] Interrupt
make[2]: *** [Makefile:1143: gimple-range-cache.o] Interrupt
make[2]: *** [Makefile:1143: gimple-range-edge.o] Interrupt
make[2]: *** [Makefile:1143: gimple-range-fold.o] Interrupt
make[2]: *** [Makefile:1143: gimple-range-gori.o] Interrupt
make[2]: *** [Makefile:1143: gimple-range-trace.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-backprop.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-evrp.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-evrp-analyze.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-isolate-paths.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-nonnull-compare.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-split-paths.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-store-merging.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-strength-reduction.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-sprintf.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-warn-access.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-warn-restrict.o] Interrupt
make[2]: *** [Makefile:1143: gimple-ssa-warn-alloca.o] Interrupt
make[2]: *** [Makefile:2475: s-automata] Interrupt
make[2]: *** [Makefile:3406: doc/gccint.info] Interrupt
make[2]: *** Deleting intermediate file 'gcc.pod'
make[1]: *** [Makefile:4620: all-gcc] Interrupt
make: *** [Makefile:1035: all] Interrupt

Looks like fork-bomb.

I have 8Gb ram. Adding 10Gb swap doesn't help.

Here mine shell script used for easy gcc build - 
https://github.com/fedor4ever/GCC4Symbian.
-- 
Fiodar Stryzhniou

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Out of memory while building GCC 12.1.0
  2022-06-10 11:55 Out of memory while building GCC 12.1.0 Fiodar Stryzhniou
@ 2022-06-10 12:14 ` Xi Ruoyao
  2022-06-10 12:18   ` Jonathan Wakely
  0 siblings, 1 reply; 11+ messages in thread
From: Xi Ruoyao @ 2022-06-10 12:14 UTC (permalink / raw)
  To: Fiodar Stryzhniou, gcc-help

On Fri, 2022-06-10 at 14:55 +0300, Fiodar Stryzhniou wrote:

/* snip */

> g++: fatal error: Killed signal terminated program cc1plus
> compilation terminated.
> g++: fatal error: Killed signal terminated program cc1plus
> compilation terminated.
> /bin/bash: line 2: 17472 Killed                  build/genautomata 
> ../../gcc-12.1.0/./gcc/common.md 
> ../../gcc-12.1.0/./gcc/config/arm/arm.md insn-conditions.md > 
> tmp-automata.cc
> g++: fatal error: Killed signal terminated program cc1plus
> compilation terminated.
> make[2]: *** Deleting file 'doc/gccint.info'
> make[2]: *** [Makefile:2492: s-attrtab] Interrupt
> make[2]: *** [Makefile:1143: c/c-lang.o] Interrupt
> make[2]: *** [Makefile:1143: c-family/stub-objc.o] Interrupt
> make[2]: *** [Makefile:1143: attribs.o] Interrupt

/* snip */

> make[2]: *** [Makefile:1143: gimple-ssa-warn-access.o] Interrupt
> make[2]: *** [Makefile:1143: gimple-ssa-warn-restrict.o] Interrupt
> make[2]: *** [Makefile:1143: gimple-ssa-warn-alloca.o] Interrupt
> make[2]: *** [Makefile:2475: s-automata] Interrupt
> make[2]: *** [Makefile:3406: doc/gccint.info] Interrupt
> make[2]: *** Deleting intermediate file 'gcc.pod'
> make[1]: *** [Makefile:4620: all-gcc] Interrupt
> make: *** [Makefile:1035: all] Interrupt
> 
> Looks like fork-bomb.
> 
> I have 8Gb ram. Adding 10Gb swap doesn't help.
> 
> Here mine shell script used for easy gcc build - 
> https://github.com/fedor4ever/GCC4Symbian.

It looks like you are using "make -j" without a number somehow.  Then
make will attempt to fork as many parallel jobs as possible. Recheck
your script.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Out of memory while building GCC 12.1.0
  2022-06-10 12:14 ` Xi Ruoyao
@ 2022-06-10 12:18   ` Jonathan Wakely
  2022-06-10 12:29     ` Fiodar Stryzhniou
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Wakely @ 2022-06-10 12:18 UTC (permalink / raw)
  To: Xi Ruoyao; +Cc: Fiodar Stryzhniou, gcc-help

On Fri, 10 Jun 2022 at 13:15, Xi Ruoyao via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
>
> On Fri, 2022-06-10 at 14:55 +0300, Fiodar Stryzhniou wrote:
>
> /* snip */
>
> > g++: fatal error: Killed signal terminated program cc1plus
> > compilation terminated.
> > g++: fatal error: Killed signal terminated program cc1plus
> > compilation terminated.
> > /bin/bash: line 2: 17472 Killed                  build/genautomata
> > ../../gcc-12.1.0/./gcc/common.md
> > ../../gcc-12.1.0/./gcc/config/arm/arm.md insn-conditions.md >
> > tmp-automata.cc
> > g++: fatal error: Killed signal terminated program cc1plus
> > compilation terminated.
> > make[2]: *** Deleting file 'doc/gccint.info'
> > make[2]: *** [Makefile:2492: s-attrtab] Interrupt
> > make[2]: *** [Makefile:1143: c/c-lang.o] Interrupt
> > make[2]: *** [Makefile:1143: c-family/stub-objc.o] Interrupt
> > make[2]: *** [Makefile:1143: attribs.o] Interrupt
>
> /* snip */
>
> > make[2]: *** [Makefile:1143: gimple-ssa-warn-access.o] Interrupt
> > make[2]: *** [Makefile:1143: gimple-ssa-warn-restrict.o] Interrupt
> > make[2]: *** [Makefile:1143: gimple-ssa-warn-alloca.o] Interrupt
> > make[2]: *** [Makefile:2475: s-automata] Interrupt
> > make[2]: *** [Makefile:3406: doc/gccint.info] Interrupt
> > make[2]: *** Deleting intermediate file 'gcc.pod'
> > make[1]: *** [Makefile:4620: all-gcc] Interrupt
> > make: *** [Makefile:1035: all] Interrupt
> >
> > Looks like fork-bomb.
> >
> > I have 8Gb ram. Adding 10Gb swap doesn't help.
> >
> > Here mine shell script used for easy gcc build -
> > https://github.com/fedor4ever/GCC4Symbian.
>
> It looks like you are using "make -j" without a number somehow.  Then
> make will attempt to fork as many parallel jobs as possible. Recheck
> your script.

Yes, I think the problem is here:
https://github.com/fedor4ever/GCC4Symbian/blob/master/build-toolchain.sh#L35

If you don't set that variable it will try to compile every file at
once. Either set the variable, or fix your script to use a sensible
default like -j"${NUMBER_OF_PROCESSORS:-1}"


>
> --
> Xi Ruoyao <xry111@xry111.site>
> School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Out of memory while building GCC 12.1.0
  2022-06-10 12:18   ` Jonathan Wakely
@ 2022-06-10 12:29     ` Fiodar Stryzhniou
  2022-06-10 12:42       ` Jonathan Wakely
  2022-06-10 14:42       ` Paul Smith
  0 siblings, 2 replies; 11+ messages in thread
From: Fiodar Stryzhniou @ 2022-06-10 12:29 UTC (permalink / raw)
  To: Jonathan Wakely, Xi Ruoyao; +Cc: gcc-help

6/10/22 у 3:18 PM Jonathan Wakely напісаў:
> On Fri, 10 Jun 2022 at 13:15, Xi Ruoyao via Gcc-help
> <gcc-help@gcc.gnu.org> wrote:
>>
>> On Fri, 2022-06-10 at 14:55 +0300, Fiodar Stryzhniou wrote:
>>
>> /* snip */
>>
>>> g++: fatal error: Killed signal terminated program cc1plus
>>> compilation terminated.
>>> g++: fatal error: Killed signal terminated program cc1plus
>>> compilation terminated.
>>> /bin/bash: line 2: 17472 Killed                  build/genautomata
>>> ../../gcc-12.1.0/./gcc/common.md
>>> ../../gcc-12.1.0/./gcc/config/arm/arm.md insn-conditions.md >
>>> tmp-automata.cc
>>> g++: fatal error: Killed signal terminated program cc1plus
>>> compilation terminated.
>>> make[2]: *** Deleting file 'doc/gccint.info'
>>> make[2]: *** [Makefile:2492: s-attrtab] Interrupt
>>> make[2]: *** [Makefile:1143: c/c-lang.o] Interrupt
>>> make[2]: *** [Makefile:1143: c-family/stub-objc.o] Interrupt
>>> make[2]: *** [Makefile:1143: attribs.o] Interrupt
>>
>> /* snip */
>>
>>> make[2]: *** [Makefile:1143: gimple-ssa-warn-access.o] Interrupt
>>> make[2]: *** [Makefile:1143: gimple-ssa-warn-restrict.o] Interrupt
>>> make[2]: *** [Makefile:1143: gimple-ssa-warn-alloca.o] Interrupt
>>> make[2]: *** [Makefile:2475: s-automata] Interrupt
>>> make[2]: *** [Makefile:3406: doc/gccint.info] Interrupt
>>> make[2]: *** Deleting intermediate file 'gcc.pod'
>>> make[1]: *** [Makefile:4620: all-gcc] Interrupt
>>> make: *** [Makefile:1035: all] Interrupt
>>>
>>> Looks like fork-bomb.
>>>
>>> I have 8Gb ram. Adding 10Gb swap doesn't help.
>>>
>>> Here mine shell script used for easy gcc build -
>>> https://github.com/fedor4ever/GCC4Symbian.
>>
>> It looks like you are using "make -j" without a number somehow.  Then
>> make will attempt to fork as many parallel jobs as possible. Recheck
>> your script.
> 
> Yes, I think the problem is here:
> https://github.com/fedor4ever/GCC4Symbian/blob/master/build-toolchain.sh#L35
Defaul value here:
https://github.com/fedor4ever/GCC4Symbian/blob/master/build-toolchain.sh#L25
> 
> If you don't set that variable it will try to compile every file at
> once. Either set the variable, or fix your script to use a sensible
> default like -j"${NUMBER_OF_PROCESSORS:-1}"
> 
> 
>>
>> --
>> Xi Ruoyao <xry111@xry111.site>
>> School of Aerospace Science and Technology, Xidian University

Looks like you right. Harcoded to -j6 helps.

-- 
Fiodar Stryzhniou

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Out of memory while building GCC 12.1.0
  2022-06-10 12:29     ` Fiodar Stryzhniou
@ 2022-06-10 12:42       ` Jonathan Wakely
  2022-06-10 15:06         ` Fiodar Stryzhniou
  2022-06-10 14:42       ` Paul Smith
  1 sibling, 1 reply; 11+ messages in thread
From: Jonathan Wakely @ 2022-06-10 12:42 UTC (permalink / raw)
  To: Fiodar Stryzhniou; +Cc: Xi Ruoyao, gcc-help

On Fri, 10 Jun 2022 at 13:29, Fiodar Stryzhniou <fedor_qd@mail.ru> wrote:
>
> 6/10/22 у 3:18 PM Jonathan Wakely напісаў:
> > On Fri, 10 Jun 2022 at 13:15, Xi Ruoyao via Gcc-help
> > <gcc-help@gcc.gnu.org> wrote:
> >>
> >> On Fri, 2022-06-10 at 14:55 +0300, Fiodar Stryzhniou wrote:
> >>
> >> /* snip */
> >>
> >>> g++: fatal error: Killed signal terminated program cc1plus
> >>> compilation terminated.
> >>> g++: fatal error: Killed signal terminated program cc1plus
> >>> compilation terminated.
> >>> /bin/bash: line 2: 17472 Killed                  build/genautomata
> >>> ../../gcc-12.1.0/./gcc/common.md
> >>> ../../gcc-12.1.0/./gcc/config/arm/arm.md insn-conditions.md >
> >>> tmp-automata.cc
> >>> g++: fatal error: Killed signal terminated program cc1plus
> >>> compilation terminated.
> >>> make[2]: *** Deleting file 'doc/gccint.info'
> >>> make[2]: *** [Makefile:2492: s-attrtab] Interrupt
> >>> make[2]: *** [Makefile:1143: c/c-lang.o] Interrupt
> >>> make[2]: *** [Makefile:1143: c-family/stub-objc.o] Interrupt
> >>> make[2]: *** [Makefile:1143: attribs.o] Interrupt
> >>
> >> /* snip */
> >>
> >>> make[2]: *** [Makefile:1143: gimple-ssa-warn-access.o] Interrupt
> >>> make[2]: *** [Makefile:1143: gimple-ssa-warn-restrict.o] Interrupt
> >>> make[2]: *** [Makefile:1143: gimple-ssa-warn-alloca.o] Interrupt
> >>> make[2]: *** [Makefile:2475: s-automata] Interrupt
> >>> make[2]: *** [Makefile:3406: doc/gccint.info] Interrupt
> >>> make[2]: *** Deleting intermediate file 'gcc.pod'
> >>> make[1]: *** [Makefile:4620: all-gcc] Interrupt
> >>> make: *** [Makefile:1035: all] Interrupt
> >>>
> >>> Looks like fork-bomb.
> >>>
> >>> I have 8Gb ram. Adding 10Gb swap doesn't help.
> >>>
> >>> Here mine shell script used for easy gcc build -
> >>> https://github.com/fedor4ever/GCC4Symbian.
> >>
> >> It looks like you are using "make -j" without a number somehow.  Then
> >> make will attempt to fork as many parallel jobs as possible. Recheck
> >> your script.
> >
> > Yes, I think the problem is here:
> > https://github.com/fedor4ever/GCC4Symbian/blob/master/build-toolchain.sh#L35
> Defaul value here:
> https://github.com/fedor4ever/GCC4Symbian/blob/master/build-toolchain.sh#L25
> >
> > If you don't set that variable it will try to compile every file at
> > once. Either set the variable, or fix your script to use a sensible
> > default like -j"${NUMBER_OF_PROCESSORS:-1}"
> >
> >
> >>
> >> --
> >> Xi Ruoyao <xry111@xry111.site>
> >> School of Aerospace Science and Technology, Xidian University
>
> Looks like you right. Harcoded to -j6 helps.

Thousands and thousands of people have built GCC 12.1.0 successfully.
If you think you've found a fork bomb in the build process that nobody
else has seen, it's probably a problem with your commands, not GCC.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Out of memory while building GCC 12.1.0
  2022-06-10 12:29     ` Fiodar Stryzhniou
  2022-06-10 12:42       ` Jonathan Wakely
@ 2022-06-10 14:42       ` Paul Smith
  2022-06-10 15:56         ` Segher Boessenkool
  1 sibling, 1 reply; 11+ messages in thread
From: Paul Smith @ 2022-06-10 14:42 UTC (permalink / raw)
  To: Fiodar Stryzhniou; +Cc: gcc-help

On Fri, 2022-06-10 at 15:29 +0300, Fiodar Stryzhniou wrote:
> > If you don't set that variable it will try to compile every file at
> > once. Either set the variable, or fix your script to use a sensible
> > default like -j"${NUMBER_OF_PROCESSORS:-1}"
> 
> Looks like you right. Harcoded to -j6 helps.

Another way to go is to add the "-l" option.  This is often combined
with "-j" (no limit) to have your build limited by load rather than by
job count.

So if you want the load on your system to be no greater than 2, you can
say "-j -l2".

Just to be aware, on Linux a load of "1" means approximately "1 CPU is
100% busy".  So if you use "-l2" then you'll likely have between 2 and
3 jobs running, but if your jobs have to do a lot of waiting (say they
need to do a lot of disk IO / your disk is slow) then you will have
more running.

Anyway, getting the best behavior out of parallelism is a matter of
trial and error and is specific to your build environment.  But plain
"-j" with no other control is virtually never a good idea :).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Out of memory while building GCC 12.1.0
  2022-06-10 12:42       ` Jonathan Wakely
@ 2022-06-10 15:06         ` Fiodar Stryzhniou
  0 siblings, 0 replies; 11+ messages in thread
From: Fiodar Stryzhniou @ 2022-06-10 15:06 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Xi Ruoyao, gcc-help

6/10/22 у 3:42 PM Jonathan Wakely напісаў:
> On Fri, 10 Jun 2022 at 13:29, Fiodar Stryzhniou <fedor_qd@mail.ru> wrote:
>>
>> 6/10/22 у 3:18 PM Jonathan Wakely напісаў:
>>> On Fri, 10 Jun 2022 at 13:15, Xi Ruoyao via Gcc-help
>>> <gcc-help@gcc.gnu.org> wrote:
>>>>
>>>> On Fri, 2022-06-10 at 14:55 +0300, Fiodar Stryzhniou wrote:
>>>>
>>>> /* snip */
>>>>
>>>>> g++: fatal error: Killed signal terminated program cc1plus
>>>>> compilation terminated.
>>>>> g++: fatal error: Killed signal terminated program cc1plus
>>>>> compilation terminated.
>>>>> /bin/bash: line 2: 17472 Killed                  build/genautomata
>>>>> ../../gcc-12.1.0/./gcc/common.md
>>>>> ../../gcc-12.1.0/./gcc/config/arm/arm.md insn-conditions.md >
>>>>> tmp-automata.cc
>>>>> g++: fatal error: Killed signal terminated program cc1plus
>>>>> compilation terminated.
>>>>> make[2]: *** Deleting file 'doc/gccint.info'
>>>>> make[2]: *** [Makefile:2492: s-attrtab] Interrupt
>>>>> make[2]: *** [Makefile:1143: c/c-lang.o] Interrupt
>>>>> make[2]: *** [Makefile:1143: c-family/stub-objc.o] Interrupt
>>>>> make[2]: *** [Makefile:1143: attribs.o] Interrupt
>>>>
>>>> /* snip */
>>>>
>>>>> make[2]: *** [Makefile:1143: gimple-ssa-warn-access.o] Interrupt
>>>>> make[2]: *** [Makefile:1143: gimple-ssa-warn-restrict.o] Interrupt
>>>>> make[2]: *** [Makefile:1143: gimple-ssa-warn-alloca.o] Interrupt
>>>>> make[2]: *** [Makefile:2475: s-automata] Interrupt
>>>>> make[2]: *** [Makefile:3406: doc/gccint.info] Interrupt
>>>>> make[2]: *** Deleting intermediate file 'gcc.pod'
>>>>> make[1]: *** [Makefile:4620: all-gcc] Interrupt
>>>>> make: *** [Makefile:1035: all] Interrupt
>>>>>
>>>>> Looks like fork-bomb.
>>>>>
>>>>> I have 8Gb ram. Adding 10Gb swap doesn't help.
>>>>>
>>>>> Here mine shell script used for easy gcc build -
>>>>> https://github.com/fedor4ever/GCC4Symbian.
>>>>
>>>> It looks like you are using "make -j" without a number somehow.  Then
>>>> make will attempt to fork as many parallel jobs as possible. Recheck
>>>> your script.
>>>
>>> Yes, I think the problem is here:
>>> https://github.com/fedor4ever/GCC4Symbian/blob/master/build-toolchain.sh#L35
>> Defaul value here:
>> https://github.com/fedor4ever/GCC4Symbian/blob/master/build-toolchain.sh#L25
>>>
>>> If you don't set that variable it will try to compile every file at
>>> once. Either set the variable, or fix your script to use a sensible
>>> default like -j"${NUMBER_OF_PROCESSORS:-1}"
>>>
>>>
>>>>
>>>> --
>>>> Xi Ruoyao <xry111@xry111.site>
>>>> School of Aerospace Science and Technology, Xidian University
>>
>> Looks like you right. Harcoded to -j6 helps.
> 
> Thousands and thousands of people have built GCC 12.1.0 successfully.
> If you think you've found a fork bomb in the build process that nobody
> else has seen, it's probably a problem with your commands, not GCC.
> 
My apologies.

-- 
Fiodar Stryzhniou

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Out of memory while building GCC 12.1.0
  2022-06-10 14:42       ` Paul Smith
@ 2022-06-10 15:56         ` Segher Boessenkool
  2022-06-10 17:04           ` Fiodar Stryzhniou
  2022-06-10 17:09           ` Paul Smith
  0 siblings, 2 replies; 11+ messages in thread
From: Segher Boessenkool @ 2022-06-10 15:56 UTC (permalink / raw)
  To: Paul Smith; +Cc: Fiodar Stryzhniou, gcc-help

On Fri, Jun 10, 2022 at 10:42:03AM -0400, Paul Smith wrote:
> On Fri, 2022-06-10 at 15:29 +0300, Fiodar Stryzhniou wrote:
> > Looks like you right. Harcoded to -j6 helps.
> 
> Another way to go is to add the "-l" option.  This is often combined
> with "-j" (no limit) to have your build limited by load rather than by
> job count.
> 
> So if you want the load on your system to be no greater than 2, you can
> say "-j -l2".

The load average is only computed every 5s, so if you have a faster
machine it can bring your system to its knees in that time already, by
starting thousands of tasks.

Since maximum acceptable loadavg is very system specific as well, you
can just always use -j<N> instead, or -j<N> -l<M>.  Just never use -j
without number after it :-)


Segher

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Out of memory while building GCC 12.1.0
  2022-06-10 15:56         ` Segher Boessenkool
@ 2022-06-10 17:04           ` Fiodar Stryzhniou
  2022-06-10 17:09           ` Paul Smith
  1 sibling, 0 replies; 11+ messages in thread
From: Fiodar Stryzhniou @ 2022-06-10 17:04 UTC (permalink / raw)
  To: Segher Boessenkool, Paul Smith; +Cc: gcc-help

6/10/22 у 6:56 PM Segher Boessenkool напісаў:
> On Fri, Jun 10, 2022 at 10:42:03AM -0400, Paul Smith wrote:
>> On Fri, 2022-06-10 at 15:29 +0300, Fiodar Stryzhniou wrote:
>>> Looks like you right. Harcoded to -j6 helps.
>>
>> Another way to go is to add the "-l" option.  This is often combined
>> with "-j" (no limit) to have your build limited by load rather than by
>> job count.
>>
>> So if you want the load on your system to be no greater than 2, you can
>> say "-j -l2".
> 
> The load average is only computed every 5s, so if you have a faster
> machine it can bring your system to its knees in that time already, by
> starting thousands of tasks.
> 
> Since maximum acceptable loadavg is very system specific as well, you
> can just always use -j<N> instead, or -j<N> -l<M>.  Just never use -j
> without number after it :-)
> 
> 
> Segher
> 
I read make --help before use =) Reading is always good.

I build binutils and gcc many times with that script. Error comes from 
oldest and stable part in my script. I'm confused.

-- 
Fiodar Stryzhniou

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Out of memory while building GCC 12.1.0
  2022-06-10 15:56         ` Segher Boessenkool
  2022-06-10 17:04           ` Fiodar Stryzhniou
@ 2022-06-10 17:09           ` Paul Smith
  2022-06-10 17:15             ` Segher Boessenkool
  1 sibling, 1 reply; 11+ messages in thread
From: Paul Smith @ 2022-06-10 17:09 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Fiodar Stryzhniou, gcc-help

On Fri, 2022-06-10 at 10:56 -0500, Segher Boessenkool wrote:
> The load average is only computed every 5s, so if you have a faster
> machine it can bring your system to its knees in that time already,
> by starting thousands of tasks.

This is no longer true as of GNU make 3.81 (released in 2006).  GNU
make artificially adjusts the load average based on the number of jobs
started in the last second, to avoid this issue.

In the next release of GNU make a different method, based on /proc, is
used for Linux specifically which should result in even better behavior
there.

Cheers!

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Out of memory while building GCC 12.1.0
  2022-06-10 17:09           ` Paul Smith
@ 2022-06-10 17:15             ` Segher Boessenkool
  0 siblings, 0 replies; 11+ messages in thread
From: Segher Boessenkool @ 2022-06-10 17:15 UTC (permalink / raw)
  To: Paul Smith; +Cc: Fiodar Stryzhniou, gcc-help

On Fri, Jun 10, 2022 at 01:09:30PM -0400, Paul Smith wrote:
> On Fri, 2022-06-10 at 10:56 -0500, Segher Boessenkool wrote:
> > The load average is only computed every 5s, so if you have a faster
> > machine it can bring your system to its knees in that time already,
> > by starting thousands of tasks.
> 
> This is no longer true as of GNU make 3.81 (released in 2006).  GNU
> make artificially adjusts the load average based on the number of jobs
> started in the last second, to avoid this issue.

I have seen it happen with GNU make 3.82.  The newer heuristic is
better, sure, but it is still a heuristic based on flawed data, so it
can never be perfectly good.

> In the next release of GNU make a different method, based on /proc, is
> used for Linux specifically which should result in even better behavior
> there.

Great to hear that!  So in a year or ten people can use this safely :-)


Segher

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-06-10 17:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 11:55 Out of memory while building GCC 12.1.0 Fiodar Stryzhniou
2022-06-10 12:14 ` Xi Ruoyao
2022-06-10 12:18   ` Jonathan Wakely
2022-06-10 12:29     ` Fiodar Stryzhniou
2022-06-10 12:42       ` Jonathan Wakely
2022-06-10 15:06         ` Fiodar Stryzhniou
2022-06-10 14:42       ` Paul Smith
2022-06-10 15:56         ` Segher Boessenkool
2022-06-10 17:04           ` Fiodar Stryzhniou
2022-06-10 17:09           ` Paul Smith
2022-06-10 17:15             ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).