Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 797610 - games-fps/quakeforge-0.7.2_p20210601 Build Failure Due to AVX
Summary: games-fps/quakeforge-0.7.2_p20210601 Build Failure Due to AVX
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Games
URL: https://github.com/quakeforge/quakefo...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-22 16:07 UTC by David Turner
Modified: 2021-07-23 00:52 UTC (History)
2 users (show)

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


Attachments
Patched EBuild to disable AVX which builds and runs OK (quakeforge-0.7.2_p20210601-r1.ebuild,4.79 KB, text/plain)
2021-06-22 16:10 UTC, David Turner
Details
Patch for EBuild to Disable AVX (quakeforge-0.7.2_p20210601-ebuild-disable-avx.patch,337 bytes, patch)
2021-06-22 16:12 UTC, David Turner
Details | Diff
Patch to Change __AVX__ Guards to __AVX2__ (quakeforge-0.7.2_p20210601-avx.patch,1.40 KB, patch)
2021-06-23 00:05 UTC, David Turner
Details | Diff
Patch for EBuild to use AVX to AVX2 Patch (ebuild.patch,310 bytes, patch)
2021-06-23 00:06 UTC, David Turner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Turner 2021-06-22 16:07:16 UTC
games-fps/quakeforge-0.7.2_p20210601 fails to emerge with GCC 10.3.0 on x86_64 due to broken avx inlining:

x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I./include  -I./include -D_REENTRANT  -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600   -march=native -O2 -pipe -Wno-psabi -pipe -Wsign-compare -Wtype-limits -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wformat-nonliteral -Wall -fno-common -c -o nq/source/sv_pr_cmds.o nq/source/sv_pr_cmds.c
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/immintrin.h:53,
                 from ./include/QF/simd/vec4d.h:32,
                 from libs/util/simd.c:37:
./include/QF/simd/vec4d.h: In function ‘qmuld’:
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/avx2intrin.h:1049:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_permute4x64_pd’: target specific option mismatch
 1049 | _mm256_permute4x64_pd (__m256d __X, const int __M)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from libs/util/simd.c:37:
./include/QF/simd/vec4d.h:188:6: note: called from here
  188 |  d = _mm256_permute4x64_pd (d, 0xc0);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/immintrin.h:53,
                 from ./include/QF/simd/vec4d.h:32,
                 from libs/util/simd.c:37:
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/avx2intrin.h:1049:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_permute4x64_pd’: target specific option mismatch
 1049 | _mm256_permute4x64_pd (__m256d __X, const int __M)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from libs/util/simd.c:37:
./include/QF/simd/vec4d.h:188:6: note: called from here
  188 |  d = _mm256_permute4x64_pd (d, 0xc0);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/immintrin.h:53,
                 from ./include/QF/simd/vec4d.h:32,
                 from libs/util/simd.c:37:
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/include/avx2intrin.h:1049:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_permute4x64_pd’: target specific option mismatch
 1049 | _mm256_permute4x64_pd (__m256d __X, const int __M)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from libs/util/simd.c:37:
./include/QF/simd/vec4d.h:188:6: note: called from here
  188 |  d = _mm256_permute4x64_pd (d, 0xc0);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:10378: libs/util/simd.lo] Error 1
Comment 1 David Turner 2021-06-22 16:09:16 UTC
This looks similar to bug 672946

I found a solution to allow this to build by passing -mno-avx in the CFLAGS of the ebuild. Will attach a modified ebuild and diff...
Comment 2 David Turner 2021-06-22 16:10:34 UTC
Created attachment 717681 [details]
Patched EBuild to disable AVX which builds and runs OK
Comment 3 David Turner 2021-06-22 16:12:20 UTC
Created attachment 717684 [details, diff]
Patch for EBuild to Disable AVX
Comment 4 Ionen Wolkens gentoo-dev 2021-06-22 16:13:54 UTC
emerge --info?

I suspect it's because have avx but no avx2, explicitly using -mno-avx would work yes although this isn't needed for everyone.

A workaround (bare a proper fix) would be to replace __AVX__ macros by __AVX2__ similarly to dev-libs/ncnn
Comment 5 Ionen Wolkens gentoo-dev 2021-06-22 16:15:20 UTC
It would help if you could report this issue upstream instead.
Comment 6 David Turner 2021-06-22 16:24:26 UTC
emerge --info:

