Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 469134 - media-gfx/blender-2.66 sse USE flag causes -msse2 build, lacks sse2 use flag
Summary: media-gfx/blender-2.66 sse USE flag causes -msse2 build, lacks sse2 use flag
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Luca Barbato
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-05-09 04:00 UTC by Navar
Modified: 2013-06-21 15:14 UTC (History)
3 users (show)

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


Attachments
patch blender-2.66.ebuild, add sse2 use flag for cmake macro epatch (file_469134.txt,1008 bytes, patch)
2013-05-09 04:07 UTC, Navar
Details | Diff
epatch for allowing SSE while removing faulty SSE2 cmake checks (file_469134.txt,1.91 KB, patch)
2013-05-09 04:09 UTC, Navar
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Navar 2013-05-09 04:00:22 UTC
On a non-sse2 CPU with sse USE specified, blender-2.66/build_files/cmake/macros.cmake is asserting:

-- Performing Test SUPPORT_SSE_BUILD 
-- Performing Test SUPPORT_SSE_BUILD - Success 
-- SSE Support: detected. 
-- Performing Test SUPPORT_SSE2_BUILD 
-- Performing Test SUPPORT_SSE2_BUILD - Success 
-- SSE2 Support: detected. 

[... much later during compile phase...] 
Error: [...] Illegal Instruction [...]

I've elaborated on this further at http://forums.gentoo.org/viewtopic-p-7305550.html#7305550

cat /proc/cpuinfo 
processor       : 0 
vendor_id       : AuthenticAMD 
cpu family      : 6 
model           : 6 
model name      : AMD Athlon(TM) XP 2000+
flags           : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow

Will include attachment patches for epatch against blender-2.66/build_files/cmake/macros.cmake and for blender-2.66.ebuild with support for sse2 use for the epatch.
Comment 1 Navar 2013-05-09 04:02:53 UTC
emerge --info
Portage 2.1.11.62 (default/linux/x86/13.0/desktop, gcc-4.6.3, glibc-2.15-r3, 3.7.10-gentoo i686)
=================================================================
System uname: Linux-3.7.10-gentoo-i686-AMD_Athlon-TM-_XP_2000+-with-gentoo-2.2
KiB Mem:     1030588 total,     27892 free
KiB Swap:    2047996 total,   1986100 free
Timestamp of tree: Wed, 08 May 2013 06:15:01 +0000
ld GNU ld (GNU Binutils) 2.22
distcc 3.1 i686-pc-linux-gnu [enabled]
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.3-r3, 3.2.3-r2, 3.3.0
dev-util/cmake:           2.8.10.2-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6, 1.12.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo x-portage
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="*"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-4 -mtune=athlon -fomit-frame-pointer -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="${EPREFIX}/etc/gconf /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="-march=athlon-4 -mtune=athlon -fomit-frame-pointer -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -march=i686 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distcc distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -march=i686 -pipe"
GENTOO_MIRRORS="http://gentoo.gossamerhost.com http://gentoo.mirrors.hoobly.com/ http://mirror.datapipe.net/gentoo ftp://mirror.datapipe.net/gentoo http://gentoo.mirrors.easynews.com/linux/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j10"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --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/local/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acl acpi alsa berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss emerald encode exif fam firefox flac fortran gdbm gif gnome gpm gtk iconv jpeg lcms ldap libnotify mad mmx mmxext mng modules mp3 mp4 mpeg mudflap ncurses nls nptl objc ogg opengl openmp pam pango pcre pdf png policykit ppds qt3support qt4 readline sasl sdl session spell sse ssl startup-notification svg symlink tcpd threads tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 x86 xcb xml xv xvid zlib" ABI_X86="32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" 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="canon" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" 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 ubx" INPUT_DEVICES="keyboard mouse evdev joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2 python3_3" RUBY_TARGETS="ruby18 ruby19" SANE_BACKENDS="plustek" USERLAND="GNU" VIDEO_CARDS="nvidia vesa vga" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 2 Navar 2013-05-09 04:07:02 UTC
Created attachment 347792 [details, diff]
patch blender-2.66.ebuild, add sse2 use flag for cmake macro epatch
Comment 3 Navar 2013-05-09 04:09:17 UTC
Created attachment 347794 [details, diff]
epatch for allowing SSE while removing faulty SSE2 cmake checks
Comment 4 Navar 2013-05-09 04:16:59 UTC
Forgot to list epatch attachment name, blender-2.66-cmake_nosse2.patch
Comment 5 Navar 2013-05-21 06:05:08 UTC
Just to reiterate, the issue still occurs without distcc cross compiling and with -j1 (regarding my emerge --info).

