InBetweenNames / gentooLTO

A Gentoo Portage configuration for building with -O3, Graphite, and LTO optimizations
GNU General Public License v2.0
571 stars 96 forks source link

emerging sys-devel/gcc-11.1.0-r1 fails #760

Open jfikar opened 3 years ago

jfikar commented 3 years ago

I'm not able to emerge gcc-11. I have read about the custom-cflags and filtering -flto* for gcc-11, but it does not help.

It fails very late like this (I think it is after the measuring PGO run, so lto is enabled due to USE=lto?):

...
        -o build/genenums.o /var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-11.1.0/gcc/genenums.c
/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/./prev-gcc/xg++ -B/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/./prev-gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -nostdinc++ -B/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-
x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -B/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstd
c++-v3/include/x86_64-pc-linux-gnu  -I/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/include  -I/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-11.1.0/libstdc++-v3/libsupc++ -L/var/tmp/portage
/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs    -march=native -O3 -fgraphite-identity -flo
op-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=1 -fuse-linker-plugin -pipe -falign-functions=32 -ffunction-sections -fdata-sections -fno-stack-protector -fno-ident -flto-compression-level=19 -fprofi
le-use -fprofile-reproducible=parallel-runs -flto=jobserver -frandom-seed=1 -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-a
ttribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -DGENERATOR_FILE -fno-PIE -static-libstdc++ -static-libgcc  -no-pie -o build/genmddeps \
    build/genmddeps.o build/read-md.o build/errors.o .././libiberty/libiberty.a
/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/./prev-gcc/xg++ -B/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/./prev-gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -nostdinc++ -B/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-
x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -B/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstd
c++-v3/include/x86_64-pc-linux-gnu  -I/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/include  -I/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-11.1.0/libstdc++-v3/libsupc++ -L/var/tmp/portage
/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs    -march=native -O3 -fgraphite-identity -flo
op-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=1 -fuse-linker-plugin -pipe -falign-functions=32 -ffunction-sections -fdata-sections -fno-stack-protector -fno-ident -flto-compression-level=19 -fprofi
le-use -fprofile-reproducible=parallel-runs -flto=jobserver -frandom-seed=1 -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-a
ttribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-
overlength-strings   -DHAVE_CONFIG_H  -DGENERATOR_FILE -fno-PIE -static-libstdc++ -static-libgcc  -no-pie -o build/genconstants \
    build/genconstants.o build/read-md.o build/errors.o .././libiberty/libiberty.a
/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-11.1.0/gcc/genenums.c: In function 'main':
/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-11.1.0/gcc/genenums.c:70:1: warning: '/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/gcc/build/genenums.gcda' profile count data file not found [-Wmissing-profile]
   70 | }
      | ^
/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/./prev-gcc/xg++ -B/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/./prev-gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -nostdinc++ -B/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -B/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu  -I/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/include  -I/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-11.1.0/libstdc++-v3/libsupc++ -L/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs    -march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=1 -fuse-linker-plugin -pipe -falign-functions=32 -ffunction-sections -fdata-sections -fno-stack-protector -fno-ident -flto-compression-level=19 -fprofile-use -fprofile-reproducible=parallel-runs -flto=jobserver -frandom-seed=1 -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -DGENERATOR_FILE -fno-PIE -static-libstdc++ -static-libgcc  -no-pie -o build/genenums \
    build/genenums.o build/read-md.o build/errors.o .././libiberty/libiberty.a
build/gengtype  \   
                    -S /var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-11.1.0/gcc -I gtyp-input.list -w tmp-gtype.state
fatal flex scanner internal error--end of buffer missed
make[3]: *** [Makefile:2784: s-gtype] Error 2
make[3]: *** Waiting for unfinished jobs....
rm gcc.pod gfortran.pod
make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/gcc'
make[2]: *** [Makefile:5024: all-stagefeedback-gcc] Error 2
make[2]: Leaving directory '/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build'
make[1]: *** [Makefile:24505: stagefeedback-bubble] Error 2
make[1]: Leaving directory '/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build'
make: *** [Makefile:24525: profiledbootstrap] Error 2
 * ERROR: sys-devel/gcc-11.1.0-r1::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=sys-devel/gcc-11.1.0-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-devel/gcc-11.1.0-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/sys-devel/gcc-11.1.0-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-devel/gcc-11.1.0-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build'
 * S: '/var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-11.1.0'
 *
 * Please include /var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-build-logs.tar.bz2 in your bug report.
 *

Manually invoking build/gengtype -S /var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-11.1.0/gcc -I gtyp-input.list -w tmp-gtype.state in the right folder /var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/build/gcc gives the same error.

strace shows the last open file was /var/tmp/portage/sys-devel/gcc-11.1.0-r1/work/gcc-11.1.0/gcc/../libcpp/include/line-map.h