Portage 3.0.20 (python 3.9.5-final-0, default/linux/amd64/17.1/desktop, gcc-10.3.0, glibc-2.33, 5.10.27-gentoo-x86_64 x86_64)
=================================================================
System uname: Linux-5.10.27-gentoo-x86_64-x86_64-Intel-R-_Core-TM-_i5-3570K_CPU_@_3.40GHz-with-glibc2.33
KiB Mem:    16378332 total,   5614940 free
KiB Swap:   31249404 total,  31247076 free
Timestamp of repository gentoo: Tue, 22 Jun 2021 13:30:01 +0000
Head commit of repository gentoo: cf3a2e775ee4a32199338d4d5c27261366bcf568
Head commit of repository sakaki-tools: 571e34870d665e98677caecbd56cf0d399ee4b3c

sh bash 5.1_p8
ld GNU ld (Gentoo 2.35.2 p1) 2.35.2
ccache version 4.3 [enabled]
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.32.1::gentoo
dev-lang/python:          2.7.18_p10::gentoo, 3.8.10_p2::gentoo, 3.9.5_p2::gentoo
dev-lang/rust:            1.52.1::gentoo
dev-util/ccache:          4.3::gentoo
dev-util/cmake:           3.18.5::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1-r1::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.13.4-r2::gentoo, 1.15.1-r2::gentoo, 1.16.3-r1::gentoo
sys-devel/binutils:       2.35.2::gentoo
sys-devel/gcc:            10.3.0::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33::gentoo
Repositories:

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

local-overlay
    location: /usr/local/portage
    masters: gentoo

4nykey
    location: /var/lib/layman/4nykey
    masters: gentoo
    priority: 50

pentoo
    location: /var/lib/layman/pentoo
    masters: gentoo
    priority: 50

sakaki-tools
    location: /usr/local/portage/sakaki-tools
    sync-type: git
    sync-uri: https://github.com/sakaki-/sakaki-tools.git
    masters: gentoo
    priority: 50

swegener
    location: /var/lib/layman/swegener
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/easy-rsa /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=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="CARGO_HOME 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="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs ccache collision-protect 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 splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en en_US en_GB"
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"
USE="X a52 aac acl acpi alsa amd64 berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli crypt css cups dbus dri dts dvb dvd dvdr elogind emboss encode exif fbcon ffmpeg flac fortran gdbm gif gpm gtk gtk2 gui hal iconv icu ipv6 joystick jpeg lcms libglvnd libnotify libtirpc lock mad mmx mng mp3 mp4 mpeg multilib ncurses nls nptl offensive ogg opengl openmp pam pango pcre pdf png policykit ppds readline sdl seccomp session sound spell split-usr sse sse2 ssl startup-notification svg tcpd thunar tiff truetype udev udisks unicode upower usb v4l v4l2 vaapi vdpau vorbis win32codecs wxwidgets x264 xattr xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="snd_hda_intel snd_hda_hdmi" 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="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" 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="evdev joystick keyboard mouse wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9 python3_8" QEMU_SOFTMMU_TARGETS="alpha arm i386 m68k mips mips64 mipsel ppc ppc64 sh4 sparc sparc64 x86_64" QEMU_USER_TARGETS="alpha arm i386 m68k mips mipsel ppc ppc64 sh4 sparc sparc64 x86_64" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="intel nouveau radeon radeonsi r600 fbdev vesa vga" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
Comment 7 David Turner 2021-06-22 16:26:16 UTC
@Ionen: CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" Yes, I think you are right since I have avx here, but not avx2
Comment 8 David Turner 2021-06-23 00:05:28 UTC
Created attachment 717750 [details, diff]
Patch to Change __AVX__ Guards to __AVX2__
Comment 9 David Turner 2021-06-23 00:06:00 UTC
Created attachment 717753 [details, diff]
Patch for EBuild to use AVX to AVX2 Patch
Comment 10 David Turner 2021-06-23 00:07:06 UTC
Have added patches to this bug to replace the __AVX__ guards in the source code with __AVX2__. Have built and this works as expected.

