Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 523928 - media-gfx/blender-2.72-r1 - .../work/blender-2.72/intern/cycles/device/../util/util_simd.h:66:20: error: redefinition of 'unsigned int __lzcnt32(unsigned int)'
Summary: media-gfx/blender-2.72-r1 - .../work/blender-2.72/intern/cycles/device/../uti...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 2 votes (vote)
Assignee: Jonathan Scruggs (RETIRED)
: 555970 (view as bug list)
Depends on:
Reported: 2014-09-28 10:30 UTC by Jakub Panachida
Modified: 2016-06-16 20:14 UTC (History)
16 users (show)

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

build.log.bz2 (build.log.bz2,13.47 KB, application/x-bzip)
2014-09-28 10:31 UTC, Jakub Panachida
Remove __lzcnt defines (01_blender-2.72-r1-remove_lzcnt_redefine.patch,493 bytes, patch)
2014-10-01 07:10 UTC, Sven Eden
Details | Diff
Remove __tzcnt defines (02_blender-2.72-r1-remove_tzcnt_redefine.patch,555 bytes, patch)
2014-10-01 07:11 UTC, Sven Eden
Details | Diff
This patch include <x86_intrin.h> in util_simd.h (add_x86intrin.patch,250 bytes, patch)
2015-05-17 07:42 UTC, Samat
Details | Diff
Include <x86_intrin.h> in util_simd.h, fixed for /etc/portage/patches (cycles.patch,314 bytes, patch)
2015-07-19 14:39 UTC, stqn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Panachida 2014-09-28 10:30:47 UTC
Cycles engine stopped to build with new ebuild

Reproducible: Always

Steps to Reproduce: with +cycles use flag
Actual Results:  
Build fails

Expected Results:  
Build completes
Comment 1 Jakub Panachida 2014-09-28 10:31:31 UTC
Created attachment 385656 [details]
Comment 2 Jakub Panachida 2014-09-28 10:32:08 UTC
Portage 2.2.14_rc1 (python 3.3.5-final-0, default/linux/amd64/13.0/no-multilib, gcc-4.8.3, glibc-2.19-r1, 3.16.3-gentoo x86_64)
System uname: Linux-3.16.3-gentoo-x86_64-Intel-R-_Core-TM-_i5-4670_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:    16358880 total,  13403836 free
KiB Swap:    8389940 total,   8389940 free
Timestamp of tree: Sun, 28 Sep 2014 08:45:01 +0000
ld GNU ld (GNU Binutils) 2.24
app-shells/bash:          4.2_p49
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.8, 3.3.5-r1, 3.4.1
dev-util/cmake:           3.0.2
dev-util/pkgconfig:       0.28-r2
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.13.1
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.14.1
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.8.3
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2-r1
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.16 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo xenon
ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=native -O2 -fno-stack-protector -pipe -fomit-frame-pointer"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
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=native -O2 -fno-stack-protector -pipe"
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"
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"
USE="X a52 aac alsa amd64 berkdb bzip2 cdda cddb cdparanoia cli cracklib crypt cscope curl cxx dri dvd enca ffmpeg flac fortran gdbm gif gnutls gpm iconv imagemagick jpeg jpeg2k kde mad mmx mmxext modules mp3 mpeg musepack ncurses nptl ogg opengl openmp pam pcre png qt readline session sse sse2 ssh ssl ssse3 svg tcpd theora tiff truetype unicode vorbis win32codecs x264 xvid zlib" ABI_X86="64" ALSA_CARDS="virtuoso 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" 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" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3 python3_4" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="intel vesa nouveau nvidia" 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 3 Alexey Korepanov 2014-09-28 20:37:51 UTC
I confirm
Comment 4 Sven Eden 2014-10-01 07:08:11 UTC
I can confirm this with gcc-4.8.3.

The reason is, that two functions, that where not there in previous versions, where 'introduced' using a #define on the present ones.

These defines are in:

The first that breaks the build:
 #if defined(__LZCNT__)
 #define _lzcnt_u32 __lzcnt32
 #define _lzcnt_u64 __lzcnt64

The second that breaks the build:
 #if defined(__BMI__) && defined(__GNUC__)
 #define _tzcnt_u32 __tzcnt_u32
 #define _tzcnt_u64 __tzcnt_u64

