Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 891909 - sys-devel/gcc-12.2.1_p20230121-r1[lto] does not respect MAKEOPTS
Summary: sys-devel/gcc-12.2.1_p20230121-r1[lto] does not respect MAKEOPTS
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 4 votes (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: makeopts-ignored
  Show dependency tree
 
Reported: 2023-01-24 10:23 UTC by Stijn Tintel
Modified: 2024-03-20 16:19 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
oom-killer part from dmesg (oom-killer.txt,21.74 KB, text/plain)
2023-01-24 10:24 UTC, Stijn Tintel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stijn Tintel 2023-01-24 10:23:04 UTC
During build of sys-devel/gcc-12.2.1_p20230121-r1 on one of my musl systems, oom-killer is invoked due to the build spawning many lto1-wpa-stream processes.

Reproducible: Always

Steps to Reproduce:
1. USE=lto emerge -1 =sys-devel/gcc-12.2.1_p20230121-r1 

Actual Results:  
Build spawns a truckload of lto1-wpa-stream and triggers oom-killer.

Expected Results:  
Build should spawn 4 lto1-wpa-stream processes as MAKEOPTS=-j4.

Portage 3.0.43 (python 3.10.9-final-0, default/linux/amd64/17.0/musl/hardened, gcc-11, musl-1.2.3, 5.15.74-gentoo-x86_64 x86_64)
=================================================================
System uname: Linux-5.15.74-gentoo-x86_64-x86_64-Intel_Xeon_E3-12xx_v2_-Ivy_Bridge,_IBRS-with-libc
KiB Mem:     6093388 total,   1743448 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Mon, 23 Jan 2023 22:45:01 +0000
Head commit of repository gentoo: 708460e50bca1d251a826bf74c00a3021ea76f10
Timestamp of repository guru: Sun, 22 Jan 2023 08:31:54 +0000
Head commit of repository guru: e3e87d23ca97aa3e97c57d126eebae998ae35751

Head commit of repository musl: 9a26ebd8735df4afa71f23036085274fb316bb30

Head commit of repository stintel: 0f5b4111d0fab4b1a06b6aa91f20851e257dc12c

sh bash 5.1_p16-r2
ld GNU ld (Gentoo 2.39 p5) 2.39.0
ccache version 4.7.4 [disabled]
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r2::gentoo
dev-lang/perl:             5.36.0-r1::gentoo
dev-lang/python:           3.8.16-r3::gentoo, 3.9.13::gentoo, 3.10.9::gentoo, 3.11.1::gentoo
dev-lang/rust-bin:         1.66.1::gentoo
dev-util/ccache:           4.7.4::gentoo
dev-util/cmake:            3.24.3::gentoo
dev-util/meson:            0.64.1::gentoo
sys-apps/baselayout:       2.9::gentoo
sys-apps/openrc:           0.45.2-r2::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.71-r5::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r4::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc:             11.3.1_p20221209::gentoo
sys-devel/gcc-config:      2.8::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/musl:             1.2.3::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.europe.gentoo.org/gentoo-portage/
    priority: -1000
    volatile: True
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: --exclude-from=/etc/portage/rsync.exclude

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo
    volatile: True

misc
    location: /usr/local/portage/misc
    masters: gentoo
    volatile: True

musl
    location: /var/db/repos/musl
    sync-type: git
    sync-uri: https://github.com/gentoo/musl.git
    masters: gentoo
    volatile: True

stintel
    location: /var/repo/stintel
    sync-type: git
    sync-uri: https://github.com/stintel/gentoo-overlay.git
    masters: guru gentoo
    volatile: True

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-gentoo-linux-musl"
CFLAGS="-O2 -pipe -march=ivybridge -maes -ggdb"
CHOST="x86_64-gentoo-linux-musl"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.4/ext-active/ /etc/php/apache2-php8.1/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/php/cli-php8.1/ext-active/ /etc/php/fpm-php7.4/ext-active/ /etc/php/fpm-php8.1/ext-active/ /etc/php/phpdbg-php7.4/ext-active/ /etc/php/phpdbg-php8.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=ivybridge -maes -ggdb"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg buildpkg-live cgroup compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://mirror.leaseweb.com/gentoo https://gentoo.adlevio.net"
INSTALL_MASK="charset.alias /usr/share/locale/locale.alias"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j4"
PKGDIR="/var/cache/binpkgs"
PORTAGE_BINHOST="https://gentoo.adlevio.net/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync.exclude"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="acl aes amd64 audit avx bzip2 caps cet cli crypt dri f16c fortran hardened iconv ipv6 libglvnd libtirpc lto mmx mmxext ncurses nls nptl openmp pam pclmul pcre pie popcnt rdrand readline sctp seccomp smp split-usr sse sse2 sse3 sse4_1 sse4_2 ssl ssp ssse3 test-rust unicode xattr xtpax zlib" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx f16c mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" NGINX_MODULES_HTTP="access addition auth_basic autoindex browser charset dav empty_gif fancyindex fastcgi geo geoip gzip gzip_static headers_more limit_req limit_zone map memcached mp4 proxy realip referer rewrite scgi spdy split_clients ssi stub_status upload upload_progress upstream_ip_hash userid uwsgi" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS


Unfortunately I can't currently provide build.log, as this is wiped already by an attempt to build sys-devel/gcc-12.2.1_p20230121-r1 with BOOT_CFLAGS="--param lto-max-streaming-parallelism=4".
Comment 1 Stijn Tintel 2023-01-24 10:24:13 UTC
Created attachment 849135 [details]
oom-killer part from dmesg
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-24 10:29:13 UTC
[10:26:19]  <+sam_> oh wait
[10:26:34]  <+sam_> sys-devel/gcc:             11.3.1_p20221209::gentoo
[10:26:48]  <+sam_> I think you were lucky enough to be able to build a bad gcc when for most people, it segfaulted on musl
[10:27:22]  <+sam_> I suspect if you can get a build of this to finish, when you try again, it'll work
Comment 3 Cyp 2023-01-24 17:20:57 UTC
I also have gcc version 11.3.1 20221209 (Gentoo 11.3.1_p20221209 p3) while trying to emerge gcc 12.2.1_p20230121-r1, and it was spawning 248 lto1-wpa-stream processes instead of 8.

I don't have musl installed, and musl seems to even be hard-masked.

My issue was swapping to disk rather than the OOM killer. As a workaround, I switched it to building in serial during the moments it starts swapping:

    for p in $(killall -v -STOP lto1-wpa-stream 2>&1| sed 's/.*(\(.*\)).*/\1/') ; do echo $p ; while kill -CONT $p ; do sleep .05 ; done ; done

The hard part is getting a working shell in order to run that every time it starts swapping heavily (2 times so far, thinking there might be a third before it finishes).

If doing that before the OOM killer kicks in, maybe it would help, but that's probably not practical to run it at exactly the right time.
Comment 4 Stijn Tintel 2023-01-25 10:32:41 UTC
Looks like :12 built fine after updating :11 to gcc-11.3.1_p20230120-r1.
Comment 5 Ryan 2023-01-26 19:52:17 UTC Comment hidden (spam)
Comment 6 Ryan 2023-01-26 19:53:14 UTC Comment hidden (spam)
Comment 7 Tom Dickson 2023-01-26 23:05:41 UTC
I received the same issue - and manually installing 11.3.1_p20230120-r1 didn't fix it, similar error

[178040.117813] cc1plus invoked oom-killer: gfp_mask=0x1100dca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO), order=0, oom_score_adj=0
[178040.117824] CPU: 0 PID: 7031 Comm: cc1plus Tainted: P           OE     5.15.88-gentoo-x86_64 #1
[178040.117827] Hardware name: VMware, Inc. VMware7,1/440BX Desktop Reference Platform, BIOS VMW71.00V.7581552.B64.1801142334 01/14/2018
[178040.117828] Call Trace:
[178040.117855]  <TASK>
[178040.117869]  dump_stack_lvl+0x46/0x5e
[178040.117878]  dump_header+0x4a/0x1f7
[178040.117882]  oom_kill_process.cold+0xb/0x10
[178040.117884]  out_of_memory+0x254/0x4f0
[178040.117889]  __alloc_pages_slowpath.constprop.0+0xc51/0xd20
[178040.117894]  __alloc_pages+0x1e9/0x220
[178040.117897]  alloc_pages_vma+0x95/0x310
[178040.117899]  __handle_mm_fault+0xb66/0x14d0
[178040.117905]  handle_mm_fault+0xcf/0x2b0
[178040.117908]  do_user_addr_fault+0x1c5/0x680
[178040.117914]  exc_page_fault+0x72/0x150
[178040.117918]  asm_exc_page_fault+0x22/0x30
[178040.117923] RIP: 0033:0x2aa24e1
[178040.117933] Code: Unable to access opcode bytes at RIP 0x2aa24b7.
[178040.117934] RSP: 002b:00007ffcb53b12f0 EFLAGS: 00010206
[178040.117937] RAX: 00000000102de420 RBX: 0000000000000000 RCX: 000000000fc82600
[178040.117939] RDX: 0000000000002379 RSI: 0000000001092a80 RDI: 000000000fc82610
[178040.117940] RBP: 00007ffcb53b1370 R08: 0000000000000000 R09: 0000000000000000
[178040.117941] R10: 0000000002000000 R11: 000000000fca3000 R12: 00007ffcb53b1918
[178040.117942] R13: 0000000002a677e1 R14: 000000000384fdb8 R15: 00007f1998211000
[178040.117944]  </TASK>
[178040.117945] Mem-Info:
[178040.117947] active_anon:1002489 inactive_anon:182805 isolated_anon:0
                 active_file:0 inactive_file:90 isolated_file:0
                 unevictable:0 dirty:0 writeback:0
                 slab_reclaimable:6615 slab_unreclaimable:14459
                 mapped:28 shmem:2 pagetables:3726 bounce:0
                 kernel_misc_reclaimable:0
                 free:22312 free_pcp:0 free_cma:0
