With version 5.9 (latest, possibly earlier) Qt defaults to assume availability of SSE2 instruction set in CPU. By default this leads to an inoperable Qt:5 environment on older CPUs, which only shows up when building qtgui or actually trying to run a Qt-provided/-linked binary.
At best qt5-build.eclass checks this at configure time and adds '-no-sse2' if the target CPU does indeed not provide the SSE2 instruction set.
For the moment I've tried to work around this by adding EXTRA_ECONF="-no-sse2" to every dev-qt/*:5 package environment, but qt5-build.eclass does also not consider EXTRA_ECONF during configuration.
Steps to Reproduce:
1. Compile dev-qt/qtcore-5.9* on an AthlonXP CPU
2. Run /usr/lib/libQtCore-5.so
libQt5Core.so should print some build and processor capability information.
emerge --info on the affected AthlonXP system.
Portage 2.3.19 (python 3.4.5-final-0, default/linux/x86/17.0/desktop/plasma, gcc-6.4.0, glibc-2.25-r10, 4.12.12-gentoo i686)
System uname: Linux-4.12.12-gentoo-i686-AMD_Athlon-TM-_XP_2400+-with-gentoo-2.4.1
KiB Mem: 1029284 total, 110540 free
KiB Swap: 2104476 total, 2088700 free
Timestamp of repository gentoo: Sat, 10 Feb 2018 02:15:01 +0000
Head commit of repository gentoo: f8b29442417e2e7c83525c6d7a15574b51636cb2
sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
distcc 3.2rc1 i686-pc-linux-gnu [enabled]
dev-lang/python: 2.7.14-r1::gentoo, 3.4.5-r1::gentoo
sys-devel/autoconf: 2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake: 1.11.6-r2::gentoo, 1.13.4::gentoo, 1.15.1-r1::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
ACCEPT_LICENSE="* -@EULA cadsoft AdobeFlash-11.x PUEL Oracle-BCLA-JavaSE google-chrome OPERA-12 RAR"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer -fforce-addr -ftracer"
CONFIG_PROTECT="/etc /usr/lib/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 /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer -fforce-addr -ftracer"
FCFLAGS="-O2 -march=i686 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distcc distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=i686 -pipe"
GENTOO_MIRRORS="http://de-mirror.org/gentoo/ http://ftp.halifax.rwth-aachen.de/gentoo/ http://mirror.leaseweb.com/gentoo/ http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"
LINGUAS="de en en_US"
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"
USE="3dnow 3dnowext X Xaw3d a52 aac aalib acl acpi activities alsa baloo branding bzip2 c++0x cairo caps cdda cdr cli consolekit crypt cups cxx dbus declarative dga dri dts dvd dvdr emboss encode exif fam fbcon ffmpeg flac gif glamor gmp gpm gstreamer htmlhandbook iconv imlib ipv6 jpeg kde kipi kwallet latex lcms ldap libnotify lzma mad mikmod mmx mng modules mp3 mp4 mpeg ncurses nepomuk nls nptl ogg opengl openmp opus pam pango pcre pdf pgo phonon plasma png policykit ppds qml qt3support qt5 quicktime readline sdl seccomp semantic-desktop spell sse ssl startup-notification svg tcpd theora threads tiff truetype udev udisks unicode upower usb v4l vaapi vim-syntax vorbis widgets x264 x86 xattr xcb xcomposite xinerama xml xprint xscreensaver xv xvid zlib" ABI_X86="32" ALSA_CARDS="emu10k1 via82xx bt87x" 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="braindump flow karbon kexi krita plan stage tables sheets words" CAMERAS="canon ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext sse" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock 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 joystick keyboard mouse" KERNEL="linux" L10N="de de-1901 en en_US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer nlpsolver pdfimport" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python3_4 python2_7" RUBY_TARGETS="ruby23" SANE_BACKENDS="dell1600n_net net" USERLAND="GNU" VIDEO_CARDS="nouveau nv vesa vga v4l" 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, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Created attachment 520020 [details, diff]
Support EXTRA_ECONF in qt5-build.eclass
Quick and dirty patch to support EXTRA_ECONF variable while building dev-qt/*:5 packages.
Could you please attach the qtcore build log?
(In reply to Felix Tiede from comment #1)
> Created attachment 520020 [details, diff] [details, diff]
> Support EXTRA_ECONF in qt5-build.eclass
> Quick and dirty patch to support EXTRA_ECONF variable while building
> dev-qt/*:5 packages.
I don't think we should honor EXTRA_ECONF. qt5-build.eclass does not use econf.
(In reply to Michael Palimaka (kensington) from comment #2)
> Could you please attach the qtcore build log?
I can, but it will take a while. Which precise log do you want? With or without my change to qt5-build.eclass?
(In reply to Felix Tiede from comment #4)
> (In reply to Michael Palimaka (kensington) from comment #2)
> > Could you please attach the qtcore build log?
> I can, but it will take a while. Which precise log do you want? With or
> without my change to qt5-build.eclass?
Without the changes. The reason I'm asking is that this seems to be a recurrence of bug #552942, so it'd be helpful to see exactly what's changed.
Created attachment 520958 [details, diff]
Use CPU_FLAGS_X86 for SSE2 decision
qt5-build eclass now relies on CPU_FLAGS_X86 to toggle '-no-sse2' in configure phase, as requested by comment #3.
Created attachment 520960 [details, diff]
Use CFLAGS for SSE2 decision
qt5-build eclass relies on '-msse2' in CFLAGS to toggle '-no-sse2' in configure phase.
I do know that relying on CFLAGS is unsafe as not every user will specify it to this extent, thus I provided this patch for completeness sake, I don't think it is of much use.
(In reply to Michael Palimaka (kensington) from comment #5)
> (In reply to Felix Tiede from comment #4)
> > (In reply to Michael Palimaka (kensington) from comment #2)
> > > Could you please attach the qtcore build log?
> > I can, but it will take a while. Which precise log do you want? With or
> > without my change to qt5-build.eclass?
> Without the changes. The reason I'm asking is that this seems to be a
> recurrence of bug #552942, so it'd be helpful to see exactly what's changed.
Please note: qtcore:5 builds clean, even without -no-sse2 on my AthlonXP, the problem only shows up in qtgui:5, so are you sure you want qtcore build log or is it qtgui build log?
(In reply to Felix Tiede from comment #8)
> (In reply to Michael Palimaka (kensington) from comment #5)
> > (In reply to Felix Tiede from comment #4)
> > > (In reply to Michael Palimaka (kensington) from comment #2)
> > > > Could you please attach the qtcore build log?
> > >
> > > I can, but it will take a while. Which precise log do you want? With or
> > > without my change to qt5-build.eclass?
> > Without the changes. The reason I'm asking is that this seems to be a
> > recurrence of bug #552942, so it'd be helpful to see exactly what's changed.
> Please note: qtcore:5 builds clean, even without -no-sse2 on my AthlonXP,
> the problem only shows up in qtgui:5, so are you sure you want qtcore build
> log or is it qtgui build log?
Whichever is breaking. The reason I asked qtcore is because that seemed to be what was broken per comment #0.
I'm not the original person who filed the but, however, I hit the same issue last night trying to update an older system.
/usr/lib/qt5/bin/qdbusxml2cpp -i struct_marshallers_p.h -a deviceeventcontroller_adaptor.h: dbusxml/DeviceEventController.xml
make: *** [Makefile:1428: deviceeventcontroller_adaptor.h] Illegal instruction
make: Leaving directory '/var/tmp/portage/dev-qt/qtgui-5.9.4-r3/work/qtbase-opensource-src-5.9.4/src/platformsupport/linuxaccessibility'
make: *** [Makefile:331: sub-linuxaccessibility-make_first] Error 2
make: *** Waiting for unfinished jobs....
This is also on an older Athlon XP CPU.
Will attach my build log.
Created attachment 532598 [details]
build.log for qtgui with illegal instruction error due to not having sse2
I tried adding the following from the "Use CFLAGS for SSE2 decision" to a local copy of the qt5-build.eclass file. It doesn't help me any.
I also added "-mno-sse2" to the CFLAGS in make.conf and I end up with "-mno-sse2 -msse2" in the compile statements as it tried to build.
I also found out that part of my problem seems to be this:
~ # /usr/lib/qt5/bin/qdbusxml2cpp
So I tried to rebuild qtdbus which compiles, but I noticed the same "-mno-sse2 -msse2" during the build and I also noticed this in the configure output:
Build type: linux-g++ (i386, CPU features: 3dnow 3dnow-a mmx sse)
Configuration: sse2 sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl enable_new_dtags f16c largefile nostrip shared release c++11 c++14 c++1z concurrent dbus no-gui reduce_exports reduce_relocations stl no-widgets
Mode ................................... release
Optimize release build for size ........ no
Building shared libraries .............. yes
Using C++ standard ..................... C++1z
Using ccache ........................... no
Using gold linker ...................... no
Using new DTAGS ........................ yes
Using precompiled headers .............. no
Using LTCG ............................. no
Target compiler supports:
SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
AVX .................................. AVX AVX2 F16C
AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI
The only way I could get qtgui:5 to build for my AMD Athlon family 6 model 10 x686 CPU was by using Felix Tiede's patch to qt5-build.eclass, linked in comment #6.
That seems to have done the trick for me! Although, I did have to recompile all the other qt 5.9 packages that had already been merged in order for it to work.
I'm now hitting an error with qtwebengine, but that seems to be a different error.
Created attachment 533060 [details]
build.log for qtwebengine with illegal instruction error
Well, I thought I was good to go. I have one last QT5 package that isn't compiling.
Trying to manually run the last step gives me the same Illegal instruction error.
~ # /var/tmp/portage/dev-qt/qtwebengine-5.9.4/work/qtwebengine-opensource-src-5.9.4/src/3rdparty/chromium/tools/gn/out/Release/gn gen /var/tmp/portage/dev-qt/qtwebengine-5.9.4/work/qtwebengine-opensource-src-5.9.4/src/core/Release --script-executable=/var/tmp/portage/dev-qt/qtwebengine-5.9.4/temp/python2.7/bin/python2 --args='use_qt=true is_component_build=false is_shared=true enable_media_router=false enable_nacl=false enable_remoting=false enable_web_speech=false use_experimental_allocator_shim=false use_allocator="none" v8_use_external_startup_data=false treat_warnings_as_errors=false enable_basic_printing=true enable_print_preview=true enable_pdf=true enable_plugins=true enable_widevine=true enable_spellcheck=true enable_webrtc=true proprietary_codecs=true ffmpeg_branding="Chrome" symbol_level=0 remove_webcore_debug_symbols=true remove_v8base_debug_symbols=true use_cups=false use_gconf=false use_gio=false use_gnome_keyring=false use_kerberos=false linux_use_bundled_binutils=false use_nss_certs=true use_openssl_certs=false no_delete_null_pointer_checks=true is_clang=false custom_toolchain="/var/tmp/portage/dev-qt/qtwebengine-5.9.4/work/qtwebengine-opensource-src-5.9.4/src/toolchain:target" host_toolchain="/var/tmp/portage/dev-qt/qtwebengine-5.9.4/work/qtwebengine-opensource-src-5.9.4/src/toolchain:host" host_cpu="x86" pkg_config="pkg-config" use_system_zlib=true use_system_minizip=true use_system_libpng=true use_system_libjpeg=true use_system_harfbuzz=true use_pulseaudio=false use_alsa=true use_system_libffi=true use_system_libevent=true use_system_libwebp=true use_system_libxml=true use_system_libxslt=true use_system_opus=true use_system_snappy=true use_system_libvpx=true use_system_icu=true icu_use_data_file=false use_system_ffmpeg=true use_system_re2=true use_sysroot=false enable_session_service=false enable_notifications=false toolkit_views=false use_gold=false is_debug=false qtwebengine_target="/var/tmp/portage/dev-qt/qtwebengine-5.9.4/work/qtwebengine-opensource-src-5.9.4/src/core/Release:QtWebEngineCore"' --root=/var/tmp/portage/dev-qt/qtwebengine-5.9.4/work/qtwebengine-opensource-src-5.9.4/src/3rdparty/chromium
*** Bug 654076 has been marked as a duplicate of this bug. ***
The problem is that qtcore is forcing sse2 so long as the compiler supports it. It builds clean but fails with illegal instruction because there are no runtime checks for the CPU feature. This is why failures first appear when building other packages linked against libQt5Core.
More details in bug #654076, which I have just marked as a duplicate of this one. Since this is an upstream decision impacting older 32 bit processors that dont have SSE2 support, Felix patch to the eclass linked from comment 6 is probably the cleanest way to fix this for those of us still using older processors. It would be easier if we could pass EXTRA_ECONF, but these packages ignore it.
*** Bug 699496 has been marked as a duplicate of this bug. ***
Confirming that the eclass patch from comment #6 allows me to build qtcore qtdbus and qtgui 5.12.3 on a Pentium 3. This was a blocker for emerging xfce4 for me.
Created attachment 597512 [details, diff]
Atltenative patch to qt5-build.eclass
I'm attaching an alternative patch to the one referenced in comment #6. This one follows X86_CPU_FLAGS instead of CFLAGS, in the sense that it adds -no-sse2 to Qt5 config when sse2 is *not* set in X86_CPU_FLAGS. Acknowledging that one could call it a matter of personal preference, I personally think this approach is more "Gentoo". In general, Gentoo packages use X86_CPU_FLAGS to determine what instruction sets to compile for, and the variable is easier to set on a per-package basis.
Furthermore, I have written a post-sync script for the gentoo repo to apply the patch after every sync. The script can easily be used for either patch attached to this bug. Instructions for its use can be found here: https://forums.gentoo.org/viewtopic-t-1104574.html
(The patch obviously follows CPU_FLAGS_X86, instead of X86_CPU_FLAGS. Apologies for the consistent typo in my previous comment.)
It was pointed out to me in the forums that bug #552942 seems to cover this issue as well. In the context of that bug a workaround was implemented by the Gentoo devs in qt5-build.eclass, which was later reverted due to it causing build errors.
Ok, I just realized that the patch I uploaded earlier today is in fact the comment #6 patch, but with updated offsets to match the current version of qt5-build.eclass. I diffed my own version of the patch in the process of creating the post-sync repo workaround that I mentioned, and totally forgot I pulled the original version from this very bug.
While we're at it, my comments concerning the comment #6 patch actually apply to the patch referred to in comment #7 (in other words, I agree with what Felix Tiede had already stated).
My sincere apologies for the noise caused by this, I feel appropriately stupid for it.
I can confirm the same issue on an old x86 machine without the SSE2 instruction set.
Im affected as well.