I have created two patches that allowed me to emerge blender-2.72-r1 successfully with the following USE-Flags:

USE="boost bullet collada colorio cycles dds doc elbeem ffmpeg fftw game-engine
 jpeg2k nls openexr openmp opennl player sdl sndfile sse sse2 tiff
 -debug -jack -ndof -openal -openimageio -redcode
 python_single_target_python3_4 python_targets_python3_4"
Comment 5 Sven Eden 2014-10-01 07:10:44 UTC
Created attachment 385866 [details, diff]
Remove __lzcnt defines

This fixes the first point of failure
Comment 6 Sven Eden 2014-10-01 07:11:10 UTC
Created attachment 385868 [details, diff]
Remove __tzcnt defines

This removes the second point of failure
Comment 7 Sven Eden 2014-10-01 07:13:16 UTC
Just forgot to mention:

I have just covered the defines in #if 0 / #endif and not checked gcc version. So if the compilation works fine with all gcc versions below 4.8.3 or 4.8.0 or something like that, the patches will instead break the build.

So the patches must be either adapted (and maybe reported upstream?) or applied in the ebuild only when the gcc version used is high enough.
Comment 8 Julian Ospald 2014-10-27 20:28:02 UTC
report it here
Comment 9 Julian Ospald 2014-12-16 16:17:24 UTC

this could be a fix maybe
Comment 10 PM 2014-12-30 08:25:40 UTC
(In reply to Julian Ospald (hasufell) from comment #9)
> this could be a fix maybe

Maybe I'm reading this wrong, but it seems like this patch is already included in 2.72:

> Tags v2.73-rc1, v2.72b, 2.72b, v2.72a, v2.72, v2.72-rc1
Comment 11 Bernd Buschinski 2015-01-02 14:25:23 UTC
Also having this problem with media-gfx/blender-2.72b-r2 & gcc-4.9.2

[ 13%] Building CXX object intern/cycles/device/CMakeFiles/cycles_device.dir/device.cpp.o
cd /var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b_build/intern/cycles/device && /usr/lib64/ccache/bin/x86_64-pc-linux-gnu-g++  -DBOOST_ALL_NO_LIB -DCCL_NAMESPACE_BEGIN="namespace ccl {" -DCCL_NAMESPACE_END=} -DHAVE_STDBOOL_H -DWITH_CUDA -DWITH_KERNEL_AVX -DWITH_KERNEL_AVX2 -DWITH_KERNEL_SSE2 -DWITH_KERNEL_SSE3 -DWITH_KERNEL_SSE41 -DWITH_MULTI -DWITH_OPENCL -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D__LITTLE_ENDIAN__ -D__MMX__ -D__SSE2__ -D__SSE__  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNDEBUG -Wredundant-decls -Wall -Wno-invalid-offsetof -Wno-sign-compare -Wlogical-op -Winit-self -Wmissing-include-dirs -Wno-div-by-zero -Wtype-limits -Wuninitialized -Wundef -Wmissing-declarations -march=native -O2 -pipe -g -fno-builtin-memcmp -funsigned-char  -D__STDC_CONSTANT_MACROS -fopenmp  -msse2  -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -ffast-math -Werror=float-conversion -isystem /usr/include/OpenImageIO -isystem /usr/include/OpenEXR -I/var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/. -I/var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/../kernel -I/var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/../kernel/svm -I/var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/../kernel/osl -I/var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/../util -I/var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/../render -isystem /var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/../../../extern/cuew/include -isystem /var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/../../../extern/clew/include    -o CMakeFiles/cycles_device.dir/device.cpp.o -c /var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/device.cpp
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/immintrin.h:55:0,
                 from /var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/extern/clew/include/clew.h:480,
                 from /var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/device.cpp:24:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/lzcntintrin.h: In function 'unsigned int __lzcnt32(unsigned int)':
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/lzcntintrin.h:51:1: error: redefinition of 'unsigned int __lzcnt32(unsigned int)'
 _lzcnt_u32 (unsigned int __X)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/lzcntintrin.h:45:1: note: 'unsigned int __lzcnt32(unsigned int)' previously defined here
 __lzcnt32 (unsigned int __X)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/lzcntintrin.h: In function 'long long unsigned int __lzcnt64(long long unsigned int)':
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/lzcntintrin.h:64:1: error: redefinition of 'long long unsigned int __lzcnt64(long long unsigned int)'
 _lzcnt_u64 (unsigned long long __X)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/lzcntintrin.h:58:1: note: 'long long unsigned int __lzcnt64(long long unsigned int)' previously defined here
 __lzcnt64 (unsigned long long __X)
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/immintrin.h:57:0,
                 from /var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/extern/clew/include/clew.h:480,
                 from /var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72b/intern/cycles/device/device.cpp:24:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/bmiintrin.h: In function 'unsigned int __tzcnt_u32(unsigned int)':
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/bmiintrin.h:104:1: error: redefinition of 'unsigned int __tzcnt_u32(unsigned int)'
 _tzcnt_u32 (unsigned int __X)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/bmiintrin.h:98:1: note: 'unsigned int __tzcnt_u32(unsigned int)' previously defined here
 __tzcnt_u32 (unsigned int __X)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/bmiintrin.h: In function 'long long unsigned int __tzcnt_u64(long long unsigned int)':
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/bmiintrin.h:172:1: error: redefinition of 'long long unsigned int __tzcnt_u64(long long unsigned int)'
 _tzcnt_u64 (unsigned long long __X)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/bmiintrin.h:166:1: note: 'long long unsigned int __tzcnt_u64(long long unsigned int)' previously defined here
 __tzcnt_u64 (unsigned long long __X)
