From Gentoo Wiki
Jump to: navigation, search
This article is a stub. You can help by expanding it.


Blender is a professional free and open-source 3D computer graphics software.


Installation of recent releases of Blender on Gentoo is rather complicated.

This page explains how to solve the most common issues for installation of version 2.78. Blender quickly changes, so these steps may soon become obsolete. Wiki editors will attempt to stay current on build instructions.

If something is broken do not hesitate to make changes to the article.

Installation can require many packages, It is recommended to first upgrade to python 3.5.2, set any required USE flags and then emerge blender.

Python 3.5

Blender 2.78 requires python 3.5.2 which is currently marked as testing. It is recommended to upgrade to python 3.5.2 and resolve any blockers prior to emerging blender.

Please follow the instructions at PYTHON_TARGETS in order to emerge a testing python version. They are repeated here for convenience.

FILE /etc/portage/package.accept_keywordsUnmask dev-lang/python
FILE /etc/portage/profile/use.stable.mask"Unmask python_targets and python_single_target for python3.5"
FILE /etc/portage/profile/eapi"Set eapi to 5"

Enable the implementation of python3_5 in addition to the default ones on the system. This can either be done in make.conf or in package.use:

FILE /etc/portage/make.conf"Add python3_5 to PYTHON_TARGETS"
#(Either add python3_5 to the list of the other implementations on the system)
PYTHON_TARGETS="python2_7 python3_4 python3_5"
FILE /etc/portage/package.use"Enable PYTHON_TARGETS in for all packages in package.use"
# (Or enable python3_5 for all packages globally)
*/* PYTHON_TARGETS: python3_5

Regardless of which method is used above, Blender also needs python_single_target_python3_5 enabled. Note that this is different from python_targets_python3_5.

FILE /etc/portage/package.use"Enable PYTHON_SINGLE_TARGET for blender"
media-gfx/blender python_single_target_python3_5

Finally, unmask the required unstable packages

FILE /etc/portage/package.use"Unstable packages required for blender 2.78-r1"
media-gfx/blender ~amd64
media-libs/ilmbase ~amd64
media-libs/openexr ~amd64
sys-devel/autoconf-archive ~amd64
dev-python/PySocks ~amd64
# Depending upon the USE flags for blender, additional unstable packages may be required

Now everything is prepared to emerge blender.

USE flags

USE flags for media-gfx/blender 3D Creation/Animation/Publishing System

boost Enable features depending on boost. local
bullet Enable Bullet (Physics Engine). local
collada Add support for Collada interchange format through media-libs/opencollada. local
colorio Enable OpenColorIO color management through media-libs/opencolorio. local
cuda Build cycles renderer with nVidia CUDA support. local
cycles Build cycles renderer (requires media-libs/openimageio and dev-libs/boost). local
dds Adds DDS textures support to Blender. local
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see global
doc Build C and Python API documentation directly from the source code. local
elbeem Adds surface fluid simulation to Blender using El'Beem library. local
ffmpeg Enable ffmpeg/libav-based audio/video codec support global
fftw Use FFTW library for computing Fourier transforms global
game-engine Adds Game Engine support to Blender. local
headless Build without graphical support (renderfarm, server mode only). local
jack Add support for the JACK Audio Connection Kit global
jemalloc Use dev-libs/jemalloc for memory allocation. local
jpeg2k Support for JPEG 2000, a wavelet-based image compression format global
libav Prefer libav over ffmpeg whenever both are supported global
llvm Enable features depending on llvm. local
man Build and install man pages. local
ndof Enable NDOF input devices (SpaceNavigator and friends). local
nls Add Native Language Support (using gettext - GNU locale utilities) global
openal Add support for the Open Audio Library global
openexr Support for the OpenEXR graphics file format global
openimageio Enable OpenImageIO Support local
openmp Build support for the OpenMP (support parallel computing), requires >=sys-devel/gcc-4.2 built with USE="openmp" global
opensubdiv Add rendering support form OpenSubdiv from Dreamworks Animation through media-libs/opensubdiv. local
openvdb Add GPU preview rendering. Only works with nVidia cards. local
player Build the Blender Player. THis requires the Game engine. local
sdl Add support for Simple Direct Layer (media library) global
sndfile Add support for libsndfile global
test Build the provided unit tests. local
tiff Add support for the TIFF image format global
valgrind Add support for memory debugging using dev-util/valgrind local

There are many additional features that can be enabled via USE flags. See the list above or the Additional Features section below for further details.

FILE /etc/portage/make.confAppropriate Global USE flags for Blender
# All these global USE flags could be specified locally if desired.
# While both ffmpeg and libav currently work, only ffmpeg is officially recommended.
# Cycles requires tiff. Add any additional formats required eg. jpeg png...
# If audio is required, choose from openal, jack or sdl.
USE="ffmpeg X opengl threads tiff openal jack sdl fftw openexr expat"
FILE /etc/portage/package.useAppropriate Local USE flags for Blender
# blender
media-gfx/blender python_single_target_python3_5 cycles boost openexr tiff openimageio player game-engine bullet fftw openal jemalloc opensubdiv openvdb openvdb-compression
# Enable cuda or opencl if possible
media-libs/opencv cuda opencl
media-libs/openimageio opencv
media-libs/opensubdiv cuda opencl ptex tbb

Unmask related packages by adding to /etc/portage/package.keywords:

FILE /etc/portage/package.keywordsAccept unstable Blender related packages
media-gfx/blender ~amd64
sci-libs/ldl ~amd64
# Blender 2.78 requires python 3.5.2 (2.72b runs on the stable python 3.4)
# For cuda support in 2.78 (See below for 2.72b patch)
dev-util/nvidia-cuda-toolkit ~amd64
# For openvdb and openvdb-compression support
dev-libs/c-blosc ~amd64
# Cycles and Open Shader Language require Boost
dev-libs/boost ~amd64
dev-util/boost-build ~amd64


Now install the software on the system:

root #emerge --ask --verbose media-gfx/blender

Additional Features

This section lists many of the optional features available in blender and gives a brief overview of their use for beginning users.

Audio Device Support

Support for Jack, OpenAL or SDL audio can optionally be enabled through USE flags.

Inside blender, go to the File->User Preferences->System tab and set the Audio Dev to the desired setting.

Cuda Support

Cycles renderer can work on GPUs, for example Nvidia GTX 970 is about twice as fast as an i5 4690k on traditional BMW benchmark. Support for AMD GPUs and opencl is improving.

To enable graphics card rendering, install Cuda:

root #emerge --ask --verbose dev-util/nvidia-cuda-toolkit

With gcc 4.9, Cuda may not work, complaining that it does not support gcc-4.9 and higher. However, gcc 4.9 happily works after a simple dirty hack: in a file /opt/cuda/include/host_config.h

#if defined(__GNUC__)

#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)

#error -- unsupported GNU version! gcc 4.9 and up are not supported!

#endif /* __GNUC__> 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8) */

