Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 945838 - dev-build/cmake: aborts with "std::bad_alloc" when configuring dev-qt/qtbase-6.8.1 if(?) built with clang on aarch64 and lto? (exact cause unknown)
Summary: dev-build/cmake: aborts with "std::bad_alloc" when configuring dev-qt/qtbase-...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 915000
  Show dependency tree
 
Reported: 2024-12-04 04:42 UTC by James Calligeros
Modified: 2024-12-21 07:03 UTC (History)
7 users (show)

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


Attachments
build.log (build.log,603.93 KB, text/plain)
2024-12-04 04:46 UTC, James Calligeros
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Calligeros 2024-12-04 04:42:32 UTC
dev-qt/qtbase-6.8.1 fails to build on arm64. Tested with two Apple Silicon Macs, both give the same failure mode.

Reproducible: Always

Steps to Reproduce:
1. emerge --sync
2. emerge -auvDN @world
3. dev-qt/qtbase needs updating
Actual Results:  
dev-qt/qtbase-6.8.1 fails to build

Expected Results:  
dev-qt/qtbase-6.8.1 should build

Portage 3.0.66.1 (python 3.12.7-final-0, default/linux/arm64/23.0/desktop/plasma/systemd, gcc-14, glibc-2.40-r5, 6.12.1-asahi-4 aarch64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.12.1-asahi-4-aarch64-with-glibc2.40
KiB Mem:    32724464 total,  27335424 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Wed, 04 Dec 2024 00:00:00 +0000
Head commit of repository gentoo: 3209ea08d76fd22e91876ad938f820a3d838cda1
Head commit of repository asahi: 9adecf28ad0fa151fe06a4da302942fd351a1146

Timestamp of repository kde: Tue, 03 Dec 2024 21:18:23 +0000
Head commit of repository kde: 6d66e78a89a81bc9ffee1cc35fdeff7bd7752bd1

sh bash 5.2_p37
ld GNU ld (Gentoo 2.43 p3) 2.43.1
distcc 3.4 aarch64-unknown-linux-gnu [disabled]
app-misc/pax-utils:        1.3.8::gentoo
app-shells/bash:           5.2_p37::gentoo
dev-build/autoconf:        2.71-r7::gentoo, 2.72-r1::gentoo
dev-build/automake:        1.17-r1::gentoo
dev-build/cmake:           3.31.1::gentoo
dev-build/libtool:         2.5.4::gentoo
dev-build/make:            4.4.1-r100::gentoo
dev-build/meson:           1.6.0::gentoo
dev-java/java-config:      2.3.4::gentoo
dev-lang/perl:             5.40.0::gentoo
dev-lang/python:           3.12.7_p1::gentoo, 3.13.0::gentoo
dev-lang/rust-bin:         1.82.0-r100::gentoo, 1.83.0::gentoo
sys-apps/baselayout:       2.17::gentoo
sys-apps/sandbox:          2.40::gentoo
sys-apps/systemd:          256.9::gentoo
sys-devel/binutils:        2.43-r2::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/clang:           18.1.8-r6::gentoo, 19.1.5::gentoo
sys-devel/gcc:             14.2.1_p20241116::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             18.1.8::gentoo, 19.1.5::gentoo
sys-devel/llvm:            18.1.8-r6::gentoo, 19.1.5::gentoo
sys-kernel/linux-headers:  6.11::gentoo (virtual/os-headers)
sys-libs/glibc:            2.40-r5::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-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts:

asahi
    location: /home/james/asahi/asahi-overlay
    sync-type: git
    sync-uri: https://github.com/chadmed/asahi-overlay
    masters: gentoo
    volatile: True

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo
    volatile: False

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

Binary Repositories:

gentoobinhost
    priority: 1
    sync-uri: https://gentoo.osuosl.org/releases/arm64/binpackages/17.0/arm64

ACCEPT_KEYWORDS="arm64 ~arm64"
ACCEPT_LICENSE="@FREE"
AR="llvm-ar"
CBUILD="aarch64-unknown-linux-gnu"
CC="clang"
CFLAGS="-mcpu=apple-m2 -fPIC -O3 -pipe -mbranch-protection=standard -flto=thin"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /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"
CXX="clang++"
CXXFLAGS="-mcpu=apple-m2 -fPIC -O3 -pipe -mbranch-protection=standard -flto=thin"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="-a --jobs=6 --load-average=12 --keep-going=y"
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 -fPIC -pipe"
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 merge-wait multilib-strict network-sandbox news parallel-fetch parallel-install 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 xattr"
FFLAGS="-O3 -fPIC -pipe"
GENTOO_MIRRORS="https://mirror.aarnet.edu.au/pub/gentoo/"
LANG="en_AU.utf8"
LDFLAGS="-fuse-ld=lld -unwindlib=libunwind -rtlib=compiler-rt -Wl,--as-needed          -Wl,-O3 -pie -Wl,-zrelro -Wl,-zpack-relative-relocs -Wl,--undefined-version"
LEX="flex"
MAKEOPTS="-j56 -l12"
NM="llvm-nm"
OBJCOPY="llvm-objcopy"
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"
RANLIB="llvm-ranlib"
RUSTFLAGS="-C opt-level=3 -C target-cpu=apple-m2"
SHELL="/bin/bash"
USE="a52 aac acl acpi activities alsa arm64 avahi bluetooth branding bzip2 cairo cdda cdr clang crypt cups dbus declarative dri dts dvdr encode exif flac gdbm gif gpm gui iconv icu ipv6 iwd jpeg kde kf6compat kwallet lcms libnotify libtirpc libunwind lv2 mad mng mp3 mp4 mpeg ncurses networkmanager nls ogg opengl pam pango pcre pdf pipewire plasma png policykit ppds pulseaudio qml qt6 readline samba screencast sdl seccomp semantic-desktop sound spell ssl startup-notification svg systemd test-rust tiff truetype udev udisks unicode upower usb v4l v4l2 vorbis vulkan wayland widgets wxwidgets x264 xattr xcb xft xml xv xvid zeroconf zlib zstd" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio 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_ARM="edsp neon vfp vfpv3 vfpv4 vfp-d32 aes sha1 sha2 crc32 v8" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" QEMU_USER_TARGETS="aarch64" RUBY_TARGETS="ruby32" VIDEO_CARDS="asahi honeykrisp virgl" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, ARFLAGS, AS, ASFLAGS, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 James Calligeros 2024-12-04 04:46:48 UTC
Created attachment 913285 [details]
build.log
Comment 2 Ionen Wolkens gentoo-dev 2024-12-04 04:48:17 UTC Comment hidden (obsolete)
Comment 3 Ionen Wolkens gentoo-dev 2024-12-04 04:59:44 UTC
Are you still able to rebuild qtbase-6.7.3?

emerge -1 "~dev-qt/qtbase-6.7.3"

It could be something that's newly triggered with 6.8.1 by accident, but I'm getting the impression there's an issue with the toolchain rather than qtbase.

You could try gcc too.
Comment 4 Ionen Wolkens gentoo-dev 2024-12-04 05:21:12 UTC
Also, anything interest in dmesg? I'm not sure which executable resulted in that "(core dumped)"
Comment 5 James Calligeros 2024-12-04 05:30:10 UTC
=dev-qt/qtbase-6.7.3-r2 builds and merges successfully with clang and gcc. Using gcc on 6.8.1 results in the same failure.
Comment 6 James Calligeros 2024-12-04 05:30:31 UTC
Nothing interesting in dmesg either.
Comment 7 Ionen Wolkens gentoo-dev 2024-12-04 05:54:25 UTC
I know that sam did manage to build qtbase-6.8.1 w/ gcc on aarch64 given was testing qtwebengine-6.8.1 there, so it's probably due to something special here (*FLAGS, llvm- tools usage, etc...).

I did try to build with a "similar" toolchain layout on amd64 but it's fine there, probably(?) either aarch64-specific or these machines in particular (but I can't test myself, so I have no idea).
Comment 8 Ionen Wolkens gentoo-dev 2024-12-04 06:01:49 UTC
CC'ing sam in case happen to have an idea
Comment 9 Ionen Wolkens gentoo-dev 2024-12-04 06:20:19 UTC
Wonder if it's actually cmake that's aborting? With the error appearing like this I think it could.

