Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 608640 - www-client/chromium-58.0.3004.3 error: ‘_mm256_setr_m128’ was not declared in this scope
Summary: www-client/chromium-58.0.3004.3 error: ‘_mm256_setr_m128’ was not declared in...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Chromium Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-08 16:18 UTC by Mike Lothian
Modified: 2017-05-24 16:31 UTC (History)
5 users (show)

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


Attachments
build.log (build.log.xz,78.83 KB, application/x-xz)
2017-02-08 16:18 UTC, Mike Lothian
Details
Patch for chromium-58.0.3029.19 (chromium-58.0.3029.19_mm256_setr_m128.patch,3.44 KB, patch)
2017-03-19 16:15 UTC, Vitaliy Batichko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Lothian 2017-02-08 16:18:23 UTC
Created attachment 462864 [details]
build.log

Chromium fails to build with GCC these errors don't happen with Clang

Something similar happened with OpenCV https://github.com/opencv/opencv/commit/ec47a0a6def8b60a26b6b3697ba3eda65d84ee66

It looks like Chromium requires some defines to be declared for it to compile with GCC which is probably an upstream issue
Comment 1 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2017-02-08 20:58:49 UTC
Please post emerge --info, I was compiling with gcc and did not hit this issue.
Comment 2 Mike Lothian 2017-02-09 09:02:57 UTC
Portage 2.3.3 (python 3.5.2-final-0, default/linux/amd64/13.0/desktop/plasma/systemd, gcc-6.3.0, glibc-2.23-r3, 4.9.8-gentoo x86_64)
=================================================================
System uname: Linux-4.9.8-gentoo-x86_64-Intel-R-_Core-TM-_i5-6300U_CPU_@_2.40GHz-with-gentoo-2.3
KiB Mem:     8174464 total,   7410736 free
KiB Swap:          0 total,         0 free
sh bash 4.4_p11
ld GNU gold (Gentoo 2.27 p1.0 2.27) 1.12
app-shells/bash:          4.4_p11::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1_rc4::gentoo
dev-lang/python:          2.7.12::gentoo, 3.5.2::gentoo
dev-util/cmake:           3.7.2::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.23.2::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.13.4-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            6.3.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.9::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: https://github.com/gentoo/gentoo
    priority: -1000

FireBurn
    location: /home/fireburn/Overlay
    sync-type: git
    sync-uri: https://github.com/FireBurn/Overlay
    sync-user: fireburn:users
    masters: gentoo

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -Wno-narrowing"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /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"
CXXFLAGS="-O2 -march=native -pipe -Wno-narrowing -fno-delete-null-pointer-checks -flifetime-dse=1 -fpermissive"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask-write --with-bdeps y --complete-graph y --keep-going"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync 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"
GENTOO_MIRRORS="http://mirror.qubenet.net/mirror/gentoo/ http://gentoo.osuosl.org http://distfiles.gentoo.org"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
MAKEOPTS="-j3"
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 acl acpi adobe-cff aio alsa amd64 berkdb branding bzip2 cairo cdr cleartype_hinting cli connection-sharing cracklib crypt cups custom-cflags custom-optimization cxx dbus declarative djvu dri drm dts dvdr ebook egl emboss encode evdev exif fam ffmpeg firefox flac flash fontconfig fortran gbm gdbm gif git glamor gnutls gold gpm gstreamer gtk gtkstyle hidpi hotwording iconv icu inotify ipv6 ithreads javafx jpeg kipi lcms ldap libass libinput libkms libnotify lm_sensors lua lzma lzo mad minizip mng mobi modules mp3 mp4 mpeg mpris mpx mtp multilib ncurses network networkmanager nls nptl nsplugin ogg opengl openmp pam pango pcre pcre16 pdf pdfimport phonon plasma png policykit ppds prelink proprietary-codecs pulseaudio qml qrcode qt3support qt5 readline realtime s3tc samba sdl seccomp secure-delete session source spell ssl startup-notification svg sync-plugin-portage syslog system-cairo system-ffmpeg system-harfbuzz system-icu system-jpeg system-libvpx system-sqlite systemd tcmalloc tcpd theora threads thumbnail tiff touchpad trayicon truetype udev udisks unicode upower usb user-session vmware_guest_linux vorbis wayland wayland-compositor webdav widevine widgets wifi winbind wxwidgets x264 xa xattr xcb xcomposite xinerama xml xscreensaver 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 access_compat" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" 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="pc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" L10N="en-GB en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en-GB en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python3_5" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="vmware" 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, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