Will look at submitting this as a PR to the upstream at https://github.com/quakeforge/quakeforge
Comment 11 David Turner 2021-06-23 00:15:38 UTC
See https://github.com/quakeforge/quakeforge/pull/18 ...
Comment 12 Ionen Wolkens gentoo-dev 2021-06-23 00:25:03 UTC
(In reply to David Turner from comment #10)
> Have added patches to this bug to replace the __AVX__ guards in the source
> code with __AVX2__. Have built and this works as expected.
That's a workaround rather than a fix, I wanted upstream to look at it given it's potentially more intricate to fix properly.
Comment 13 Ionen Wolkens gentoo-dev 2021-06-23 00:30:35 UTC
On that note, planning to get a new snapshot in after a few more issues are fixed (and drop a few workarounds, including strip-cflags given I was mostly misled by the a bug and it's not really needed).

I'll see what to do with the avx issues then if this persists.
Comment 14 Ionen Wolkens gentoo-dev 2021-06-28 01:45:27 UTC
Was merged upstream (along with exec stack fixes), probably due for that new snapshot soon'ish. Will give it a bit more time due to recent audio refactoring that may still have issues.
Comment 15 David Turner 2021-06-28 15:40:46 UTC
@Ionen: Audio seems fine here, though something seems off with key bindings. I can assign them using the menu and they appear as imt_bind in the quakeforge.cfg in the data directory... but they don't seem to have taken effect i.e. bind WASD for movement and this still seems bound to the cursor keys. This might be a defunct cfg file in some location which does a drop of all bindings, though I can't seem to spot it. Anyway OT for this bug.
Comment 16 Ionen Wolkens gentoo-dev 2021-06-28 15:45:28 UTC
(In reply to David Turner from comment #15)
> @Ionen: Audio seems fine here, though something seems off with key bindings.
> I can assign them using the menu and they appear as imt_bind in the
> quakeforge.cfg in the data directory... but they don't seem to have taken
> effect i.e. bind WASD for movement and this still seems bound to the cursor
> keys. This might be a defunct cfg file in some location which does a drop of
> all bindings, though I can't seem to spot it. Anyway OT for this bug.
Check the README.gentoo, by default it uses the imt_mod table (aka binds you have in in autoexec.cfg) -- to use in-game menu binds you need to set it to imt_0 using "imt imt_0" console command (only need to do this once, it's saved).
Comment 17 David Turner 2021-06-28 19:33:49 UTC
(In reply to Ionen Wolkens from comment #16)
> Check the README.gentoo, by default it uses the imt_mod table (aka binds you
> have in in autoexec.cfg) -- to use in-game menu binds you need to set it to
> imt_0 using "imt imt_0" console command (only need to do this once, it's
> saved).

Ah, I see. Sorry. though you might want to consider adding FORCE_PRINT_ELOG to
the ebuild so that message gets printed on all updates / installs of quakeforge, rather than just new installs to avoid possible spurious bug reports:
https://devmanual.gentoo.org/eclass-reference/readme.gentoo-r1.eclass/index.html
Comment 18 Larry the Git Cow gentoo-dev 2021-07-23 00:52:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77a0ad0a6acd1254c52da3127c2bd34dd718decd

commit 77a0ad0a6acd1254c52da3127c2bd34dd718decd
Author:     Ionen Wolkens <ionen@gentoo.org>
AuthorDate: 2021-07-22 20:09:17 +0000
Commit:     Ionen Wolkens <ionen@gentoo.org>
CommitDate: 2021-07-23 00:47:27 +0000

    games-fps/quakeforge: add 0.7.2_p20210722
    
    Still rather experimental but fixes a few issues kindly fixed
    by upstream after reports.
    
    ebuild changes due to upstream fixes:
    * add vulkan support (experimental but it now builds and mostly works)
    * drop -Wl,-z,noexecstack
    * drop custom-cflags, flags stripping, and -Os workaround
    * drop png-stub patch
    * drop jack workaround
    others:
    * EAPI-8
    * drop IUSE=ipv6
    * add missing einstalldocs
    
    Thanks to David Turner for getting -mno-avx2 fixed upstream (#797610)
    
    Closes: https://bugs.gentoo.org/797610
    Signed-off-by: Ionen Wolkens <ionen@gentoo.org>

 games-fps/quakeforge/Manifest                      |   1 +
 .../quakeforge-0.7.2_p20210722-skipped-tests.patch |  16 ++
 games-fps/quakeforge/metadata.xml                  |   1 +
 .../quakeforge/quakeforge-0.7.2_p20210722.ebuild   | 163 +++++++++++++++++++++
 4 files changed, 181 insertions(+)