Just in case, does anything change if you rebuild cmake with gcc and C(XX)FLAGS=-O2 + default LDFLAGS?
Comment 10 James Calligeros 2024-12-04 06:49:03 UTC
I had rebuilt cmake before filing the bug, but I just did it again with my gcc env and... Yep, that did it :)

I may have time to investigate later, but since clang's -O3 doesn't include any "risky" optimisations and I don't use -ffast-math or anything like that I think it could be LTO behaviour.
Comment 11 Ionen Wolkens gentoo-dev 2024-12-04 07:02:56 UTC
Nice, guess I'll re-assign to cmake for now.
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-04 12:20:27 UTC
I'll take a look but I can't promise to run it down all the way at least for a few days.
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-04 18:00:25 UTC
I can't reproduce it with CFLAGS="-O3 -fPIC -mbranch-protection=standard -march=native -flto=thin" CXXFLAGS="-O3 -fPIC -mbranch-protection=standard -march=native -flto" LDFLAGS="-Wl,-O1" CC=clang CXX=clang++ emerge -v1 cmake && emerge -v1 qtwebengine on neoverse-n1 and so can't do anything here.
Comment 14 Ionen Wolkens gentoo-dev 2024-12-05 02:15:13 UTC
(In reply to Sam James from comment #13)
> I can't reproduce it with CFLAGS="-O3 -fPIC -mbranch-protection=standard
> -march=native -flto=thin" CXXFLAGS="-O3 -fPIC -mbranch-protection=standard
> -march=native -flto" LDFLAGS="-Wl,-O1" CC=clang CXX=clang++ emerge -v1 cmake
> && emerge -v1 qtwebengine on neoverse-n1 and so can't do anything here.
It's qtbase that's failing (my comment may have been misleading when I said qtwebengine given I meant -> "this means did qtbase too").
Comment 15 Ionen Wolkens gentoo-dev 2024-12-05 02:28:46 UTC
(In reply to Ionen Wolkens from comment #14)
> (In reply to Sam James from comment #13)
> CXXFLAGS="-O3 -fPIC -mbranch-protection=standard -march=native -flto"
fwiw may want to use =thin for CXXFLAGS too if that can change anything, CFLAGS are barely used by cmake.

LDFLAGS has a few things too, albeit I doubt these could change much (already need lld for =thin, so that means it's being used through default-lld anyway).
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-05 09:27:50 UTC
Ah, thank you! Fixed both inconsistent CXXFLAGS (added =thin) and tried qtbase but no luck.

I'll try LDFLAGS given getting nowhere but I don't expect it to make a difference.

James, I can give guidance for narrowing it down at least, just can't actually debug it.