It also happened on a machine with:

Portage 2.3.3 (python 3.5.2-final-0, default/linux/amd64/13.0/desktop/plasma/systemd, gcc-6.3.0, glibc-2.23-r3, 4.10.0-rc5-agd5f+ x86_64)
=================================================================
System uname: Linux-4.10.0-rc5-agd5f+-x86_64-Intel-R-_Core-TM-_i7-6820HK_CPU_@_2.70GHz-with-gentoo-2.3
KiB Mem:    32762484 total,   8798580 free
KiB Swap:          0 total,         0 free
sh bash 4.4_p11
ld GNU gold (Gentoo 2.27 p1.0 2.27) 1.12
app-shells/bash:          4.4_p11::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1_rc4::gentoo
dev-lang/python:          2.7.12::gentoo, 3.5.2::gentoo
dev-util/cmake:           3.7.2::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.23.2::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            6.3.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.9::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: https://github.com/gentoo/gentoo
    priority: -1000

FireBurn
    location: /home/fireburn/Overlay
    sync-type: git
    sync-uri: https://github.com/FireBurn/Overlay
    sync-user: fireburn:users
    masters: gentoo

gamerlay
    location: /var/lib/layman/gamerlay
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/gamerlay.git
    masters: gentoo
    priority: 50

games-overlay
    location: /var/lib/layman/games-overlay
    sync-type: laymansync
    sync-uri: git://github.com/hasufell/games-overlay.git
    masters: gentoo
    priority: 50

kde
    location: /var/lib/layman/kde
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/kde.git
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/lib/layman/steam-overlay
    sync-type: laymansync
    sync-uri: git://github.com/anyc/steam-overlay.git
    masters: gentoo
    priority: 50

x11
    location: /var/lib/layman/x11
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/x11
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -march=native -pipe -flto=8"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0"
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 -march=native -pipe -flto=8"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask-write --with-bdeps y --complete-graph y --keep-going"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync 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"
GENTOO_MIRRORS="http://mirror.qubenet.net/mirror/gentoo/ http://gentoo.osuosl.org http://distfiles.gentoo.org"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-flto=8"
MAKEOPTS="-j10"
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 acl acpi adobe-cff aio alsa amd64 amr apng berkdb bidi bluetooth branding bzip2 c++11 cairo cdr chm clang classic cleartype_hinting cli connection-sharing cracklib crypt cups custom-cflags custom-optimization cxx d3d9 dbus declarative dri dri3 drm dts dvdr ebook egl emboss encode evdev exif fam ffmpeg firefox flac flash fortran gbm gdbm gif glamor gles gles1 gnutls gold googledrive gpm graphite gstreamer gtk gtkstyle harfbuzz hidpi hotwording hwaccel iconv icu inotify ipv6 ithreads jemalloc jpeg kipi lcms ldap libass libinput libkms libnotify llvm lm_sensors lto lzma lzo mad mng modules mp3 mp4 mpeg mpris mpx mtp multilib ncurses networkmanager nls nptl nsplugin ogg openal opencl opengl openmax openmp opus pam pango pcre pdf pdfimport phonon plasma png policykit postproc ppds prelink proprietary-codecs pulseaudio qml qrcode qt3support qt5 readline s3tc samba seccomp secure-delete session shenandoah sndfile spell ssl staging startup-notification steamfonts steamruntime streaming svg sync-plugin-portage system-cairo system-ffmpeg system-harfbuzz system-icu system-jpeg system-libvpx system-sqlite systemd tcmalloc tcpd theora threads thumbnail tiff touchpad trayicon truetype udev udisks unicode upower usb v4l vaapi vdpau video vorbis vpx vulkan wayland wayland-compositor webp widevine widgets wifi winbind wxwidgets x264 x265 xattr xcb xcomposite xinerama xml xscreensaver 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 access_compat" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 f16c 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" INPUT_DEVICES="evdev synaptics libinput" KERNEL="linux" L10N="en-GB en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_GB en" LLVM_TARGETS="AMDGPU" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python3_5 python2_7" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="intel i965 radeon radeonsi amdgpu" 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, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