intern/cycles/device/CMakeFiles/cycles_device.dir/build.make:54: recipe for target 'intern/cycles/device/CMakeFiles/cycles_device.dir/device.cpp.o' failed
Comment 12 Alexey Korepanov 2015-01-19 21:05:13 UTC
Can we include a patch that adds #include <x86intrin.h> to /var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72/intern/cycles/util/util_simd.h just beneath <limits>?

It apparently works for now...
Comment 13 Samat 2015-02-16 04:28:26 UTC
(In reply to Alexey from comment #12)
> Can we include a patch that adds #include <x86intrin.h> to
> /var/tmp/portage/media-gfx/blender-2.72b-r2/work/blender-2.72/intern/cycles/
> util/util_simd.h just beneath <limits>?
> It apparently works for now...

I can confirm that this patch with #include <x86intrin.h> fix compile error with blender-2.72b-r3 also.
Comment 14 Marco Ziebell 2015-02-22 20:02:15 UTC
I report the issue to the mailing-list as suggested in the bug-report.

Comment 15 Samat 2015-05-17 07:42:32 UTC
Created attachment 403448 [details, diff]
This patch include <x86_intrin.h> in util_simd.h

This patch include <x86_intrin.h> in util_simd.h for merging blender-2.72b-r2 and blender-2.72b-r3 with cycles enabled.
Comment 16 stqn 2015-07-19 14:39:44 UTC
Created attachment 407142 [details, diff]
Include <x86_intrin.h> in util_simd.h, fixed for /etc/portage/patches

Modified the path in Samat’s patch so it can simply be dropped into /etc/portage/patches/media-gfx/blender-2.72b-r3/. Worked for me on amd64 (Core i5).

Is there a technical reason why this patch isn’t included in the official ebuild? Does it break non x86 architectures?
Comment 17 Pacho Ramos gentoo-dev 2016-05-28 08:06:26 UTC
*** Bug 555970 has been marked as a duplicate of this bug. ***
Comment 18 Pistos 2016-06-04 07:26:44 UTC
I confirm that putting stqn's patch into stqn /etc/portage/patches/media-gfx/blender-2.72b-r3/fix.patch allows blender to compile.  Thank you for that, stqn and Samat.
Comment 19 Amy Liffey gentoo-dev 2016-06-16 20:14:45 UTC
author	dracwyrm <>	2016-06-16 16:06:25 (GMT)
committer	Amy Winston <>	2016-06-16 19:59:54 (GMT)
commit	58ae358937ae0c36da5f1d30cbd1aec644c1b76e

media-gfx/blender: bug fixes and update metadata.xml
Gentoo Bugs: 533514, 523928, 585730
Updated metadata.xml with new proxy maintainers
Switched to EAPI 6
Added in doc building hack for binary drivers