Created attachment 883423 [details] build.log Build fails in the configure phase: checking byte ordering... unknown configure: error: *** unable to determine endianness Configure in /var/tmp/portage/sys-libs/libstdc++-v3-3.3.6-r4/work/build/gcc failed, exiting. emerge --info Portage 3.0.61 (python 3.12.1-final-0, default/linux/amd64/17.1, gcc-13, glibc-2.38-r9, 6.6.9-gentoo x86_64) ================================================================= System uname: Linux-6.6.9-gentoo-x86_64-Intel-R-_Core-TM-_i5-7400_CPU_@_3.00GHz-with-glibc2.38 KiB Mem: 8123216 total, 287140 free KiB Swap: 16777212 total, 14579196 free Timestamp of repository gentoo: Sat, 27 Jan 2024 21:30:01 +0000 Head commit of repository gentoo: 102c2f5b2beaf5374cf9b510d9adb7abaa21a5b4 Head commit of repository gentoo-static: fbaa062b86d01c107c589eb9ab0dd82b264f7164 Timestamp of repository guru: Sat, 27 Jan 2024 17:35:16 +0000 Head commit of repository guru: 8fed0852166136b43380c168b3892795b3445285 Timestamp of repository khoverlay: Sat, 27 Jan 2024 17:35:13 +0000 Head commit of repository khoverlay: 5d1b3a49ce4000a42e141098ce7c1e37d61ab19a Timestamp of repository libressl: Sat, 27 Jan 2024 17:35:02 +0000 Head commit of repository libressl: f54d6e1caad910fcedd087fc3f5c808f5b281b25 Head commit of repository librewolf: 2e7225f295e1c6fda913be45be6111ba26149a39 Timestamp of repository palemoon: Sat, 27 Jan 2024 17:35:04 +0000 Head commit of repository palemoon: afef13c449eec1deeb3d02f45d0a383a1672d396 Timestamp of repository steam-overlay: Sat, 27 Jan 2024 17:35:06 +0000 Head commit of repository steam-overlay: 840da74af43f8c072ac373ceab331f3afa246bec Head commit of repository stefan_overlay: 7c5393a5aee2356557eb3aa87fe9b3f8ec1b4764 sh bash 5.2_p26 ld GNU ld (Gentoo 2.41 p5) 2.41.0 app-misc/pax-utils: 1.3.7::gentoo app-shells/bash: 5.2_p26::gentoo dev-build/autoconf: 2.13-r8::gentoo, 2.72-r1::gentoo dev-build/automake: 1.16.5-r1::gentoo dev-build/cmake: 3.28.1-r1::gentoo dev-build/libtool: 2.4.7-r2::gentoo dev-build/make: 4.4.1-r1::gentoo dev-build/meson: 1.3.1-r1::gentoo dev-lang/perl: 5.38.2-r1::gentoo dev-lang/python: 2.7.18_p16-r1::libressl, 3.12.1_p1::libressl sys-apps/baselayout: 2.14-r1::gentoo sys-apps/openrc: 0.53::gentoo sys-apps/sandbox: 2.38::gentoo sys-devel/binutils: 2.41-r5::gentoo sys-devel/binutils-config: 5.5::gentoo sys-devel/gcc: 13.2.1_p20240113-r1::gentoo sys-devel/gcc-config: 2.11::gentoo sys-kernel/linux-headers: 6.7::gentoo (virtual/os-headers) sys-libs/glibc: 2.38-r9::gentoo sys-libs/libselinux: 3.6::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 volatile: False sync-rsync-verify-metamanifest: yes sync-rsync-verify-jobs: 1 sync-rsync-extra-opts: sync-rsync-verify-max-age: 24 gentoo-static location: /var/db/repos/gentoo-static sync-type: git sync-uri: https://github.com/NeddySeagoon/gentoo-static.git masters: gentoo volatile: False guru location: /var/db/repos/guru sync-type: git sync-uri: https://github.com/gentoo-mirror/guru.git masters: gentoo volatile: False khoverlay location: /var/db/repos/khoverlay sync-type: git sync-uri: https://github.com/gentoo-mirror/khoverlay.git masters: gentoo volatile: False libressl location: /var/db/repos/libressl sync-type: git sync-uri: https://github.com/gentoo-mirror/libressl.git masters: gentoo volatile: False librewolf location: /var/db/repos/librewolf sync-type: git sync-uri: https://codeberg.org/librewolf/gentoo.git masters: gentoo volatile: False palemoon location: /var/db/repos/palemoon sync-type: git sync-uri: https://github.com/gentoo-mirror/palemoon.git masters: gentoo volatile: False steam-overlay location: /var/db/repos/steam-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/steam-overlay.git masters: gentoo volatile: False stefan_overlay location: /var/db/repos/stefan_overlay sync-type: git sync-uri: https://github.com/stefan11111/stefan_overlay.git masters: gentoo volatile: False Binary Repositories: binhost priority: 9999 sync-uri: https://mirror.bytemark.co.uk/gentoo/releases/amd64/binpackages/17.1/x86-64 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O3 -pipe -march=native -fno-stack-protector -ftree-vectorize -ffast-math -funswitch-loops -fuse-linker-plugin -flto -fdevirtualize-at-ltrans -fno-plt -fno-semantic-interposition -falign-functions=64 -fgraphite-identity -floop-nest-optimize" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /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="-O3 -pipe -march=native -fno-stack-protector -ftree-vectorize -ffast-math -funswitch-loops -fuse-linker-plugin -flto -fdevirtualize-at-ltrans -fno-plt -fno-semantic-interposition -falign-functions=64 -fgraphite-identity -floop-nest-optimize" 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="-O3 -pipe -march=native -fno-stack-protector -ftree-vectorize -ffast-math -funswitch-loops -fuse-linker-plugin -flto -fdevirtualize-at-ltrans -fno-plt -fno-semantic-interposition -falign-functions=64 -fgraphite-identity -floop-nest-optimize" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync" FFLAGS="-O3 -pipe -march=native -fno-stack-protector -ftree-vectorize -ffast-math -funswitch-loops -fuse-linker-plugin -flto -fdevirtualize-at-ltrans -fno-plt -fno-semantic-interposition -falign-functions=64 -fgraphite-identity -floop-nest-optimize" GENTOO_MIRRORS="http://ftp.romnet.org/gentoo/ http://mirrors.xservers.ro/gentoo/ http://bloodnoc.org/~roy/olde-distfiles/" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common" LEX="flex" MAKEOPTS="-j4" PKGDIR="/var/cache/binpkgs" 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/bash" USE="X alsa amd64 asm custom-cflags git grub ipv6 jit jumbo-build libressl lto man minimal native-symlinks olde-gentoo rsync-verify split-usr ssl strip system-man test-rust threads verify-sig" ABI_X86="64" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="libressl" ELIBC="glibc" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="mouse keyboard" KERNEL="linux" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby31" VIDEO_CARDS="nvidia" 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, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Seems like this is a bigger problem that just -flto. It fails to build even with CFLAGS="" CXXFLAGS="" The way to build was to put: CFLAGS="-O3 -pipe -march=native" CXXFLAGS="-O3 -pipe -march=native" in /etc/portage/env/sys-libs/libstdc++-v3. And to put this patch: --- a/gcc/cp/except.c 2024-01-28 13:17:40.624860056 +0200 +++ b/gcc/cp/except.c 2024-01-28 13:18:00.367901034 +0200 @@ -890,8 +890,7 @@ /* Can't be a C library function. */ return 0; - id = DECL_ASSEMBLER_NAME (fn); - return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id)); + return 1; } /* Returns nonzero if an exception of type FROM will be caught by a in /etc/portage/patches/sys-libs/libstdc++-v3.
(In reply to stefan11111 from comment #1) > Seems like this is a bigger problem that just -flto. > It fails to build even with CFLAGS="" CXXFLAGS="" > That is usually expected to fail because of no optimisation. Would help to see the log.
Created attachment 883458 [details] build.log.unoptimized
Created attachment 883459 [details] build.log.flto
(In reply to Sam James from comment #2) > (In reply to stefan11111 from comment #1) > > Seems like this is a bigger problem that just -flto. > > It fails to build even with CFLAGS="" CXXFLAGS="" > > > > That is usually expected to fail because of no optimisation. Would help to > see the log. Didn't think that something could fail to build because of too little optimization. Seems like it does build correctly with: CFLAGS="-O3 -pipe -march=native" CXXFLAGS="-O3 -pipe -march=native" even without patching.
the compiler is highly restrained when not optimizing.. why are you building this, btw?
(In reply to Arsen Arsenović from comment #6) > the compiler is highly restrained when not optimizing.. > > why are you building this, btw? https://github.com/anyc/steam-overlay/issues/354
can you post the config.log(s)?
Created attachment 884078 [details] config logs Configure logs
The endianness test fails because it's looking for an "endian:" string in conftest.o that isn't there when using -flto. There are instances of this issue in other projects. You can either perform the link by changing -c to -shared or you can add the -ffat-lto-objects flag. You don't want to do the latter everywhere though. Need to find out how best to fix it in this case.
I found that the only sane way to do this is to just patch gcc/configure to add -ffat-lto-objects to ac_compile for this specific test. Presumably we don't care about also patching configure.in, which isn't really viable in this case. Once you fix that, you have to do the same thing for the floating point format test immediately afterwards. It's all for nothing though because xgcc eventually fails because it doesn't understand -flto. We have previously stripped out new flags for this reason, but this one probably has the greatest potential impact on performance. Even if we just strip out -flto entirely, configure dies almost immediately with GCC 14. :(
-flto is just a symptom of a bigger problem. I was about to report a nearly identical bug for "-mno-omit-leaf-frame-pointer" and found a few dozen more. So I went and looked into it and the package is using flag-o-matic as a source of truth, i.e. anything the *host* CC thinks is valid gets passed to gcc-3.3.6, minus a very short hand-picked list of exclusions. So that's obviously wrong, and it's only going to be whack-a-mole until the end of time as new C compilers add new switches. There's no reasonable way to work around that to do the right thing either - you'd have to stop the build between stage 1 and 2, find the xgcc binary, re-test the current cflags against it, then resume the build. I've looked at the option-parsing code in gcc itself and trying to extract valid flags from there is completely out of the question. There *is* a static list of valid options in the tarball though: the manpage. Do a `grep -o ' "\(-[^=, ]*\)"' "${S}"/gcc/doc/gcc.1 | sort -u` and it pulls out a list of 955 flags that don't take params. That might be a good starting point, and it's not going to change in future. (Yeah, this doesn't magically make LTO work, but this is a compatibility lib for 20 year old binaries. My 24-core desktop isn't exactly struggling to run UT2004 for lack of it.)
Maybe we should just give up and override CFLAGS="-O2" CXXFLAGS="-O2" rather than play guessing games? This wouldn't fix the GCC 14 problem but what would is creating a wrapper script for gcc that adds -Wno-* for handling the build compiler (not xgcc!) that rolls back the behavior to allow K&R C. Given the scope and purpose of the package, people can just live without their favorite CFLAGS, surely?
(In reply to Eli Schwartz from comment #13) > Maybe we should just give up and override CFLAGS="-O2" CXXFLAGS="-O2" rather > than play guessing games? > > This wouldn't fix the GCC 14 problem but what would is creating a wrapper > script for gcc that adds -Wno-* for handling the build compiler (not xgcc!) > that rolls back the behavior to allow K&R C. > > Given the scope and purpose of the package, people can just live without > their favorite CFLAGS, surely? seems a bit extreme to strip all CFLAGS. even -pipe and -march are stripped here.
I'm hitting this: https://bugs.gentoo.org/show_bug.cgi?id=919184. is this the gcc14 bug? forcing CFLAGS="-O2 -pipe -std=c89" doesn't seem to fix it.
I concur with Eli and Enne. We should just strip it all. It's a brittle package for ancient binaries.
(In reply to Sam James from comment #16) > I concur with Eli and Enne. We should just strip it all. It's a brittle > package for ancient binaries. likewise.. there's no use in expending any extra time anyway
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac3c099a82ddf6c98eab39db95c31e7d7db5e7df commit ac3c099a82ddf6c98eab39db95c31e7d7db5e7df Author: Eli Schwartz <eschwartz@gentoo.org> AuthorDate: 2024-09-24 02:58:46 +0000 Commit: Eli Schwartz <eschwartz@gentoo.org> CommitDate: 2024-09-25 03:17:03 +0000 sys-libs/libstdc++-v3: disable custom user flags entirely This is ancient brittle code -- an ancient, unmaintained version of GCC. It exists solely to provide access to an ancient, unmaintained version of libstdc++.so for ancient, unmaintained binaries that cannot be rebuilt. It doesn't need to be fast, or have cool CFLAGS. People shouldn't even be using it at all. The people who do use it care about compatibility more than anything else, so successfully compiling it should be taken as the gift that it is. With that in mind, we basically strip all flags. We preserve some existing logic to handle -march= values known to exist in this old gcc, and we continue to support -O levels, but we go no further. It's entirely impractical to support arbitrary flags, since every gcc release adds more flags that old versions don't support and then this fails because GCC 3's internal xgcc build cannot handle them. We also take this opportunity to add a workaround for modern C. New versions of GCC barf on some of the code here because it is not legal C99, but again, the point of this package is to provide legacy compatibility for ancient binaries, so... we assume if it ever worked before, it still works. :) Thus, suppress the errors. In order to suppress the errors, we make a wrapper script around the external compiler (not the xgcc one) so that we can apply flags that only affect modern compilers, and aren't parsed by xgcc which would choke on them due to those flags being too new. Closes: https://bugs.gentoo.org/879775 Closes: https://bugs.gentoo.org/919184 Closes: https://bugs.gentoo.org/832016 Closes: https://bugs.gentoo.org/923112 Signed-off-by: Eli Schwartz <eschwartz@gentoo.org> sys-libs/libstdc++-v3/libstdc++-v3-3.3.6-r4.ebuild | 75 +++++++++++----------- 1 file changed, 37 insertions(+), 38 deletions(-)