replace "8" with "9" twice.

Inside blender, go to the File->User Preferences->System tab and set Compute Device to CUDA and select the graphics card in the box below. If the graphics card is not supported these options will not be visible.

Now set the renderer to Cycles Renderer and in the renderer panel under the Render options set the Device to GPU Compute.

The first time a render is created with a new version of blender, the CUDA kernels will need to be compiled. This may take over 15 minutes.

File Format Support

Support OpenCOLLADA (.dae), jpeg2k, sndfile and tiff image file formats can optionally be enabled through USE flags.

The collada USE flag adds entries to File->Import/Export for Collada (Default) (.dae) files. The others can be used with background images in the properties panel of the 3D View or as output formats in the render panel.

Blender should work with either ffmpeg or libav libraries, although only ffmpeg is officially recommended by the blender developers.

Headless (Server Only)

For render farms it is possible to compile blender with the headless USE flag. This is not recommended for most users.

This feature reduces the blender file size by around 5 MB, but it will not be possible to run blender normally as the GUI is not available.

In headless mode, blender can still be used to run python scripts from the commmand line

user $user $ blender -b -P [-- [--optionsforscript .. ] ]
This functionality is also available with regular versions of blender, it is not necessary to enable the headless use flag to run scripts from the command line.

Memory Allocator