[178040.117952] Node 0 active_anon:4009956kB inactive_anon:731220kB active_file:0kB inactive_file:360kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:112kB dirty:0kB writeback:0kB shmem:8kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 0kB writeback_tmp:0kB kernel_stack:4880kB pagetables:14904kB all_unreclaimable? yes
[178040.117957] Node 0 DMA free:14336kB min:204kB low:252kB high:300kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15996kB managed:15360kB mlocked:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[178040.117962] lowmem_reserve[]: 0 2941 4895 4895 4895
[178040.117965] Node 0 DMA32 free:48148kB min:40484kB low:50604kB high:60724kB reserved_highatomic:0KB active_anon:2570352kB inactive_anon:397856kB active_file:348kB inactive_file:0kB unevictable:0kB writepending:0kB present:3128688kB managed:3032532kB mlocked:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[178040.117970] lowmem_reserve[]: 0 0 1953 1953 1953
[178040.117973] Node 0 Normal free:26764kB min:26892kB low:33612kB high:40332kB reserved_highatomic:0KB active_anon:1439604kB inactive_anon:332856kB active_file:0kB inactive_file:404kB unevictable:0kB writepending:0kB present:2097152kB managed:2000744kB mlocked:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
[178040.117977] lowmem_reserve[]: 0 0 0 0 0
[178040.117980] Node 0 DMA: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 1*2048kB (M) 3*4096kB (M) = 14336kB
[178040.117989] Node 0 DMA32: 900*4kB (UME) 866*8kB (UME) 614*16kB (UME) 258*32kB (UME) 106*64kB (UE) 47*128kB (UME) 12*256kB (UME) 2*512kB (ME) 1*1024kB (M) 1*2048kB (E) 0*4096kB = 48576kB
[178040.118002] Node 0 Normal: 1308*4kB (UME) 1125*8kB (UME) 533*16kB (UME) 125*32kB (UME) 7*64kB (UM) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 27208kB
[178040.118015] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
[178040.118017] 2831 total pagecache pages
[178040.118018] 2664 pages in swap cache
[178040.118019] Swap cache stats: add 395746, delete 393083, find 36414/106189
[178040.118021] Free swap  = 0kB
[178040.118021] Total swap = 524284kB
[178040.118022] 1310459 pages RAM
[178040.118023] 0 pages HighMem/MovableOnly
[178040.118023] 48300 pages reserved
[178040.118024] 0 pages cma reserved
[178040.118025] 0 pages hwpoisoned
[178040.118025] Tasks state (memory values in pages):
[178040.118026] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
[178040.118033] [   1541]     0  1541     5194        1    65536      331             0 systemd-udevd
[178040.118038] [   3130]     0  3130      612       27    40960       16             0 syslogd
[178040.118041] [   3159]     0  3159     1677       24    45056       51             0 crond
[178040.118044] [   3340]     0  3340      728       49    45056       29             0 dhcpcd
[178040.118046] [   3798]     0  3798   239297     3488  2809856    12433             0 homebridge
[178040.118049] [   3860]     0  3860     2298        0    53248       96             0 rsync
[178040.118051] [   3912]     0  3912     1718        0    53248      153         -1000 sshd
[178040.118053] [   3951]     0  3951    42921        1    81920      191             0 zed
[178040.118056] [   4071]     0  4071     1437        0    49152       36             0 agetty
[178040.118058] [   4072]     0  4072     1437        0    49152       35             0 agetty
[178040.118061] [   4073]     0  4073     1437        0    49152       35             0 agetty
[178040.118063] [   4074]     0  4074     1437        0    49152       35             0 agetty
[178040.118065] [   4075]     0  4075     1437        0    53248       34             0 agetty
[178040.118068] [   4076]     0  4076     1437        0    49152       35             0 agetty
[178040.118070] [  27609]     0 27609     1931        1    53248      272             0 sshd
[178040.118073] [  27611]     0 27611     2614        1    61440      581             0 zsh
[178040.118075] [  27637]     0 27637    55742      550   339968    32427             0 emerge
[178040.118078] [  30708]     0 30708     3711        1    61440     1208             0 python3.10
[178040.118081] [  30709]     0 30709     3712        3    65536     1210             0 python3.10
[178040.118083] [  30712]   250 30712      610        1    40960       44             0 sandbox
[178040.118086] [  30713]   250 30713     3011      366    69632      777             0 bash
[178040.118088] [  30729]   250 30729     3109      365    65536      858             0 bash
[178040.118093] [  30744]   250 30744     2186        1    57344      292             0 bash
[178040.118096] [  30745]   250 30745     2198        5    49152      665             0 make
[178040.118098] [  30755]   250 30755     2225        7    53248      674             0 make
[178040.118101] [  16103]   250 16103     2090        8    53248      199             0 sh
[178040.118103] [  16181]   250 16181     2310        8    53248      765             0 make
[178040.118106] [   5411]   250  5411     2126       11    61440      270             0 sh
[178040.118108] [   5447]   250  5447     5687      685    94208     3463             0 make
[178040.118111] [   6961]   250  6961     2014       10    53248      119             0 xg++
[178040.118113] [   6962]   250  6962   294664   251662  2383872    15985             0 cc1plus
[178040.118116] [   6963]   250  6963    73292    69249   638976     1954             0 as
[178040.118118] [   6974]   250  6974     2014       10    49152      120             0 xg++
[178040.118121] [   6975]   250  6975   454915   376925  3567616    42404             0 cc1plus
[178040.118123] [   6976]   250  6976   120851   115045  1011712     3740             0 as
[178040.118126] [   7030]   250  7030     2014      130    53248        0             0 xg++
[178040.118128] [   7031]   250  7031   341446   295573  2633728     8676             0 cc1plus
[178040.118130] [   7032]   250  7032    32584    29232   303104     1256             0 as
[178040.118133] [   7558]   250  7558     2014      130    53248        0             0 xg++
[178040.118135] [   7559]   250  7559    36325    19802   311296        0             0 cc1plus
[178040.118138] [   7560]   250  7560     2480      379    61440        0             0 as
[178040.118141] [   7563]   250  7563     2014      128    49152        0             0 xg++
[178040.118143] [   7564]   250  7564    35253    18334   303104        0             0 cc1plus
[178040.118145] [   7565]   250  7565     2480      378    61440        0             0 as
[178040.118147] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/,task=cc1plus,pid=6975,uid=250
[178040.118175] Out of memory: Killed process 6975 (cc1plus) total-vm:1819660kB, anon-rss:1507700kB, file-rss:0kB, shmem-rss:0kB, UID:250 pgtables:3484kB oom_score_adj:0
gentoozfs ~ # free
               total        used        free      shared  buff/cache   available
