Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 730044

Summary: net-libs/webkit-gtk-2.28.2 fails if the machine lacks sse2 instructions
Product: Gentoo Linux Reporter: groche97 <groche97>
Component: Current packagesAssignee: Gentoo Linux Gnome Desktop Team <gnome>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description groche97 2020-06-28 17:43:31 UTC
webkit always broken when it start if the machine haven't sse2 instructions, returns Ilegal instruction.

Reproducible: Always

Steps to Reproduce:
1.Start midori or epiphany
Actual Results:  
returns Ilegal instruction

Expected Results:  
Start the browser

emerge --info in the binhost machine

Portage 2.3.99 (python 3.7.7-final-0, default/linux/x86/17.0/desktop, gcc-9.3.0, glibc-2.30-r8, 4.19.97-gentoo i686)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.19.97-gentoo-i686-Intel-R-_Xeon-R-_CPU_E5645_@_2.40GHz-with-gentoo-2.6
KiB Mem:    24623824 total,  14890756 free
KiB Swap:   12287996 total,  12286452 free
Timestamp of repository gentoo: Thu, 25 Jun 2020 15:00:01 +0000
Head commit of repository gentoo: 1db5ee8f0a8e1c125c1537d4b25b6a6a332032b6
sh bash 5.0_p17
ld GNU ld (Gentoo 2.33.1 p2) 2.33.1
shells/bash:              5.0_p17::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18::gentoo, 3.7.7-r2::gentoo, 3.8.2-r2::gentoo
dev-util/cmake:           3.16.5::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.33.1-r1::gentoo
sys-devel/gcc:            9.3.0::gentoo
sys-devel/gcc-config:     2.2.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.30-r8::gentoo
Repositories:

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

ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="@FREE"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -march=athlon-xp -pipe"
CHOST="i686-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/sandbox.d /etc/terminfo"
CXXFLAGS="-Os -march=athlon-xp -pipe"
DISTDIR="/var/cache/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="-Os -march=athlon-xp -pipe"
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 nodoc noinfo noman parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-Os -march=athlon-xp -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j24"
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"
USE="X a52 aac acl acpi alsa berkdb bluetooth branding bzip2 cairo 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 libtirpc 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 x86 xattr xcb xml xv xvid zlib" ABI_X86="32" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 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="3dnow 3dnowext mmx mmxext sse" 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" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="nouveau" 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, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

net-libs/webkit-gtk-2.26.4-r1::gentoo was built with the following:
USE="X egl geolocation gstreamer introspection jpeg2k jumbo-build libnotify opengl (seccomp) spell (-aqua) -coverage -gles2-only -gnome-keyring -gtk-doc -test -wayland"
FEATURES="protect-owned strict unmerge-orphans buildpkg sandbox userpriv network-sandbox pid-sandbox news usersync noinfo unmerge-logs unknown-features-warn binpkg-docompress userfetch merge-sync ebuild-locks assume-digests parallel-fetch preserve-libs multilib-strict ipc-sandbox fixlafiles noman distlocks sfperms config-protect-if-modified qa-unresolved-soname-deps binpkg-dostrip nodoc usersandbox xattr binpkg-logs"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--no-keep-memory"
Comment 1 Ben 2021-08-06 23:21:25 UTC
Been trying to build webkit-gtk on an AthlonXP.

Currently building net-libs/webkit-gtk-2.32.1 fails at the very end with SIGILL.  I think the build is currently short circuiting the HAVE_SSE2 check.

I saw https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=931052 and it seems that the JIT compiler will use SSE2 and would explain why it builds fine on an SSE2 machine and fail on target machine.

Still in progress of investigating whether JIT can still be disabled and whether this does any good... and whether a non-sse2 machine can still be coaxed to build...
Comment 2 Ben 2021-08-07 14:45:57 UTC
Looks like the NO_JIT path still works (i.e. full interpreter).  It still works but flaky - was able to pull up some websites "eventually" and sometimes need a few refreshes.  Not sure if it's worth to include as an option for non-SSE2 machine.

How I did this: it will require both a patch to 

1. Revert the hardcoding of assuming all 32-bit x86 has SSE2
2. Disable JIT

The former has a risk of breaking other architectures as it's a patch to the source distribution.  I implemented it this way:

diff -ur webkitgtk-2.32.1-old/Source/cmake/WebKitCompilerFlags.cmake webkitgtk-2.32.1/Source/cmake/WebKitCompilerFlags.cmake
--- webkitgtk-2.32.1-old/Source/cmake/WebKitCompilerFlags.cmake 2021-03-25 07:27:32.000000000 -0600
+++ webkitgtk-2.32.1/Source/cmake/WebKitCompilerFlags.cmake     2021-08-06 20:57:31.514282107 -0600
@@ -143,7 +143,7 @@
     endif ()
 
     # Force SSE2 fp on x86 builds.
-    if (WTF_CPU_X86 AND NOT CMAKE_CROSSCOMPILING)
+    if (WTF_CPU_X86 AND NOT CMAKE_CROSSCOMPILING AND ME_I_HAVE_SSE2)
         WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-msse2 -mfpmath=sse)
         include(DetectSSE2)
         if (NOT SSE2_SUPPORT_FOUND)


The latter is an ebuild patch to disable JIT.  In the ebuild's 

local mycmakeargs=()

section, just need to add:

        -DENABLE_JIT=OFF
        -DENABLE_C_LOOP=ON

With these two changes I got it to build and run on x86 without SSE2.

However DO NOT accept these patches as is because again it will break other architectures.  To make it revert to original behavior in this house of cards I presented here, 

        -DME_I_HAVE_SSE2

now needs to be set on X86 that actually has SSE2...

So for now this is just for reference if you want to get no-SSE2 working, whether it should be packaged and how to best do it, I'm not sure.  Very ugly hack.

In any case a CPU_FLAGS_X86_SSE2 should be checked during build time to warn that the ebuild could generate a binary that cannot be run on older x86 machines after a failed day long build...