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

Bug 503828

Summary: media-libs/mesa-10.1.0 - In file included from main/streaming-load-memcpy.c:31:0: /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/smmintrin.h:31:3: error: #error "SSE4.1 instruction set not enabled"
Product: Gentoo Linux Reporter: Mario Bachmann <grafgrimm77>
Component: [OLD] LibraryAssignee: Gentoo X packagers <x11>
Status: RESOLVED FIXED    
Severity: normal CC: bircoph, cyberbat83, jer, jormangeud, randy-andy-, sfl, xmw
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: AMD64   
OS: Linux   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=71547
Whiteboard:
Package list:
Runtime testing required: ---

Description Mario Bachmann 2014-03-08 10:32:11 UTC
Emerging mesa-10.1.0 on an AMD X2 5600+ breaks up with an error in compile phase. 

cat /proc/cpuinfo  (relevant parts)
cpu family	: 15
model		: 107
model name	: AMD Athlon(tm) 64 X2 Dual Core Processor 5600+
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow rep_good nopl extd_apicid pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch lbrv

cat /etc/make.conf
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=k8-sse3 -mcx16 -msahf -mno-movbe -mno-aes -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 -mprfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=k8 -O2 -fomit-frame-pointer"

Reproducible: Always

Steps to Reproduce:
1. emerge mesa (on an old CPU without SSE 4.1

Actual Results:  
In file included from main/streaming-load-memcpy.c:31:0:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/smmintrin.h:31:3: error: #error "SSE4.1 instruction set not enabled"
 # error "SSE4.1 instruction set not enabled"


Expected Results:  
Mesa should compile on this old CPU. 

solution:
# cat /usr/portage_overlay/media-libs/mesa/files/patch_mesa_sse41.patch 
--- src/mesa/main/streaming-load-memcpy.orig	2014-03-08 11:03:54.929549060 +0100
+++ src/mesa/main/streaming-load-memcpy.c	2014-03-08 11:04:20.395760470 +0100
@@ -26,6 +26,7 @@
  *
  */
 
+#ifdef __SSE4_1__
 #include "main/macros.h"
 #include "main/streaming-load-memcpy.h"
 #include <smmintrin.h>
@@ -83,3 +84,4 @@
       memcpy(d, s, len);
    }
 }
+#endif

add the following line in function src_prepare() in /usr/portage_overlay/media-libs/mesa/mesa-10.1.0.ebuild
epatch "${FILESDIR}"/patch_mesa_sse41.patch

and do
ebuild --force mesa-10.1.0.ebuild manifest