It is recommended to enable jemalloc to use a more efficient memory allocator. This reduces wasted memory during rendering and allows for larger scenes to be rendered.

Memory Profiling

Support for memory profiling can be enabled using the valgrind USE flag. See Debugging for instructions on setting up Valgrind.


Open Colorio provides additional options under the Color Management section of the Scene panel.

Inside blender, select the Render View and Look options, and adjust the exposure, gamma and curves to obtain the desired look.


Opensubdiv is a set of libraries that improve subdivision surface modifier evaluation. This can dramatically improve the frame rate of viewing animations in the viewport when using high levels of subdivision.

Not all cards are suitable. The current code checks for geometry shader, GL_ARB_gpu_shader5, glProgramParameteri, glProgramParameteriEXT and glProgramParameteriARB. These are available as part of OpenGL 3.2, 4.0 and 4.1, or as extensions.

Support is enabled via the opensubdiv USE flag.

Inside blender, go to the File->User Preferences->System tab and set OpenSubdiv compute to the desired option. It may be possible to choose the CPU, but cards which support GLSL Compute will give better performance. This box will not appear if the card does not meet the requirements.

Finally check the Use Opensubdiv box in the subdivision surface modifier


OpenVDB provides a data structure for storing and manipulating volumetric information efficiently. It can be compiled into blender using the openvdb USE flag, and openvdb-compression is also recommended as the data can require upwards of 20MB.

In blender, set the renderer to Cycles Renderer. Go to the physics panel and enable physics for Smoke. In the smoke section select Domain. Save the file to enable editing of the smoke cache. Change File Format to Openvdb and select Blosc compression if desired. Now create and bake the simulation.

Blender 2.72b Specific

Blender 2.72b is quite old and upgrading to 2.78 is strongly recommended.

x86 Intrinsics Compilation

Due to bug #523928 cycles may fail to compile. To work around it, create /etc/portage/patches/media-gfx/blender/blender.redefinition.patch patch file:

diff -Nur old/intern/cycles/util/util_simd.h new/intern/cycles/util/util_simd.h 
--- old/intern/cycles/util/util_simd.h  2014-10-20 03:58:22.000000000 -0400 
+++ new/intern/cycles/util/util_simd.h  2015-02-03 13:29:26.156893414 -0500 
@@ -19,6 +19,7 @@ 
 #define __UTIL_SIMD_TYPES_H__
 #include <limits>
+#include <x86intrin.h> 
 #include "util_debug.h"
 #include "util_types.h"

(This patch can also be obtained from pastebin if copying and pasting from formatting adds extra spaces that break the patch.)

Nvidia GTX 900 series in Blender 2.72b

Newer Nvidia cards are not supported in Blender 2.72 and upgrading to 2.78 is recommended. However it is possible to patch 2.72b:

  • Unmask and emerge dev-util/nvidia-cuda-toolkit of version 6.5.19 or higher
  • Create a file /etc/portage/patches/media-gfx/blender/blender.sm_52.patch with contents
diff --git a/intern/cycles/kernel/ b/intern/cycles/kernel/
index d5b5293..9ed4592 100644
--- a/intern/cycles/kernel/
+++ b/intern/cycles/kernel/
@@ -52,8 +52,8 @@
-/* 5.0 */
-#elif __CUDA_ARCH__ == 500
+/* 5.0 and 5.2 */
+#elif __CUDA_ARCH__ == 500 || __CUDA_ARCH__ == 520

Re-emerge Blender:

root #emerge --ask --one-shot media-gfx/blender

See also

External resources