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

Bug 676894

Summary: www-client/firefox-65.0 - error: inlining failed in call to always_inline '__m128 _mm_fmadd_ps(__m128, __m128, __m128)': target specific option mismatch
Product: Gentoo Linux Reporter: Serge <vanmechelen.serge>
Component: Current packagesAssignee: Mozilla Gentoo Team <mozilla>
Status: RESOLVED NEEDINFO    
Severity: normal CC: bkohler, gentoo, leonchik1976, mno2go, NathanZachary
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: firefox-0.65-build.log.gz

Description Serge 2019-01-30 09:14:59 UTC
Yesterday during a world update I had Firefox 65 in the packages to update.
When I emerged it I got this error:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/immintrin.h:85:0,
from /var/tmp/portage/www-client/firefox-65.0/work/firefox-65.0/gfx/skia/skia/src/opts/SkBitmapFilter_opts.h:14,
from /var/tmp/portage/www-client/firefox-65.0/work/firefox-65.0/gfx/skia/skia/src/core/SkOpts.cpp:39:
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/fmaintrin.h: In function 'avx2::F avx2::mad(avx2::F, avx2::F, avx2::F)':
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/fmaintrin.h:55:1: error: inlining failed in call to always_inline '__m128 _mm_fmadd_ps(__m128, __m128, __m128)': target specific option mismatch
  _mm_fmadd_ps (__m128 __A, __m128 __B, __m128 __C)
gmake[4]: *** [/var/tmp/portage/www-client/firefox-65.0/work/firefox-65.0/config/rules.mk:1133: SkOpts.o] Error 1
gmake[4]: Leaving directory '/var/tmp/portage/www-client/firefox-65.0/work/firefox-65.0/ff/gfx/skia'
gmake[3]: *** [/var/tmp/portage/www-client/firefox-65.0/work/firefox-65.0/config/recurse.mk:74: gfx/skia/target] Error 2
You can see more of it in this post on Gentoo's forums:
https://forums.gentoo.org/viewtopic.php?p=8305590#8305590
Best regards
Comment 1 Sumit Khanna 2019-02-01 03:57:02 UTC
Created attachment 563404 [details]
firefox-0.65-build.log.gz

Firefox 65.0 compile failure build log
Comment 2 Sumit Khanna 2019-02-01 03:58:44 UTC
I'm having similar build issues with Firefox 65 that seem to be centered around the VP8/VP9 video codecs:

22:34.98 /var/tmp/portage/www-client/firefox-65.0/work/firefox-65.0/media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc: In member function 'virtual int webrtc::VP9DecoderImpl::Decode(const webrtc::EncodedImage&, bool, const webrtc::RTPFragmentationHeader*, const webrtc::CodecSpecificInfo*, int64_t)':
22:34.98 /var/tmp/portage/www-client/firefox-65.0/work/firefox-65.0/media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc:947:35: error: 'VPXD_GET_LAST_QUANTIZER' was not declared in this scope
22:34.98        vpx_codec_control(decoder_, VPXD_GET_LAST_QUANTIZER, &qp);




emerge --info
Portage 2.3.51 (python 3.6.5-final-0, default/linux/amd64/17.0, gcc-7.3.0, glibc-2.27-r6, 4.14.52-gentoo x86_64)
=================================================================
System uname: Linux-4.14.52-gentoo-x86_64-Intel-R-_Core-TM-_i7-8550U_CPU_@_1.80GHz-with-gentoo-2.6
KiB Mem:    16266616 total,   2688756 free
KiB Swap:   33554428 total,  22084348 free
Timestamp of repository gentoo: Thu, 31 Jan 2019 08:00:01 +0000
Head commit of repository gentoo: 5d4fe54ecfaa071307bac2c2c74e4a8f43af5760
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.30 p5) 2.30.0
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.5.5::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.9.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.38.3-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.15.1-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.30-r4::gentoo
sys-devel/gcc:            7.3.0-r3::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.14-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.27-r6::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-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 

penguindreams-org
    location: /usr/local/portage
    masters: gentoo
    priority: 0

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

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

gentoo-scala-tools
    location: /var/lib/layman/gentoo-scala-tools
    masters: gentoo
    priority: 50

