From BlenderWiki

Jump to: navigation, search

Building Blender

Operating system specific instructions for creating a Blender build from scratch.

Note: this is currently out of date:

Overview for Setting Up a Build Environment

This section is only to list the main steps you have to follow on all platforms, for anyone unfamiliar with the process of compiling C,C++ software from source.

  • Install dependencies (git, subversion, C,C++ compiler).
  • Checkout Blender's source code from version control.
  • Use CMake to compile the source code into an executable.

Optionally:

  • Install an Editor or IDE to navigate and edit the source code.
  • Configure the CMake
    to enable debugging options or toggle compile time features.

Exact steps depend on your operating system, see links above.

Build System

Blender uses the CMake build system. Besides that, you must also choose a compiler to install and choose if you want to build a 32bit or 64bit Blender.

CMake Overview

  • Customization
    • Using cmake GUI, ccmake or editing ./../build_<platform>/CMakeCache.txt
    • Be sure to generate the build files in a directory other than the source directory, e.g. ./../build/
  • Documentation
    • Online (in this Wiki).
  • Build Files
    • CMakeLists.txt throughout the source tree.
    • ./build_files/cmake/*
  • Output
    • ./../build_<platform>/bin, or the project directory for the given generator (CMake -G <generator>).

Resolving Build Failures

Most building problems are not actually errors in Blender's source code, although you can never fully rule out that possibility. Below are common causes for failing to build:

Missing Dependencies

On Windows or OS X we provide dependencies, so before troubleshooting further, make sure you updated your local "lib/" checkout.

Missing dependencies cause two types of compiler errors. No such file errors mean a header (.h) file is missing, while unresolved symbol errors when linking mean a library is missing. This is usually because either a path to the dependency was not set correctly in the build system, the dependency was not installed, or a wrong version of the dependency was used.

Finding out which dependencies are broken may sometimes be difficult. Searching online for the missing filenames or symbols will often give a quick answer. On systems with package managers the headers and libraries are usually in a separate development package, called for example foo-dev or foo-devel.

Local Changes

Some complaints of Blender failing to build end up being caused by developers forgetting they have made changes to their code (patches applied or edits when developing).

Before spending too much time investigating an error building, check that your checkout has no local changes. You can stash those away (and restore later if desired) with this command:

git stash

Unsupported Environment

While Blender is portable, if you compile on a less common operating system, like NetBSD for example, it may need some minor edits to compile. The same goes for compilers, less common versions may need some adjustments if no active developers are currently using them.

Unless you want to spend time supporting less common development environments, normally it is best to use the default/standard development tools for your platform.

Reporting Build Problems

  • Use the bug tracker or the #blendercoders IRC channel to report your problem. If using IRC, use an external pasting tool instead of pasting more than 5 lines directly in the channel.
  • ALWAYS include a full error log, just saying "It failed" with 1-2 lines containing the error is not very helpful.
  • Include the operating system, compiler version and git revision of Blender.

Platform Maintainers

This section is for details that maintainers need, but not immediately useful for people building Blender.

Compiler Versions

Compiler Official Release Version Minimum Supported Version
Linux/Clang: - 3.5 (???)
Linux/GCC: 4.7 4.2
Mac-OSX/Clang: 3.5 (???) 3.5 (???)
Mac-OSX/GCC: - 4.2
MS-Windows/MSVC: 2013 2013


Library Versions

Blender uses many different libraries, let's try to keep official supported versions (i.e. those used by official build environments) in sync between all platforms!

Note: details on obtaining libraries are included in each platform's build documentation.

Library Version
Python 3.5.1
NumPY (optional) 1.10.1
Boost (optional) 1.60
ILMBase/OpenEXR (optional) 2.2.0
OCIO (optional) 1.0.9
OIIO (optional) 1.6.9
LLVM (optional) 3.4
OSL (optional) 1.7.3
OSD (optional) 3.0.2
OpenVDB (optional) 3.1.0
OpenCOLLADA (optional) No official release, git rev: 3335ac164e68b2512a40914b14c74db260e6ff7d
FFMEPG (optional) 2.1.5 (note: 'real' libffmpeg, not the libav fork, though this one should work too)
Bullet Physics (optional) 2.83