I think I already have seen something similar before, but I can't remember the solution anymore :(

Additional info:

#emerge -pv gcc
[ebuild   R   ~] sys-devel/gcc-11.1.0-r1:11::gentoo  USE="custom-cflags* (cxx) fortran graphite lto (multilib) nptl openmp pch pgo zstd (-ada) -d -debug -doc (-fixed-point) -go (-hardened) -jit (-libssp) -nls -objc -objc++ -objc-gc -pie 
-sanitize -ssp -systemtap -test -valgrind -vanilla -vtv" 0 KiB
$cat /etc/portage/package.cflags/local.conf 
dev-libs/libltdl NOCOMMON_OVERRIDE_LIBTOOL=yes
sys-apps/edac-utils NOCOMMON_OVERRIDE_LIBTOOL=yes
sys-devel/gcc *FLAGS-=-flto*

sys-libs/glibc LDFLAGS-="-Wl,--gc-sections" LDFLAGS+="-Wl,--no-gc-sections"
x11-libs/cairo LDFLAGS-="-Wl,--gc-sections" LDFLAGS+="-Wl,--no-gc-sections"
sci-libs/lapack LDFLAGS-="-Wl,--gc-sections" LDFLAGS+="-Wl,--no-gc-sections"

net-misc/rsync LDFLAGS-="-Wl,--strip-all" LDFLAGS+="-Wl,--strip-debug"
# emerge --info
Portage 3.0.20 (python 3.9.5-final-0, default/linux/amd64/17.1, gcc-11.1.0, glibc-2.33, 5.12.6-gentoo x86_64)
=================================================================
System uname: Linux-5.12.6-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E3-1265L_V2_@_2.50GHz-with-glibc2.33
KiB Mem:    16294044 total,    160416 free
KiB Swap:   23068656 total,  22799780 free
Timestamp of repository gentoo: Thu, 17 Jun 2021 12:45:01 +0000
Head commit of repository gentoo: 502c8c6d98afd5a69a0323dfa2ea708c94bbafeb
Timestamp of repository lto-overlay: Tue, 08 Jun 2021 20:25:15 +0000
Head commit of repository lto-overlay: 9496550252c39f1c7cc707587f884e3b948332a0

Timestamp of repository mv: Mon, 14 Jun 2021 08:05:15 +0000
Head commit of repository mv: 91d328c246f3960faeef05cfc4e65b8ba3bb4a6a

sh bash 5.1_p8
ld GNU ld (Gentoo 2.36.1 p3) 2.36.1
distcc 3.3.3 x86_64-pc-linux-gnu [disabled]
ccache version 4.3 [enabled]
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.32.1::gentoo
dev-lang/python:          2.7.18_p10::gentoo, 3.9.5_p2::gentoo
dev-util/ccache:          4.3-r1::gentoo
dev-util/cmake:           3.18.5::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1-r1::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.69-r5::gentoo
sys-devel/automake:       1.16.3-r1::gentoo
sys-devel/binutils:       2.36.1-r1::gentoo
sys-devel/gcc:            9.3.0-r2::gentoo, 10.3.0::gentoo, 11.1.0-r1::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.12::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33::gentoo
Repositories:

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

lto-overlay
    location: /var/db/repos/lto-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/lto-overlay.git
    masters: gentoo mv

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

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -pipe -falign-functions=32 -ffunction-sections -fdata-sections -fno-stack-protector -fno-ident -flto-compression-level=19"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/easy-rsa /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe -pipe -falign-functions=32 -ffunction-sections -fdata-sections -fno-stack-protector -fno-ident -flto-compression-level=19"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=4 --keep-going=y --complete-graph=y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY 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"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs ccache cgroup config-protect-if-modified distlocks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo http://mirrors.dotsrc.org/gentoo/ https://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/ http://ftp.fi.muni.cz/pub/linux/gentoo/ http://gentoo.mirror.web4u.cz/ https://mirror.dkm.cz/gentoo/"
INSTALL_MASK="/usr/share/locale -/usr/share/locale/en -/usr/share/locale/en_US"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O2,-enable-new-dtags,-z,relro,-z,now,-z,combreloc,--hash-style=gnu,--enable-new-dtags,--sort-common,--as-needed -Wl,--gc-sections -Wl,--strip-all -march=native -O2 -pipe -pipe -falign-functions=32 -ffunction-sections -fdata-sections -fno-stack-protector -fno-ident -flto-compression-level=19"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-9e"
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="/tmp/"
USE="a52 aac acpi aio amd64 asm bash-completion bcrypt brotli btrfs bzip2 cdio clang cli cron crypt custom-cflags dcron device-mapper distinct-l djbfft dri dvb exif ext4 f2fs flac fortran fuse gold gzip hardcoded-tables hfs hostonly hwloc iconv ipv6 ithreads jemalloc jemalloc3 jitterentropy lapack largepages libglvnd libtirpc lm-sensors lm_sensors lto lz4 lzma lzo mad mdadm metric mktemp mmx multilib natspec ncurses nistbeacon nptl ntfs offensive openipmi openmp optimization pam pch pcre pgo readline reencrypt romio scp scrypt sha3 smp split-usr sqlite sse sse2 ssl strong-optimization sync-plugin-portage system-jpeg system-sqlite system-zlib tcmalloc tcpd threads unicode x264 x265 xvid xxhash zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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="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="pc" INPUT_DEVICES="evdev" KERNEL="linux" L10N="en en-US" 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-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="ast dummy modesetting" 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:  CC, CPPFLAGS, CTARGET, CXX, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
kanyck commented 3 years ago