When I switched to Clang it compiled with:

CC=clang
CXX=clang++
CFLAGS="-O3 -march=native -pipe -flto=thin"
CXXFLAGS="${CFLAGS}"
LDFLAGS="${CFLAGS}"
AR="ar"
NM="nm"
RANLIB=/bin/true
Comment 3 Mike Gilbert gentoo-dev 2017-02-09 15:40:39 UTC
I think this failure is triggered by a couple of things:

1. -march=native in CXXFLAGS
2. A CPU that supports the AVX2 instruction set.

This causes (SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2) to be true in SkNx_sse.h, which in turn causes code which calls _mm256_setr_m128 to be compiled.

gcc-6.3.0 does not implement _mm256_setr_m128, and so we arrive at the failure reported here.

I think you can work around this by compiling chromium without -march=native in CXXFLAGS.
Comment 4 Mike Lothian 2017-02-09 15:45:17 UTC
Will -march=skylake work?
Comment 5 Mike Gilbert gentoo-dev 2017-02-09 15:55:18 UTC
(In reply to Mike Lothian from comment #4)
> Will -march=skylake work?

You would need to compile with an arch setting that does NOT support AVX2. Of the top of my head, I do not know what skylake supports.

Alternatively, you might try adding -mno-avx2 to your CXXFLAGS to disable it explicitly.
Comment 6 Mike Lothian 2017-02-09 16:13:36 UTC
It might be a good idea to add -mno-avx2 to the flags in the ebuild if Clang isn't being used
Comment 7 Mike Gilbert gentoo-dev 2017-02-09 17:26:32 UTC
(In reply to Mike Lothian from comment #6)
> It might be a good idea to add -mno-avx2 to the flags in the ebuild if Clang
> isn't being used

Could you do a test build using gcc with CXXFLAGS="-march=native -mno-avx2" to confirm that will actually work? I don't have any way to test it myself.
Comment 8 Mike Lothian 2017-02-09 23:55:22 UTC
Yes I can confirm adding -mno-avx2 to the CXXFLAGS fixes the build for me with GCC
Comment 9 Mike Gilbert gentoo-dev 2017-02-11 02:27:04 UTC
So the tricky thing here is that I cannot figure out how to effectively report this upstream. The problem is impossible to reproduce with a "normal" build.

We only trigger it because of the custom toolchain definition we use, which passes CXXFLAGS from the environment.
Comment 10 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2017-02-11 13:56:54 UTC
Maybe we could point to this error message and the opencv workaround (https://github.com/opencv/opencv/pull/8080/files).

Unfortunately I can't reproduce the issue because that seems to require access to an AVX2-capable CPU.

Meanwhile, for Gentoo, we could patch third_party/skia/src/opts/SkNx_sse.h not to take the "#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2" code when GCC is used. Would something like !defined(__GNUC__) || defined(__clang__) work?

I also wonder if there's a bug on file to add GCC support for _mm256_setr_m128, and how to detect that properly using preprocessor defines.

x86_64-pc-linux-gnu-g++ -MMD -MF obj/skia/skia_opts_sse3/SkBitmapProcState_opts_SSSE3.o.d -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DDISABLE_NACL -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DENABLE_MEDIA_ROUTER=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DSK_IGNORE_DW_GRAY_FIX -DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS -DSK_SUPPORT_GPU=1 -DSK_GAMMA_EXPONENT=1.2 -DSK_GAMMA_CONTRAST=0.2 -DSK_DEFAULT_FONT_CACHE_LIMIT=20971520 -I../.. -Igen -I../../skia/config -I../../skia/ext -I../../third_party/skia/include/c -I../../third_party/skia/include/config -I../../third_party/skia/include/core -I../../third_party/skia/include/effects -I../../third_party/skia/include/images -I../../third_party/skia/include/lazy -I../../third_party/skia/include/pathops -I../../third_party/skia/include/pdf -I../../third_party/skia/include/pipe -I../../third_party/skia/include/ports -I../../third_party/skia/include/utils -I../../third_party/skia/include/gpu -I../../third_party/skia/src/gpu -I../../third_party/skia/src/sksl -I../../third_party/skia/include/private -I../../third_party/skia/include/client/android -I../../third_party/skia/src/core -I../../third_party/skia/src/effects/gradients -I../../third_party/skia/src/image -I../../third_party/skia/src/opts -I../../third_party/skia/src/pdf -I../../third_party/skia/src/ports -I../../third_party/skia/src/sfnt -I../../third_party/skia/src/utils -I../../third_party/skia/src/lazy -mssse3 -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -m64 -march=x86-64 -pthread -O2 -fno-ident -fdata-sections -ffunction-sections -g0 -fvisibility=hidden -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -fvisibility-inlines-hidden -std=gnu++11 -fno-rtti -fno-exceptions -Wno-deprecated -Wno-narrowing -O2 -march=native -pipe -Wno-narrowing -fno-delete-null-pointer-checks -flifetime-dse=1 -fpermissive -fno-delete-null-pointer-checks -c ../../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp -o obj/skia/skia_opts_sse3/SkBitmapProcState_opts_SSSE3.o
In file included from ../../third_party/skia/src/core/SkNx.h:361:0,
                 from ../../third_party/skia/src/core/SkBitmapFilter.h:15,
                 from ../../third_party/skia/src/core/SkBitmapProcState.h:13,
                 from ../../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.h:11,
                 from ../../third_party/skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp:8:
../../third_party/skia/src/core/../opts/SkNx_sse.h: In static member function <E2><80><98>static void {anonymous}::SkNx<8, float>::Load4(const void*, {anonymous}::SkNx<8, float>*, {anonymous}::SkNx<8, float>*, {anonymous}::SkNx<8, float>*, {anonymous}::SkNx<8, float>*)<E2><80><99>:
../../third_party/skia/src/core/../opts/SkNx_sse.h:631:51: error: <E2><80><98>_mm256_setr_m128<E2><80><99> was not declared in this scope
             *r = _mm256_setr_m128(rl.fVec, rh.fVec);
                                                   ^
ninja: build stopped: subcommand failed.
Comment 11 Mike Lothian 2017-02-11 14:45:54 UTC
I'd be curious to know if this works with the upcoming GCC 7
Comment 12 Mike Gilbert gentoo-dev 2017-02-12 00:21:57 UTC
I found a simple way to reproduce the problem using a standalone skia build. Adding -mavx2 to extra_cflags seems to trigger the build failure, without requiring a CPU that actually supports the instruction set.

A simple patch against https://skia.googlesource.com/skia.git:

diff --git a/gn/BUILD.gn b/gn/BUILD.gn
index 37852251cb..603c3e4d10 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -22,7 +22,7 @@ declare_args() {
 
   windk = "C:/Program Files (x86)/Microsoft Visual Studio 14.0"
 
-  extra_cflags = []
+  extra_cflags = ["-mavx2"]
   extra_cflags_c = []
   extra_cflags_cc = []
   extra_ldflags = []
Comment 13 Mike Gilbert gentoo-dev 2017-02-12 00:27:46 UTC
(In reply to Paweł Hajdan, Jr. from comment #10)
> Meanwhile, for Gentoo, we could patch third_party/skia/src/opts/SkNx_sse.h
> not to take the "#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2" code when
> GCC is used. Would something like !defined(__GNUC__) || defined(__clang__)
> work?

Yes, I think that should do the trick.
Comment 14 Ingo Brunberg 2017-03-17 08:30:43 UTC
Thanks for the hints. I managed to compile chromium-58.0.3029.19 with gcc-6.3.0 by replacing all occurences of "SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2" in third_party/skia/src/opts and third_party/skia/src/core (there are several) with "SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2 && (!defined(__GNUC__) || defined(__clang__))".
Comment 15 Tanki 2017-03-18 18:26:32 UTC
I have the same bug but with gcc 5.4
should I open a different bug or should I just hop aboard the bandwagon ?
Comment 16 Vitaliy Batichko 2017-03-19 16:15:55 UTC
Created attachment 467580 [details, diff]
Patch for chromium-58.0.3029.19
Comment 17 Cynede (RETIRED) gentoo-dev 2017-03-21 07:44:25 UTC
same, build log: https://paste.pound-python.org/show/lr84jhgVdHg15wsJ8MVV/
Comment 18 Cynede (RETIRED) gentoo-dev 2017-03-21 07:46:54 UTC
also, gcc 5.4
Comment 19 Mike Gilbert gentoo-dev 2017-03-21 14:36:31 UTC
Comment on attachment 467580 [details, diff]
Patch for chromium-58.0.3029.19

Is it actually necessary to change all of these files? Or does changing SkNx_sse.h suffice?
Comment 20 Vitaliy Batichko 2017-03-21 16:02:23 UTC
(In reply to Mike Gilbert from comment #19)
> Is it actually necessary to change all of these files? Or does changing
> SkNx_sse.h suffice?

I'm not sure, didn't experiment. Based on Ingo Brunberg's comment, i've just replaced all occurences of "SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2".  Works for me, applies clean to chromium-58.0.3029.19  and 59.0.3043.0.
Comment 21 Scott Alfter 2017-03-21 22:23:24 UTC
Bug still present in chromium-58.0.3029.19, building on a Core i5 4690K (Devil's Canyon) with -march=core-avx2 and gcc 5.4.0.  I've copied the patch to my user patches and am now rebuilding.
Comment 22 Mike Gilbert gentoo-dev 2017-03-22 01:51:04 UTC
No more "me too" comments please.
Comment 23 Ingo Brunberg 2017-03-22 02:23:47 UTC
(In reply to Mike Gilbert from comment #19)
> Is it actually necessary to change all of these files? Or does changing
> SkNx_sse.h suffice?

Yes, all (or most) of these occurences have to be replaced.
Comment 24 Mike Gilbert gentoo-dev 2017-03-22 02:40:11 UTC
I wrote a somewhat simpler patch.

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

commit f8a72fe420751ebd6d1e3c32410e16a2008de0ac
Author: Mike Gilbert <floppym@gentoo.org>
Date:   Tue Mar 21 22:38:56 2017 -0400

    www-client/chromium: work around skia build failure with GCC
    
    Bug: https://bugs.gentoo.org/608640
    Package-Manager: Portage-2.3.5_p2, Repoman-2.3.2_p32

 www-client/chromium/chromium-58.0.3029.19.ebuild |  1 +
 www-client/chromium/chromium-59.0.3043.0.ebuild  |  1 +
 www-client/chromium/files/skia-avx2.patch        | 15 +++++++++++++++
 3 files changed, 17 insertions(+)
Comment 25 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2017-05-15 20:24:43 UTC
Looks like the problematic code has been removed in https://skia-review.googlesource.com/c/13121/ .

I can repro with extra_cflags = ["-w", "-mavx2"], gcc-6.3.0, and d177ae18d7f2d02e872adbfaf2bd060beba48365^ (a commit before above patch). Resetting to d177ae18d7f2d02e872adbfaf2bd060beba48365 (the fix) makes the issue go away.

I also checked with latest skia (cbd0f3b4e3239ffd84402ed63a85e88e484a4c47).

We should be able to remove our custom patch for chromium versions that contain above skia change.