hamper-overlay
    location: /var/lib/layman/hamper-overlay
    masters: gentoo
    priority: 50

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

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

obs-studio-overlay
    location: /var/lib/layman/obs-studio-overlay
    masters: gentoo
    priority: 50

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

steam-overlay
    location: /var/lib/layman/steam-overlay
    masters: gentoo
    priority: 50

sublime-text
    location: /var/lib/layman/sublime-text
    masters: gentoo
    priority: 50

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

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

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA Sublime PUEL dotnet-eula"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -pipe -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.3/conf"
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"
CXXFLAGS="-O3 -pipe -march=native"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN 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-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j4"
PKGDIR="/usr/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 aalib acl acpi aim alsa amd64 audiofile avahi berkdb bluetooth browserplugin bzip2 cairo cdinstall cdparanoia cdr cleartype cli consolekit corefonts crypt cups cxx dbus dmenu dri dts dvd dvdr dvdread emacs emul-linux-x86 exif fam ffmpeg firefox fish-completion flac fortran ftp gdbm gif glamor gpm gstreamer gtk2 gtkhtml gudev hal hwdb iconv ipv6 java jpeg ldap libcaca libtirpc log4j mad matroska mmx mono mp3 mp4 mpd mpeg msn multilib mysql ncurses nls nptl nptlonly offensive ogg oggvorbis opengl openmp pam pcre pdf png pulseaudio quicktime readline real rtc samba sdl seamonkey seccomp spell sse sse2 ssl svg tcpd theora tiff tracker truetype type1 unicode usb v4l vcd vorbis wayland webp win32codecs wmf xattr xinerama xmms xscreensaver xvid yahoo zlib" ABI_X86="32 64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir uusertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" 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="efi-64" INPUT_DEVICES="synaptics evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi geo gzip limit_conn limit_req map memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi headers_more" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="intel 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, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Sumit Khanna 2019-02-01 07:29:42 UTC
Can confirm that removing the following use flag fixes the build:

www-client/firefox -system-libvpx
Comment 4 Serge 2019-02-01 07:49:05 UTC
(In reply to Sumit Khanna from comment #3)
> Can confirm that removing the following use flag fixes the build:
> 
> www-client/firefox -system-libvpx

My issue has nothing to do with system-libvpx as I had exactly the same issue while disabling that specific USE flag.
Cheers
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2019-02-01 09:57:43 UTC
Duplicate of bug #676762?
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2019-02-01 13:05:20 UTC
Yes, duplicate.

*** This bug has been marked as a duplicate of bug 676762 ***
Comment 7 Serge 2019-02-01 15:10:58 UTC
(In reply to Thomas Deutschmann from comment #6)
> Yes, duplicate.
> 
> *** This bug has been marked as a duplicate of bug 676762 ***

Sorry Thomas but my issue has nothing to do with the libvpx. I tried to build Firefox 65 with the USE flag system-libvpx enabled and disabled and I got exactly the same error:

 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/fmaintrin.h: In function 'avx2::F avx2::mad(avx2::F, avx2::F, avx2::F)':
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/fmaintrin.h:55:1: error: inlining failed in call to always_inline '__m128 _mm_fmadd_ps(__m128, __m128, __m128)': target specific option mismatch
  _mm_fmadd_ps (__m128 __A, __m128 __B, __m128 __C)

As you can see it has nothing to do with:

'VPXD_GET_LAST_QUANTIZER' was not declared in this scope        vpx_codec_control(decoder_, VPXD_GET_LAST_QUANTIZER, &qp);

So the status is certainly not resolved for me.
 
Best regards
Comment 8 Ostashevskyi Viktor 2019-04-03 09:57:58 UTC
I have same error with www-client/firefox-66.0.2:

46:03.19 /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/fmaintrin.h: In function 'avx2::F avx2::mad(avx2::F, avx2::F, avx2::F)':
46:03.19 /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/fmaintrin.h:55:1: error: inlining failed in call to always_inline '__m128 _mm_fmadd_ps(__m128, __m128, __m128)': target specific option mismatch
46:03.19  _mm_fmadd_ps (__m128 __A, __m128 __B, __m128 __C)
46:03.19  ^~~~~~~~~~~~
46:03.19 In file included from /var/tmp/portage/www-client/firefox-66.0.2/work/firefox-66.0.2/gfx/skia/skia/src/core/SkOpts.cpp:44:
46:03.20 /var/tmp/portage/www-client/firefox-66.0.2/work/firefox-66.0.2/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:499:28: note: called from here
46:03.20          return _mm_fmadd_ps(f,m,a);


And this is NOT related to libvpx.

Please, reopen.
Comment 9 Mikkl 2019-04-11 20:01:20 UTC
I had this same error on a machine without system-libvpx that ran inside virtualbox. I removed the "-march=native" CFLAG and it built fine. Maybe you have to remove "avx2" from CPU_FLAGS_X86, too. On my main (non-virtualbox) machine however it builds fine with all the flags enabled (note: the virtualbox-machine should actually have been avx2-capable)
Comment 10 Nathan Zachary (RETIRED) gentoo-dev 2019-05-08 20:14:35 UTC
(In reply to Mikkl from comment #9)
> I had this same error on a machine without system-libvpx that ran inside
> virtualbox. I removed the "-march=native" CFLAG and it built fine. Maybe you
> have to remove "avx2" from CPU_FLAGS_X86, too. On my main (non-virtualbox)
> machine however it builds fine with all the flags enabled (note: the
> virtualbox-machine should actually have been avx2-capable)

I am also experiencing this problem but only inside a VirtualBox VM.
On my other physical nodes, the compilation works just fine.
Inside the VM, it fails at:

/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/include/fmaintrin.h:55:1: error: inlining failed in call to always_inline '__m128 _mm_fmadd_ps(__m128, __m128, __m128)': target specific option mismatch 
  _mm_fmadd_ps (__m128 __A, __m128 __B, __m128 __C)

I originally did NOT have avx2 listed in my CPU flags, but I have added it now to see if it makes a difference (since cpuid2cpuflags reports it CAN be enabled).  I will report back after the lengthy compilation attempt.
Comment 11 Nathan Zachary (RETIRED) gentoo-dev 2019-05-08 22:54:19 UTC
Failed in the same spot WITH avx2 set.
I'm trying one more idea of setting -avx2 via a directive in /etc/portage/env just for Firefox.
Comment 12 Serge 2019-05-09 06:07:40 UTC
(In reply to Nathan Zachary from comment #11)
> Failed in the same spot WITH avx2 set.
> I'm trying one more idea of setting -avx2 via a directive in
> /etc/portage/env just for Firefox.

This will work because this is what I did.
I decided finally to create the env directory and I put a file named firefox.conf under it with these lines: 
CFLAGS="{CFLAGS} -mno-avx2" 
CXXFLAGS="{CXXFLAGS} -mno-avx2" 

Then I created the file package.env with this line in it: www-client/firefox firefox.conf 

As libvpx has avx and avx2 as USE flags I had to disable system-linvpx in package.use for Firefox 
Then Firefox 65 and the subsequent versions did compile correctly.
This chunk of code is the culprit and has to be rewritten:
#elif defined(JUMPER_IS_SSE2) || defined(JUMPER_IS_SSE41) 
    template <typename T> using V = SK_VECTORTYPE(T, 4); 
    using F   = V<float   >; 
    using I32 = V< int32_t>; 
    using U64 = V<uint64_t>; 
    using U32 = V<uint32_t>; 
    using U16 = V<uint16_t>; 
    using U8  = V<uint8_t >; 

    #ifndef __clang__ 
        template <typename T, typename P> SI T unaligned_load_SkNx(const P* p) { return T::Load(p); } 
        template <typename T, typename P> SI void unaligned_store_SkNx(P* p, T v) { v.store(p); } 
        #define unaligned_load unaligned_load_SkNx 
        #define unaligned_store unaligned_store_SkNx 
        template <typename Dst> SI __m128i widen_cast(const U16& src) { static_assert(sizeof(Dst) == sizeof(__m128i), ""); return src.fVec; } 
    #endif 

    SI F mad(F f, F m, F a)  { 
    #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2 
        return _mm_fmadd_ps(f,m,a); <-- this line 
    #else 
        return f*m+a; 
    #endif 
    }  
Best regards
Comment 13 Nathan Zachary (RETIRED) gentoo-dev 2019-07-24 14:32:28 UTC
Even with 68.0.1, the compilation would fail within my VirtualBox environment.
It seems to be fine on my other machines that are NOT inside a VM.
For the VirtualBox installation, the only thing that allowed Firefox to compile properly was to set the following:

# cat /etc/portage/env/firefox.conf
CFLAGS="{CFLAGS} -mno-avx2"
CXXFLAGS="{CSSFLAGS} -mno-avx2"

 
# cat /etc/portage/package.env
www-client/firefox firefox.conf

 
# grep firefox /etc/portage/package.use
www-client/firefox bindist -system-libvpx

Cheers,
Nathan Zachary
Comment 14 Ilia 2019-11-16 17:58:47 UTC
I'm having the same issue with firefox-68.2.0 in VirtualBox
Comment 15 Max Nokhrin 2020-01-03 00:15:02 UTC
(In reply to Serge from comment #12)
> This chunk of code is the culprit and has to be rewritten:
> #elif defined(JUMPER_IS_SSE2) || defined(JUMPER_IS_SSE41) 
>     template <typename T> using V = SK_VECTORTYPE(T, 4); 
>     using F   = V<float   >; 
>     using I32 = V< int32_t>; 
>     using U64 = V<uint64_t>; 
>     using U32 = V<uint32_t>; 
>     using U16 = V<uint16_t>; 
>     using U8  = V<uint8_t >; 
> 
>     #ifndef __clang__ 
>         template <typename T, typename P> SI T unaligned_load_SkNx(const P*
> p) { return T::Load(p); } 
>         template <typename T, typename P> SI void unaligned_store_SkNx(P* p,
> T v) { v.store(p); } 
>         #define unaligned_load unaligned_load_SkNx 
>         #define unaligned_store unaligned_store_SkNx 
>         template <typename Dst> SI __m128i widen_cast(const U16& src) {
> static_assert(sizeof(Dst) == sizeof(__m128i), ""); return src.fVec; } 
>     #endif 
> 
>     SI F mad(F f, F m, F a)  { 
>     #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2 
>         return _mm_fmadd_ps(f,m,a); <-- this line 
>     #else 
>         return f*m+a; 
>     #endif 
>     }  
> Best regards

For what it's worth, this post may be the explanation: https://stackoverflow.com/a/44636348
Comment 16 Thomas Deutschmann (RETIRED) gentoo-dev 2020-10-10 20:38:14 UTC
Is this still an issue for anyone with >=www-client/firefox-78.3.1 or later?
Comment 17 gentoo 2020-12-23 10:05:06 UTC
(In reply to Thomas Deutschmann from comment #16)
> Is this still an issue for anyone with >=www-client/firefox-78.3.1 or later?

Yes, this is still an issue for me, with www-client/firefox-78.6.0. Like Nathan Zachary, I get the described compilation error only within vmware (and not on my other systems running gentoo). Also, the workaround described by Nathan Zachary in https://bugs.gentoo.org/676894#c13 resolves the issue for me.
Comment 18 gentoo 2020-12-23 10:13:56 UTC
In the above comment, I wrote "vmware", but meant "virtualbox" (sorry for the noise :/ ).
Comment 19 Thomas Deutschmann (RETIRED) gentoo-dev 2020-12-23 12:57:05 UTC
Problem is that your hypervisor (virtualbox) doesn't support FMA/AVX.

I am not aware of any configure switch we can tell firefox build system to disable/avoid these instructions, so no CPU flags (except for arm) from Gentoo are used.

However, 

> CFLAGS="-O3 -pipe -march=native"
>                   ^^^^^^^^^^^^^

is your problem.

Don't use "native" in a virtual machine. You should always expand flags based on really in that environment supported flags. Maybe it will be enough to just disable AVX (-fno-avx) or FMA (-fno-fma).
Comment 20 gentoo 2020-12-24 10:52:57 UTC
Thanks for the explanation! Do you think it would be useful to have a subsection on this on https://wiki.gentoo.org/wiki/VirtualBox#Gentoo_guests? (I could add a subsection later...)
Comment 21 Thomas Deutschmann (RETIRED) gentoo-dev 2021-04-29 19:04:24 UTC
*** Bug 751178 has been marked as a duplicate of this bug. ***