Getting the same error. ~~UPD: Looks like custom-cflags has no effect: [ebuild NS ~] sys-devel/gcc-11.1.0-r1:11::gentoo [10.2.0-r5:10::gentoo] USE="(cxx) fortran graphite lto (multilib) nls nptl openmp pch (pie) sanitize ssp (-ada) -custom-cflags% -d -debug -doc (-fixed-point) -go (-hardened) -jit (-libssp) -objc -objc++ -objc-gc -pgo* -systemtap -test -valgrind% -vanilla -vtv* -zstd" 0 KiB ...but still~~

* CFLAGS='-march=native -O3 -fno-semantic-interposition -flto=3 -fno-plt -fgraphite-identity -floop-nest-optimize -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
 * CXXFLAGS='-march=native -O3 -fno-semantic-interposition -flto=3 -fno-plt -fgraphite-identity -floop-nest-optimize -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
 * FFLAGS='-march=native -O3 -fno-semantic-interposition -flto=3 -fno-plt -fgraphite-identity -floop-nest-optimize -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
 * FCFLAGS='-march=native -O3 -fno-semantic-interposition -flto=3 -fno-plt -fgraphite-identity -floop-nest-optimize -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
 * F77FLAGS='-march=native -O3 -fno-semantic-interposition -flto=3 -fno-plt -fgraphite-identity -floop-nest-optimize -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
 * LDFLAGS='-Wl,-O1 -Wl,--as-needed -march=native -O3 -fno-semantic-interposition -flto=3 -fno-plt -fgraphite-identity -floop-nest-optimize -fuse-linker-plugin -pipe'
 * MAKEOPTS='-j3 -l3.5'~~
kanyck commented 3 years ago

I was wrong: custom-cflags do work, just filters out the cflags later on.

InBetweenNames commented 3 years ago

Are you able to emerge it with just -O2 -march=native?

kanyck commented 3 years ago

Yes, as for me, I was able to bootstrap compiling with a simpler CFLAGS (can't recall what they were exactly, but pretty sure -O2 -march=native will do)) After that gcc-11 compiles itself just fine. With -custom-cflags I got the following:

sys-devel/gcc-11.1.0-r1::gentoo was built with the following:
USE="(cxx) fortran graphite lto (multilib) nls nptl openmp pch pgo (pie) sanitize ssp (-ada) -custom-cflags -d -debug -doc (-fixed-point) -go (-hardened) -jit (-libssp) -objc -objc++ -objc-gc -systemtap -test -valgrind -vanilla -vtv -zstd" ABI_X86="(64)"
CFLAGS="-march=native -pipe -Wl,-O1 -Wl,--as-needed -O2"
CXXFLAGS="-march=native -pipe -Wl,-O1 -Wl,--as-needed -O2"
FEATURES="qa-unresolved-soname-deps strict multilib-strict config-protect-if-modified news parallel-fetch xattr usersync unmerge-orphans assume-digests merge-sync protect-owned ipc-sandbox usersandbox sandbox preserve-libs network-sandbox binpkg-logs fixlafiles userpriv pid-sandbox userfetch binpkg-docompress sfperms ebuild-locks unknown-features-warn distlocks unmerge-logs binpkg-dostrip clean-logs"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -march=native -pipe"
InBetweenNames commented 3 years ago

Just to make sure I understand, after first building sys-devel/gcc with -O2 -march=native, you were able to build it with the GentooLTO defaults without any issues?

kanyck commented 3 years ago

Nope, because I added -custom-cflags to gcc build as suggested and this flag overrides CFLAGS gcc is built with. In my previous post I gave actual CFLAGS reported by emerge --info.

jfikar commented 3 years ago

I can confirm @kanyck. It is enough to comment the line source make.conf.lto in /etc/portage/make.conf and gcc emerges just fine. With the line enabled it fails as indicated in the first post. I tried several times, it does not depend on the previous successful build.

enx1998 commented 3 years ago

Hi, I have the same problem with gcc-11.2.0, is there any progress on this issue? Thanks ENx