Operating system specific instructions for creating a blender build from scratch.
Building blender can be thought of as following a number of steps. The details of these are explained in the guides above.
- Choosing a build configuration
- Before building, you need to determine your operating system, the build system, the compiler and related development tools, and dependencies to use.
- Install development tools
- Install required dependencies
- Some dependencies may need to be installed manually, others may be available along with the blender source code. Dependencies generally consist of header files and libraries.
- Download the source code, usually through svn (subversion) to get the latest version
- Try to build and resolve build failures (see next section)
- Successful build!
Blender has two build system, SCons and CMake. Which one to use is a personal preference, and generally they can both build the same features, it's mostly a matter of personal preference. Besides that you must also choose a compiler to install, and choose if you want to build a 32bit or 64bit Blender.
- 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/
- Build Files
- CMakeLists.txt throughout the source tree.
- ./../build_<platform>/bin, or the project directory for the given generator (CMake -G <generator>).
- ./user-config.py (configuration file)
- ./build_files/scons/config/<platform>-config.py (for hints and documentation, don't edit these!)
- Build Files
- SConscript throughout the source tree.
- ./../install/<platform>/ by default, configurable with BF_INSTALLDIR=<dir>
Resolving Build Failures
Most building problems are not actually errors in blenders source code, although you can never fully rule out that possibility.
Here are common causes for failing to build.
On Windows or OSX 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.
Some complaints of blender failing to build end up being caused by developers forgetting they have made changes to their svn (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 do this by reverting all local changes).
svn revert . -R
While Blender is portable, if you compile on a less common operating-system NetBSD for example, it may need some minor edits to compile.
The same goes for compilers, less common version may need some adjustments if no active developers are currently using them.
Unless you want to spend time supporting less common development-environments, normally its best to use the default/standard development tools for your platform.
Reporting Build Problems
- ALWAYS include a full error log, just saying "It failed" with 1-2 lines containing the error isnt very helpful.
- Include what build system you use, SCons/CMake, compiler version, SVN revision of blender.