Mem:         5048636      247732     4580008          20      220896     4577536
Swap:         524284       55972      468312
gentoozfs ~ # emerge --info
Portage 3.0.43 (python 3.10.9-final-0, default/linux/amd64/17.1, gcc-11, glibc-2.36-r5, 5.15.88-gentoo-x86_64 x86_64)
=================================================================
System uname: Linux-5.15.88-gentoo-x86_64-x86_64-Intel-R-_Xeon-R-_CPU_E5640_@_2.67GHz-with-glibc2.36
KiB Mem:     5048636 total,   2707544 free
KiB Swap:     524284 total,    469156 free
Timestamp of repository gentoo: Thu, 26 Jan 2023 15:00:01 +0000
Head commit of repository gentoo: aa8da0c8d86b04859bf4f3f944bffbef1b772914
sh bash 5.1_p16-r2
ld GNU ld (Gentoo 2.39 p5) 2.39.0
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r2::gentoo
dev-lang/perl:             5.36.0-r1::gentoo
dev-lang/python:           3.10.9::gentoo, 3.11.1::gentoo
dev-util/cmake:            3.24.3::gentoo
dev-util/meson:            0.64.1::gentoo
sys-apps/baselayout:       2.9::gentoo
sys-apps/openrc:           0.45.2-r2::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.71-r5::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r4::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc:             11.3.1_p20221209::gentoo
sys-devel/gcc-config:      2.8::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r5::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-extra-opts:
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo
    priority: 10
    volatile: True

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=native"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe -march=native"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=native"
GENTOO_MIRRORS="rsync://rsync.gtlib.gatech.edu/gentoo https://mirrors.rit.edu/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/zsh"
USE="acl amd64 bzip2 cli client crypt dri efi fdk ffmpeg fortran gdbm git iconv ipv6 libglvnd libtirpc libzfs logrotate multilib ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl syslog test-rust tftp unicode x264 xattr zfs zlib zsh-completions" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="amdgpu intel nouveau radeon vmware" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 8 Tom Dickson 2023-01-26 23:14:29 UTC
My larger system was able to do it just fine:

tank ~ # free
               total        used        free      shared  buff/cache   available
Mem:        65845196    42671728    22592612       15268      580856    22466952
Swap:        4194300           0     4194300
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-26 23:21:13 UTC
(In reply to Tom Dickson from comment #7)
> I received the same issue - and manually installing 11.3.1_p20230120-r1
> didn't fix it, similar error
> 

Not sure if I understand what you mean. The first install of 11.3.1_p20230120-r1 needs to be done with USE=-lto because jobserver in the *running* GCC is broken. Once it's installed, it should be okay.
Comment 10 Tom Dickson 2023-01-27 16:20:34 UTC
I ran: 

USE=-lto emerge -1 \=sys-devel/gcc-11.3.1_p20230120-r1

gentoozfs ~ # gcc --version
gcc (Gentoo 11.3.1_p20230120-r1 p7) 11.3.1 20230120

and it still died with the same error.
Comment 11 Tom Dickson 2023-01-28 03:15:54 UTC
The USE=-lto didn't work (by itself) but after that the -j1 thing did:

MAKEOPTS="-j1" emerge --changed-deps y -NDuqa @world
Comment 12 Tom Dickson 2023-04-25 02:07:49 UTC
I had to do the same again with sys-devel/gcc-12.2.1_p20230304 - but maybe the second command only would have been needed, because it never switched to gcc-11.
Comment 13 Hadrien Lacour 2023-05-21 15:54:42 UTC
Still being hit by this when trying to update from 12.2.1_p20230121-r1 (which I thought had the fix from https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=016184c289f2cc6c6ade496a700a12f135fbae07) to gcc-12.2.1_p20230428-r1

MAKEOPTS is "-j6 -l6" and dmesg shows ~100 lto1-wpa-stream processes in the OOM kill detail. System is an average amd64/17.1/no-multilib one (8GB RAM and 8GB swap, AMD R5 2600 CPU).
Comment 14 Hadrien Lacour 2023-05-21 15:56:54 UTC
gcc -v shows "gcc version 12.2.1 20230121 (Gentoo 12.2.1_p20230121-r1 p10", by the way.
Comment 15 Larry the Git Cow gentoo-dev 2023-05-26 02:50:45 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7a6b2d23ec02e75475a6123254ccd44d73827f39

commit 7a6b2d23ec02e75475a6123254ccd44d73827f39
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-05-26 02:26:36 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-05-26 02:26:36 +0000

    13.2.0: backport split match.pd changes
    
    See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21.
    
    This should improve (reduce) the peak RAM usage when building GCC as it builds
    gimple-match in smaller chunks (previously was one huge generated file) as well
    as speeding up parallel build when used.
    
    i.e. This has benefits for both people building on constrained hardware (because
    -j1 is more effective and just means each smaller chunk is built one-at-a-time,
    not the massive blob) and also for people building with many jobs, as there's
    one less synchronisation point so the build is less serial.
    
    Motivated in particular by the upstream report (PR109927) of this being an issue
    on m68k with RAM usage for the single GCC process building gimple-match.
    
    (IIRC immolo and possibly dilfridge had mentioned similar issues when building
    some arches in qemu as well.)
    
    Note that upstream are planning on splitting insn-* as well so there are further
    improvements in the pipeline (see PR54179, but discussion has occurred far more
    recently on IRC about this and tamar is likely to look at it.).
    
    Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54179 (old bug for splitting insn-*, will be revisited)
    Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84402 (tracker bug for parallelisation, interesting discussion)
    Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927
    Bug: https://bugs.gentoo.org/891909 (not the same issue per-se but related to reduced resource usage)
    Bug: https://bugs.gentoo.org/894256
    Bug: https://bugs.gentoo.org/901317
    Signed-off-by: Sam James <sam@gentoo.org>

 ...l_match.pd-don-t-emit-label-if-not-needed.patch |  114 +
 ...move-commented-out-line-pragmas-unless-vv.patch |   41 +
 ...78_all_match.pd-CSE-the-dump-output-check.patch |   70 +
 ...lit-shared-code-to-gimple-match-exports.c.patch | 2560 ++++++++++++++++++++
 ...pd-automatically-partition-match.cc-files.patch |  524 ++++
 ...e-splits-in-makefile-and-make-configurabl.patch |  258 ++
 13.2.0/gentoo/README.history                       |   10 +
 7 files changed, 3577 insertions(+)
Comment 16 Larry the Git Cow gentoo-dev 2023-05-26 02:51:02 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa5725d7e4407bdfa4137cb0518c9d6ffaf5d8ae

commit aa5725d7e4407bdfa4137cb0518c9d6ffaf5d8ae
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-05-26 02:40:06 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-05-26 02:40:51 +0000

    sys-devel/gcc: backport split match.pd changes to 13.1.1_p20230520
    
    See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927#c21.
    
    This should improve (reduce) the peak RAM usage when building GCC as it builds
    gimple-match in smaller chunks (previously was one huge generated file) as well
    as speeding up parallel build when used.
    
    i.e. This has benefits for both people building on constrained hardware (because
    -j1 is more effective and just means each smaller chunk is built one-at-a-time,
    not the massive blob) and also for people building with many jobs, as there's
    one less synchronisation point so the build is less serial.
    
    Motivated in particular by the upstream report (PR109927) of this being an issue
    on m68k with RAM usage for the single GCC process building gimple-match.
    
    (IIRC immolo and possibly dilfridge had mentioned similar issues when building
    some arches in qemu as well.)
    
    Note that upstream are planning on splitting insn-* as well so there are further
    improvements in the pipeline (see PR54179, but discussion has occurred far more
    recently on IRC about this and tamar is likely to look at it.).
    
    Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54179 (old bug for splitting insn-*, will be revisited)
    Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84402 (tracker bug for parallelisation, interesting discussion)
    Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109927
    Bug: https://bugs.gentoo.org/891909 (not the same issue per-se but related to reduced resource usage)
    Bug: https://bugs.gentoo.org/894256
    Bug: https://bugs.gentoo.org/901317
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc/Manifest                    | 2 +-
 sys-devel/gcc/gcc-13.1.1_p20230520.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-26 02:54:46 UTC
(In reply to Hadrien Lacour from comment #14)
> gcc -v shows "gcc version 12.2.1 20230121 (Gentoo 12.2.1_p20230121-r1 p10",
> by the way.

What make version?
Comment 18 Hadrien Lacour 2023-06-28 23:04:44 UTC
>What make version?
Good question. According to emerge.log, make 4.4.1.