Thought I had more to contribute after some extended searching and pondering if gcc -O2 settings were the cause:

$ cat testsse2.c
#include <emmintrin.h>
int main(void) { __m128d v = _mm_setzero_pd(); return 0; }

$ gcc -msse2 -O0 testsse2.c -o testsse2
$ ./testsse2
Illegal instruction

$ gcc -msse2 -O1 testsse2.c -o testsse2
$ ./testsse2
$

Aha.

The problem is eventually addressed here, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=599680, and some extensive testing there claim otherwise (eventual conclusion: that -O0 vs -O1 or -O2 simply remove the SSE instructions in the tests used).  Upstream's mention of this issue seems hit or miss.

Confirmation:

$ gcc -msse2 -O1 testsse2.c -S
$ mv testsse2.s testsse2_O1.s
$ gcc -msse2 -O0 testsse2.c -S

$ diff testsse2.s testsse2_O1.s
6c6
< .LFB470:
---
> .LFB498:
8,16d7
<       pushl   %ebp
<       .cfi_def_cfa_offset 8
<       .cfi_offset 5, -8
<       movl    %esp, %ebp
<       .cfi_def_cfa_register 5
<       andl    $-16, %esp
<       subl    $16, %esp
<       xorpd   %xmm0, %xmm0
<       movapd  %xmm0, (%esp)
18,20d8
<       leave
<       .cfi_restore 5
<       .cfi_def_cfa 4, 4
23c11
< .LFE470:
---
> .LFE498:

Seems to support for SSE2.  The same occurs on the respective SSE test.

Suggested Debian patches towards the bottom seem to generalize into i386 env host tests for MMX/SSE/SSE+ support and I don't believe would resolve the issue any better for Gentoo with i686 hosts that may only have SSE/MMX.

With -O2 removed (as in no -O specified) from CFLAGs using official blender-2.66.ebuild, as suspected,

-- Performing Test SUPPORT_SSE_BUILD
-- Performing Test SUPPORT_SSE_BUILD - Success
-- SSE Support: detected.
-- Performing Test SUPPORT_SSE2_BUILD
-- Performing Test SUPPORT_SSE2_BUILD - Failed
-- SSE2 Support: missing.

The CMake macro tests succeeded.  Not sure the ideal scenario here, the sse2 useflag patches I provided (which still are reliant upon the user to knowingly set -sse2 but definitely keeps SSE2 out of the build while allowing SSE) or to modify the CMake macro with -O0 on the respective gcc SSE tests.
Comment 6 Julian Ospald 2013-06-21 14:20:03 UTC
conditional patches are not good unless it's something that triggers non-vanilla behavior
Comment 7 Julian Ospald 2013-06-21 15:14:33 UTC
+*blender-2.67b-r1 (21 Jun 2013)
+*blender-2.66-r1 (21 Jun 2013)
+
+  21 Jun 2013; Julian Ospald <hasufell@gentoo.org> -blender-2.66.ebuild,
+  +blender-2.66-r1.ebuild, +files/blender-2.66-sse2.patch,
+  -blender-2.67b.ebuild, +blender-2.67b-r1.ebuild,
+  +files/blender-2.67b-sse2.patch:
+  fix dependencies wrt #466020, improve sse2 handling wrt #469134, remove env.d
+  file wrt #447626, fix fftw useflag, update REQUIRED_USE, allow running
+  src_install multiple times