From BlenderWiki

Jump to: navigation, search

Building Cycles

For a build with CPU rendering support, see the Building Blender documentation. For Linux, it's easiest to get OpenImageIO and Boost from our svn.

CUDA

Download the CUDA Toolkit and install, and make sure you have recent enough nvidia drivers (e.g. 270.X or newer)

Bundling Binary Kernels

CUDA is enabled by default on Linux and Mac, however this will require the machine running Blender to have the CUDA toolkit installed. On Windows currently kernels need to be bundled with Blender, for that these cmake options must be set:

  • WITH_CYCLES_CUDA_BINARIES=ON
  • CYCLES_CUDA_BINARIES_ARCH=<arch> (optional, e.g. sm_21)

Building CUDA kernels is slow, it may take a few minutes per CUDA architecture, and multithreaded builds can run out of memory. It will compile for all architectures by default, but it's quickest to specify only a single CYCLES_CUDA_BINARIES_ARCH for your card, look here for the number.

Linux Notes

To install the CUDA toolkit, in a root terminal make it executable and run it

chmod +x cudatoolkit_4.0.13_linux_XXXXXXX.run
./cudatoolkit_4.0.13_linux_XXXXXXX.run

The installer asks for default path, accept with an Enter

Depending on your GCC version you might get into an error compiling Blender (unsupported GNU version! gcc 4.5 and up are not supported!)

if so delete or comment the following lines in /usr/local/cuda/include/host_config.h

#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)
#error -- unsupported GNU version! gcc 4.5 and up are not supported!
#endif /* __GNUC__> 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4) */

Linux Dependencies from Source

These are instructions to build OpenImageIO and Boost from source on Linux. It is easier to use the lib/ directory from svn, for that see Building Blender.

For OpenImageIO, we need to install Git, e.g. on Ubuntu:

sudo apt-get install git-core

Create Folders:

mkdir blender-cycles
cd blender-cycles
mkdir boost
cd boost

Download a recent version of boost, e.g. version 1.47, and move the .zip file into the boost folder in the blender-cycles folder.

Build Boost:

tar xzf boost_1_47_0.tar.gz
cd boost_1_47_0/
./bootstrap.sh
./bjam -j4 variant=release link=static threading=multi --with-filesystem --with-thread --with-regex --with-system --with-date_time stage install --prefix=../
cd ../..

Build OpenImageIO:

git clone git://github.com/OpenImageIO/oiio.git
cd oiio
git checkout RB-0.10
mkdir -p build/linux
cd build/linux
cmake ../../src/ -DBUILDSTATIC=1 -DBOOST_CUSTOM=1 -DBoost_INCLUDE_DIRS=`pwd`/../../../boost/include/ -DBoost_LIBRARY_DIRS=`pwd`/../../../boost/lib -DBoost_LIBRARIES="boost_date_time;boost_filesystem;boost_thread;boost_regex;boost_system" -DCMAKE_INSTALL_PREFIX=`pwd`/../../dist/linux
make -j4 install
cd ../../..

Build Blender:

svn co https://svn.blender.org/svnroot/bf-blender/trunk/blender/ blender
mkdir build
cd build
cmake ../blender -DOPENIMAGEIO_ROOT_DIR=../oiio/dist/linux -DBOOST_ROOT=../boost -DBOOST_CUSTOM=1 -DBoost_INCLUDE_DIRS=`pwd`/../boost/include/ -DBoost_LIBRARY_DIRS=`pwd`/../boost/lib -DBoost_LIBRARIES="`pwd`/../boost/lib/libboost_date_time.a;`pwd`/../boost/lib/libboost_filesystem.a;`pwd`/../boost/lib/libboost_thread.a;`pwd`/../boost/lib/libboost_regex.a;`pwd`/../boost/lib/libboost_system.a"
make -j4 install