Problem noticed for dev-qt/qtcore-5.11.9999, but older versions likely also affected. x86_64-pc-linux-gnu-g++ is properly used in >99% of calls, but grepping of build log shows 4 calls to g++: # grep -E '(^|[^-])g\+\+[[:space:]]' qtcore-5.11.9999:20180303-004610.log + g++ -dumpmachine + cd /var/tmp/portage/dev-qt/qtcore-5.11.9999/work/qtcore-5.11.9999_build/config.tests && g++ -Wl,--enable-new-dtags -o conftest-out conftest.cpp g++ -c -o qlibraryinfo_final.o -std=c++11 -ffunction-sections -I/var/tmp/portage/dev-qt/qtcore-5.11.9999/work/qtcore-5.11.9999/qmake -I/var/tmp/portage/dev-qt/qtcore-5.11.9999/work/qtcore-5.11.9999/qmake/library -I/var/tmp/portage/dev-qt/qtcore-5.11.9999/work/qtcore-5.11.9999/qmake/generators -I/var/tmp/portage/dev-qt/qtcore-5.11.9999/work/qtcore-5.11.9999/qmake/generators/unix -I/var/tmp/portage/dev-qt/qtcore-5.11.9999/work/qtcore-5.11.9999/qmake/generators/win32 -I/var/tmp/portage/dev-qt/qtcore-5.11.9999/work/qtcore-5.11.9999/qmake/generators/mac -I../include -I../include/QtCore -I../include/QtCore/5.11.0 -I../include/QtCore/5.11.0/QtCore -I../src/corelib/global -I/var/tmp/portage/dev-qt/qtcore-5.11.9999/work/qtcore-5.11.9999/mkspecs/linux-g++ -DQT_VERSION_STR=\"5.11.0\" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=11 -DQT_VERSION_PATCH=0 -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_FOREACH /var/tmp/portage/dev-qt/qtcore-5.11.9999/work/qtcore-5.11.9999/src/corelib/global/qlibraryinfo.cpp g++ -o "../qmake/qmake" main.o meta.o option.o project.o property.o ioutils.o proitems.o qmakebuiltins.o qmakeevaluator.o qmakeglobals.o qmakeparser.o qmakevfs.o pbuilder_pbx.o makefile.o makefiledeps.o metamakefile.o projectgenerator.o unixmake2.o unixmake.o mingw_make.o msbuild_objectmodel.o msvc_nmake.o msvc_objectmodel.o msvc_vcproj.o msvc_vcxproj.o winmakefile.o xmloutput.o qtextcodec.o qutfcodec.o qglobal.o qlogging.o qmalloc.o qnumeric.o qoperatingsystemversion.o qrandom.o qabstractfileengine.o qbuffer.o qdatastream.o qdebug.o qdir.o qdiriterator.o qfile.o qfiledevice.o qfileinfo.o qfilesystemengine.o qfilesystementry.o qfsfileengine.o qfsfileengine_iterator.o qiodevice.o qsettings.o qtemporaryfile.o qtextstream.o qjsonarray.o qjson.o qjsondocument.o qjsonobject.o qjsonparser.o qjsonvalue.o qmetatype.o qsystemerror.o qvariant.o quuid.o qarraydata.o qbitarray.o qbytearray.o qbytearraymatcher.o qcryptographichash.o qdatetime.o qhash.o qlinkedlist.o qlist.o qlocale.o qlocale_tools.o qmap.o qregexp.o qringbuffer.o qstringbuilder.o qstring_compat.o qstring.o qstringlist.o qversionnumber.o qvsnprintf.o qxmlstream.o qxmlutils.o qcore_unix.o qfilesystemengine_unix.o qfilesystemiterator_unix.o qfsfileengine_unix.o qlocale_unix.o qlibraryinfo_final.o -Wl,--gc-sections 'g++ -dumpmachine' does not need to use CXXFLAGS / LDFLAGS, but it should respect CXX and be 'x86_64-pc-linux-gnu-g++ -dumpmachine'. 'g++ -Wl,--enable-new-dtags -o conftest-out conftest.cpp' should at least respect CXX. 'g++ -c -o qlibraryinfo_final.o ...' and 'g++ -o "../qmake/qmake" ...' certainly should be fixed to respect CXX, CXXFLAGS and LDFLAGS.
This causes build failures with -flto, bug 633930. See attachment 526276 [details, diff] for a fix to the eclass.
qtcore-5.7* seems to work fine, so this issue started with qtcore-5.9* Any update, when/if this gets fixed?
I'm still seeing lto/g++ fails in dev-qt/qtcore-5.15.0 such as this one during the install phase: g++ -o "../qmake/qmake" main.o meta.o option.o project.o property.o ioutils.o proitems.o qmakebuiltins.o qmakeevaluator.o qmakeglobals.o qmakeparser.o qmakevfs.o pbuilder_pbx.o makefile.o makefiledeps.o metamakefile.o projectgenerator.o unixmake2.o unixmake.o mingw_make.o msbuild_objectmodel.o msvc_nmake.o msvc_objectmodel.o msvc_vcproj.o msvc_vcxproj.o winmakefile.o xmloutput.o qutfcodec.o qendian.o qglobal.o qlogging.o qmalloc.o qnumeric.o qoperatingsystemversion.o qrandom.o qabstractfileengine.o qbuffer.o qdatastream.o qdebug.o qdir.o qdiriterator.o qfile.o qfiledevice.o qfileinfo.o qfilesystemengine.o qfilesystementry.o qfsfileengine.o qfsfileengine_iterator.o qiodevice.o qsettings.o qtemporaryfile.o qtextstream.o qcborstreamwriter.o qcborvalue.o qjsoncbor.o qjsonarray.o qjsondocument.o qjsonobject.o qjsonparser.o qjsonvalue.o qmetatype.o qsystemerror.o qvariant.o quuid.o qarraydata.o qbitarray.o qbytearray.o qbytearraylist.o qbytearraymatcher.o qcalendar.o qgregoriancalendar.o qromancalendar.o qcryptographichash.o qdatetime.o qhash.o qlist.o qlocale.o qlocale_tools.o qmap.o qregexp.o qringbuffer.o qstringbuilder.o qstring.o qstringlist.o qversionnumber.o qvsnprintf.o qxmlstream.o qxmlutils.o qcore_unix.o qfilesystemengine_unix.o qfilesystemiterator_unix.o qfsfileengine_unix.o qlocale_unix.o qlibraryinfo_final.o -Wl,--gc-sections /usr/lib/gcc/armv7a-unknown-linux-gnueabihf/9.3.0/include/arm_neon.h: In function <E2><80><98>qt_to_latin1_internal<E2><80><99>: /usr/lib/gcc/armv7a-unknown-linux-gnueabihf/9.3.0/include/arm_neon.h:6756:48: fatal error: You must enable NEON instructions (e.g. <E2><80><98>-mfloat-abi=softfp<E2><80><99> <E2><80><98>-mfpu=neon<E2><80><99>) to use these intrinsics. 6756 | return (uint16x8_t)__builtin_neon_vdup_nv8hi ((__builtin_neon_hi) __a); | ^ compilation terminated. lto-wrapper: fatal error: g++ returned 1 exit status compilation terminated. /usr/lib/gcc/armv7a-unknown-linux-gnueabihf/9.3.0/../../../../armv7a-unknown-linux-gnueabihf/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status make[2]: *** [Makefile:196: ../qmake/qmake] Error 1 make[2]: Leaving directory '/var/tmp/portage/dev-qt/qtcore-5.15.0/work/qtbase-everywhere-src-5.15.0_build/qmake' make[1]: *** [Makefile.qmake-aux:235: /var/tmp/portage/dev-qt/qtcore-5.15.0/work/qtbase-everywhere-src-5.15.0_build/qmake/qmake] Error 2 make[1]: Leaving directory '/var/tmp/portage/dev-qt/qtcore-5.15.0/work/qtbase-everywhere-src-5.15.0_build/qmake' make: *** [Makefile:138: sub-qmake-qmake-aux-pro-install_subtargets] Error 2
So far only qt has any env overrides, mainly to force -mfpu=neon: # cat /etc/portage/env/neon.conf VEC_OPTS="-ftree-vectorize -ftree-loop-distribution -fvect-cost-model=cheap" TUNE_OPTS="-march=armv7-a+mp+sec -mtune=generic-armv7-a" FPU_OPTS="-mfloat-abi=hard -mfpu=neon" LINK_OPTS="-flto" COMMON_FLAGS="${TUNE_OPTS} ${LINK_OPTS} ${FPU_OPTS} -O2 -pipe ${VEC_OPTS}" CFLAGS="${COMMON_FLAGS}" CXXFLAGS="${COMMON_FLAGS}" FCFLAGS="${COMMON_FLAGS}" FFLAGS="${COMMON_FLAGS}" LDFLAGS="${CFLAGS} -Wl,-O1 -Wl,--as-needed -fuse-linker-plugin" Everything else in this build was fine with the default flags below: # emerge --info Portage 3.0.2 (python 3.7.7-final-0, default/linux/arm/17.0/armv7a/desktop, gcc-9.3.0, glibc-2.31-r6, 4.19.63-tegra-r0 armv7l) ================================================================= System uname: Linux-4.19.63-tegra-r0-armv7l-ARMv7_Processor_rev_3_-v7l-with-gentoo-2.7 KiB Mem: 2057868 total, 449572 free KiB Swap: 2047996 total, 2039548 free Timestamp of repository gentoo: Mon, 10 Aug 2020 00:45:01 +0000 sh bash 5.0_p18 ld GNU ld (Gentoo 2.33.1 p2) 2.33.1 app-shells/bash: 5.0_p18::gentoo dev-lang/perl: 5.30.3-r1::gentoo dev-lang/python: 2.7.18::gentoo, 3.7.7-r2::gentoo, 3.8.2-r2::gentoo, 3.9.0_beta5::gentoo dev-util/cmake: 3.18.1::gentoo sys-apps/baselayout: 2.7::gentoo sys-apps/openrc: 0.42.1::gentoo sys-apps/sandbox: 2.20::gentoo sys-devel/autoconf: 2.13-r1::gentoo, 2.69-r5::gentoo sys-devel/automake: 1.16.2::gentoo sys-devel/binutils: 2.33.1-r1::gentoo, 2.34-r2::gentoo sys-devel/gcc: 9.3.0::gentoo, 10.2.0::gentoo sys-devel/gcc-config: 2.3.1::gentoo sys-devel/libtool: 2.4.6-r6::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.8::gentoo (virtual/os-headers) sys-libs/glibc: 2.31-r6::gentoo Repositories: gentoo location: /usr/portage sync-type: webrsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sync-webrsync-verify-signature: true nerdboy location: /usr/local/portage/nerdboy masters: gentoo priority: 0 arm_nerdboy location: /usr/local/portage/arm masters: gentoo priority: 1 ACCEPT_KEYWORDS="arm ~arm" ACCEPT_LICENSE="@FREE CC-Sampling-Plus-1.0 linux-fw-redistributable no-source-code BSL-1.1" CBUILD="armv7a-unknown-linux-gnueabihf" CFLAGS="-march=armv7-a+mp+sec+simd -mtune=generic-armv7-a -O2 -pipe -mfpu=neon-fp16 -mfp16-format=ieee -mfloat-abi=hard -ftree-vectorize -ftree-loop-distribution -fvect-cost-model=cheap -flto" CHOST="armv7a-unknown-linux-gnueabihf" 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/sandbox.d /etc/terminfo" CXXFLAGS="-march=armv7-a+mp+sec+simd -mtune=generic-armv7-a -O2 -pipe -mfpu=neon-fp16 -mfp16-format=ieee -mfloat-abi=hard -ftree-vectorize -ftree-loop-distribution -fvect-cost-model=cheap -flto" DISTDIR="/var/cache/portage/distfiles" ENV_UNSET="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="-march=armv7-a+mp+sec+simd -mtune=generic-armv7-a -O2 -pipe -mfpu=neon-fp16 -mfp16-format=ieee -mfloat-abi=hard -ftree-vectorize -ftree-loop-distribution -fvect-cost-model=cheap -flto" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg 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 split-elog strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-march=armv7-a+mp+sec+simd -mtune=generic-armv7-a -O2 -pipe -mfpu=neon-fp16 -mfp16-format=ieee -mfloat-abi=hard -ftree-vectorize -ftree-loop-distribution -fvect-cost-model=cheap -flto" GENTOO_MIRRORS="https://gentoo.osuosl.org/" INSTALL_MASK=" /usr/lib/systemd *.la" LANG="C" LDFLAGS="-Wl,-O1 -Wl,--as-needed -flto -fuse-linker-plugin" LINGUAS="en en_US" MAKEOPTS="-j3" PKGDIR="/var/cache/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" USE="X a52 aac acl alsa arm berkdb bluetooth branding bzip2 cairo caps cdda cdr cli crypt cups dbus dri dts dvd dvdr elogind emboss encode exif flac fortran gdbm gif gpm gtk iconv icu ipv6 jpeg lcms ldap libnotify logrotate mad mng mp3 mp4 mpeg ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt5 readline sdl seccomp spell split-usr ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xml xv xvid zlib" ADA_TARGET="gnat_2018" ALSA_CARDS="tegrahda VEYRONI2S usb-audio" 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_ARM="edsp neon thumb vfp vfpv3 vfpv4 vfp-d32 v7 thumb2 v4 v5 v6" CURL_SSL="openssl" 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" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="pdfimport presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7" QEMU_SOFTMMU_TARGETS="arm" QEMU_USER_TARGETS="arm" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="tegra exynos panfrost vc4" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Created attachment 768241 [details, diff] qt5-build-respect-flags.patch the attached patch resolves the issue.
hm, i misread the qt5_symlink_tools_to_build_dir, it shouldn't be deleted.
Created attachment 768242 [details, diff] qt5-build-respect-flags.patch v2 fix behavior for qtbase non-qtcore packages.
Created attachment 905142 [details, diff] qt5-build.eclass.patch I think qt5-build.eclass misses a nuance of the QtBase build: two instances of qmake are built: one for the build system and one for the host system. These two binaries need to be built with potentially different compilers and flags. * ${QT5_BUILD_DIR}/bin/qmake is the bootstrap copy of qmake that is built before anything else. It needs to run on the *build* system, so it must be compiled with ${BUILD_CXX} ${BUILD_CXXFLAGS} ${BUILD_CPPFLAGS}. * ${QT5_BUILD_DIR}/qmake/qmake is the installation copy of qmake that is built later. (Actually, at present, it's built during src_install(), which is a no-no.) It needs to run on the *host* system, so it must be compiled with ${CXX} ${CXXFLAGS} ${CPPFLAGS}. A significant problem with the QtBase build system is that it provides no sane means of overriding CC, CXX, CXXFLAGS, etc., when building qmake. (The configure script pulls canned values from shipped files beneath ${S}/mkspecs/ depending on the arch and OS.) The existing qt5-build.eclass successfully hacks the configure script to override the compiler variables during bootstrapping, although it overrides them to the _wrong_ values, as it uses the host-system values rather than the build-system values. But then, later in the build when the host qmake is being built, the canned values are used. This absolutely breaks any hope of cross-compiling or using distcc with build machines of foreign architectures, where the fully-qualified compiler name must be used. The attached patch accomplishes three things: 1. Use the build-system (rather than host-system) compiler and flags when bootstrapping qmake. 2. If cross-compiling, clean the build-system qmake objects after bootstrapping, as the host-system build cannot reüse them. 3. Build the host-system qmake during src_compile (rather than during src_install), and use the host-system compiler and flags rather than the canned values.
Created attachment 905143 [details, diff] qt5-ebuild.eclass.patch A small correction to my patch. The host qmake is only to be built as part of dev-qt/qtcore. Other packages with QT5_MODULE="qtbase" should not try to make that target.