x2 ~ # emerge --info
Portage 2.2.8-r1 (default/linux/amd64/13.0, gcc-4.8.2, glibc-2.18-r1, 3.12.13 x86_64)
=================================================================
System uname: Linux-3.12.13-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_5600+-with-gentoo-2.2
KiB Mem:     8168864 total,   3515220 free
KiB Swap:          0 total,         0 free
Timestamp of tree: Sat, 08 Mar 2014 08:15:01 +0000
ld GNU ld (GNU Binutils) 2.24
distcc 3.1 x86_64-pc-linux-gnu [enabled]
app-shells/bash:          4.2_p45-r1
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.6, 3.3.4
dev-util/cmake:           2.8.12.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.14.1
sys-devel/binutils:       2.24-r2
sys-devel/gcc:            4.8.2
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.12 (virtual/os-headers)
sys-libs/glibc:           2.18-r1
Repositories: gentoo Mario
Installed sets: @system
ACCEPT_KEYWORDS="amd64 ~amd64 ~x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8-sse3 -mcx16 -msahf -mno-movbe -mno-aes -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 -mprfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=k8 -O2 -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /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=k8-sse3 -mcx16 -msahf -mno-movbe -mno-aes -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 -mprfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=k8 -O2 -fomit-frame-pointer"
DISTDIR="/mnt/gentoo/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build=n"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distcc distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://mirror.switch.ch/mirror/gentoo/ ftp://mirror.netcologne.de/gentoo/ ftp://mirrors.linuxant.fr/distfiles.gentoo.org/ ftp://gentoo.lagis.at/ ftp://gd.tuwien.ac.at/opsys/linux/gentoo/ ftp://gentoo.inode.at/source/ ftp://tux.rainside.sk/gentoo/ ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo ftp://mirror.ovh.net/gentoo-distfiles/ ftp://gentoo.mirror.dkm.cz/pub/gentoo/ http://gentoo.mirror.dkm.cz/pub/gentoo/ http://mirror.switch.ch/ftp/mirror/gentoo/ http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ http://mirror.netcologne.de/gentoo/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://mirrors.linuxant.fr/distfiles.gentoo.org/ http://gentoo.tiscali.nl/ http://mirror.ovh.net/gentoo-distfiles/ http://gentoo.inode.at/ http://ftp.fi.muni.cz/pub/linux/gentoo/"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/mnt/gentoo/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"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage_overlay"
SYNC="rsync://server/portage"
USE="3dnow 3dnowext 7zip X a52 aac acl acpi alsa amd64 berkdb bzip2 cairo cdparanoia cli cracklib crypt cups custom-cflags custom-cpuopts custom-cxxflags custom-optimization cxx dbus dri dvb dvd dvdr encode exif fam flac fortran g3dvl gdbm glitz gnutls iconv icu ilbc imagemagick imlib ipv6 jpeg kpathsea lame lcms libsamplerate lm_sensors lzo mad mmx mmxext modules mp3 multilib ncurses nls nptl ogg openal opengl openmp openvg pam pcre pdf png qt3support qt4 readline sdl semantic-desktop session smp speex spell sse sse2 sse3 ssl svg tcpd theora threads tiff truetype unicode usb v4l vdpau vorbis wmf x264 xcb xcomposite xine xinerama xml xulrunner xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="hda-intel intel8x0" APACHE2_MODULES="alias auth_basic authn_file authz_groupfile authz_host authz_user autoindex deflate dir filter ident log_config logio mime status" 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" DVB_CARDS="dibusb-usb1" 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="joystick keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" QEMU_SOFTMMU_TARGETS="x86_64" QEMU_USER_TARGETS="x86_64" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="nvidia nv vesa 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:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Matt Turner gentoo-dev 2014-03-08 19:19:32 UTC
Yes, there's a patch upstream. I'll be in the next version. Please use this as a public service announcement telling you that it's unnecessary to explicitly disable instruction sets. -march=k8-sse3 doesn't enable SSE 4. You don't need to be disabling it explicitly.
Comment 2 Michael Weber (RETIRED) gentoo-dev 2014-03-15 10:00:09 UTC
(In reply to Matt Turner from comment #1)
> Yes, there's a patch upstream.

epatch_user works with

mkdir -p /etc/portage/patches/media-libs/mesa-10.1.0
wget http://cgit.freedesktop.org/mesa/mesa/patch/\?id\=8d3f739383fbdf671752fdec707f1c2b9b2aa6a3 -O /etc/portage/patches/media-libs/mesa-10.1.0/sse4.1.patch
emerge -av1 mesa
Comment 3 Fab 2014-03-30 08:47:06 UTC
(In reply to Matt Turner from comment #1)
> Yes, there's a patch upstream. I'll be in the next version. Please use this
> as a public service announcement telling you that it's unnecessary to
> explicitly disable instruction sets. -march=k8-sse3 doesn't enable SSE 4.
> You don't need to be disabling it explicitly.

I'm not agree. I'm using a coreI5 system to build packages for an ATOM system from a chroot. I must disable explicitly theses instructions sets into the chroot.

mesa-10.0.4 has been stabilized but can not be built.
Comment 4 Chí-Thanh Christopher Nguyễn gentoo-dev 2014-04-01 16:38:08 UTC
*** Bug 506474 has been marked as a duplicate of this bug. ***
Comment 5 Robin Bankhead 2014-04-14 12:09:52 UTC
(In reply to Fab from comment #3)
> (In reply to Matt Turner from comment #1)
> > Yes, there's a patch upstream. I'll be in the next version. Please use this
> > as a public service announcement telling you that it's unnecessary to
> > explicitly disable instruction sets. -march=k8-sse3 doesn't enable SSE 4.
> > You don't need to be disabling it explicitly.
> 
> I'm not agree. I'm using a coreI5 system to build packages for an ATOM
> system from a chroot. I must disable explicitly theses instructions sets
> into the chroot.
> 
> mesa-10.0.4 has been stabilized but can not be built.

Likewise, if you use distcc with different CPUs as servers, this is also a problem.  Basically any type of cross-compiling is likely affected.
Comment 6 Matt Turner gentoo-dev 2014-04-28 21:56:47 UTC
*** Bug 507784 has been marked as a duplicate of this bug. ***
Comment 7 Andrew Savchenko gentoo-dev 2014-05-16 18:22:11 UTC
Issue is still here with mesa-10.1.3 and -msse4.1 being enforced on Atom N270.
Comment 8 Andrew Savchenko gentoo-dev 2014-10-24 23:50:36 UTC
This is odd. I have this issue with distcc or any cross-compiling with mesa-10.3.1, otherwise it builds fine.

Looks like I have the same issue with chromium (bug 523744), so this issues is not package, but toolchain related.
Comment 9 Chí-Thanh Christopher Nguyễn gentoo-dev 2014-11-03 09:21:20 UTC
This was supposedly fixed in mesa-10.2

For the distcc/cross-compile problem best open a separate bug report.