Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via or IRC
Bug 595526 - media-libs/libwebp-0.5.1 - error: inlining failed in call to always_inline ‘_mm_cvtepu8_epi16’: target specific option mismatch
Summary: media-libs/libwebp-0.5.1 - error: inlining failed in call to always_inline ‘_...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Graphics Project
: 605500 (view as bug list)
Depends on:
Blocks: CVE-2016-9085
  Show dependency tree
Reported: 2016-09-29 13:27 UTC by Andrey
Modified: 2017-01-18 04:41 UTC (History)
3 users (show)

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

build log (media-libs:libwebp-0.5.1:20160929-080225.log,204.00 KB, text/plain)
2016-09-29 13:46 UTC, Andrey
Allow to disable see2 and sse4.1 auto-detection. (libwebp_disable_sse_auto_detection.patch,908 bytes, patch)
2016-11-02 16:36 UTC, Jan-Matthias Braun
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey 2016-09-29 13:27:01 UTC
Can't build media-libs/libwebp-0.5.1, because of error:

In file included from /var/tmp/portage/media-libs/libwebp-0.5.1/work/libwebp-0.5.1/src/dsp/enc_sse41.c:17:0:
/var/tmp/portage/media-libs/libwebp-0.5.1/work/libwebp-0.5.1/src/dsp/enc_sse41.c: In function ‘TTransform’:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/smmintrin.h:550:1: error: inlining failed in call to always_inl
ine ‘_mm_cvtepu8_epi16’: target specific option mismatch
 _mm_cvtepu8_epi16 (__m128i __X)

Reproducible: Always

Steps to Reproduce:
1. Try to build media-libs/libwebp-0.5.1
Actual Results:  
build error

Expected Results:  
success build

# emerge --info
Portage 2.3.1 (python 2.7.12-final-0, default/linux/amd64/13.0/desktop, gcc-5.4.0, glibc-2.23-r2, 3.14-1-amd64 x86_64)
System uname: Linux-3.14-1-amd64-x86_64-Intel-R-_Xeon-R-_CPU_E3-1230_V2_@_3.30GHz-with-gentoo-2.3
KiB Mem:    16441872 total,    190180 free
KiB Swap:   31248380 total,  31139412 free
Timestamp of repository gentoo: Thu, 29 Sep 2016 05:00:01 +0000
sh bash 4.4
ld GNU ld (Gentoo 2.26.1 p1.0) 2.26.1
app-shells/bash:          4.4::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.0-r1::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.6.2::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.22::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.26.1::gentoo
sys-devel/gcc:            5.4.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.7::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000

    location: /usr/local/portage/xorik-link
    masters: gentoo
    priority: 0

    location: /usr/local/portage/xorik
    masters: gentoo
    priority: 1

    location: /usr/local/portage/dev-zero
    sync-type: laymansync
    sync-uri: git://
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=core2 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mno-movbe -mno-aes -mno-sha -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=1024 -mtune=core2 -fstack-protector-strong"
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/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=core2 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mno-movbe -mno-aes -mno-sha -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=1024 -mtune=core2 -fstack-protector-strong"
EMERGE_DEFAULT_OPTS="--keep-going --fail-clean=y --quiet-build=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles merge-sync metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
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="X a52 aac acl acpi alsa amd64 berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif glamor gnome gpm gtk iconv icu idn ipv6 jpeg laptop lcms libav libnotify mad mmx mmxext mng modules mp3 mp4 mpeg multilib natspec ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt3support readline sdl seccomp session spell sse sse2 sse3 ssl startup-notification svg tcpd threads tiff truetype udev udisks unicode upower usb userlocales vorbis wifi wxwidgets x264 xattr xcb xinerama xml xorg xv xvid zlib" ABI_X86="64" ALSA_CARDS="hda-intel" 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="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="mouse keyboard synaptics evdev joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="ru ru_RU" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="intel i810 i915 i965" 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"
Comment 1 Andrey 2016-09-29 13:46:06 UTC
Created attachment 448418 [details]
build log
Comment 2 Jan-Matthias Braun 2016-11-02 16:36:23 UTC
Created attachment 452184 [details, diff]
Allow to disable see2 and sse4.1 auto-detection.

I am seeing the problem on a machine that has sse4.1 but is building for a machine which does not. The configure script then enables sse4.1 but this fails to compile with the CFLAGS for the destination cpu.

The attached patch uses the CPU_FLAGS_X86 variable to disable see2 and sse4.1 auto-detection.

As far as I understand it, it does not what one would expect ,i.e., enable sse conditioned on the variable, but instead it disables sse when the variable is not set.

Nonetheless, this patch allows to disable and thus compile in the above scenario.
Comment 3 Andrey 2016-11-02 17:49:51 UTC
Yes, you're right. I trying to build on modern PC but use CFLAGS for not so modern. Sorry, I forgot to mention that.

I will try to check the patch today and let you know, if it helps. Thank you
Comment 4 Andrey 2016-11-03 08:40:57 UTC
Yes, the patch helps, thank you!
Comment 5 Mike Gilbert gentoo-dev 2017-01-15 00:58:35 UTC
The problem here is triggered by your CFLAGS. They cause the compiler to be called like this:

gcc ... -msse4.1 ... -mno-sse4.1 ...

So the build system enables sse4.1, but then your CFLAGS disable it.

The code calls the CPUID instruction to determine what flags are enabled at runtime; there's no real need to disable the instructions at build time.
Comment 6 Mike Gilbert gentoo-dev 2017-01-15 01:16:01 UTC
*** Bug 605500 has been marked as a duplicate of this bug. ***
Comment 7 Mike Gilbert gentoo-dev 2017-01-15 01:19:03 UTC
(In reply to Jan-Matthias Braun from comment #2)

Thanks, I pushed a similar patch. Disabling the build time detection is strictly unnecessary, but it's probably the easiest way to resolve this.

commit b804ac8b176f70a0b71ac8dad768f7bb28bd2eda
Author: Mike Gilbert <>
Date:   Sat Jan 14 20:11:46 2017 -0500

    media-libs/libwebp: add USE flags for avx2, sse2, sse4.1, and neon
    Package-Manager: Portage-2.3.3_p32, Repoman-2.3.1_p25

 media-libs/libwebp/libwebp-0.5.2.ebuild | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 8 Jan-Matthias Braun 2017-01-15 13:39:12 UTC
Thanks for pushing a fix.

Actually, I do think it is necessary to disable build time CPU detection. In my case, I am compiling for a weaker CPU on a different machine. A process, which is in general quite painless with Gentoo.
In my experience, you have to disable CPU features which are unavailable on the target machine to get code which executes.

So, thanks for supporting this use case!
Comment 9 SpanKY gentoo-dev 2017-01-17 23:37:10 UTC
(In reply to Jan-Matthias Braun from comment #8)

yep, this is how we're supposed to be writing ebuilds
Comment 10 Mike Gilbert gentoo-dev 2017-01-18 02:20:38 UTC
I am pretty sure runtime CPU detection would have worked just as well here.
Comment 11 Mike Gilbert gentoo-dev 2017-01-18 02:24:43 UTC
To clarify: the build-time check only verifies that the compiler supports flags like -msse2. It does not look at the CPU installed in the build machine at all.

The compiler checks fail due to the -mno-sse2 CFLAGS that you have defined.
Comment 12 SpanKY gentoo-dev 2017-01-18 04:41:46 UTC
(In reply to Mike Gilbert from comment #11)

thanks for the info.  agreed, runtime detection would not be an issue.  i'm not sure if we have a USE flag to control support for this though.  we've just gone with the CPU_FLAGS route and not worried about it.