From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Building Blender

Building Blender is the first step towards becoming a contributor. This page walks you through the steps to get you up and running no matter the system you use. Specific instructions for FreeBSD, Linux, Mac, and Windows are included as well, however, the instructions are written in such a way that an experienced developer should be able to set this up on any system.

Setting up and building the first time

To build Blender from scratch, you will need to install the following tools:

  • Install Git and download the Source - To download the source code, commit your changes and stay in sync with the most up-to-date changes from others.
  • Download the dependency libraries - To download all of the precompiled libraries (aka python, boost, etc...)
  • Prepare the build system - either SCons or CMake - build systems organize all those pesky source files into a usable structure for both your compiler and an optional IDE.
  • a compiler/IDE - Compilers do the work of turning your code in numerous compilers are specifically supported in this doc, including VC++, Mingw, and others.
  • Build!

Troubleshooting Build Failures

Blender should build "right out of the box". Most building problems are not actually errors in blenders source code, although you can never fully rule out that possibility. These are some common causes for failing to build. If you have followed these steps and still have issues, don't hesitate to ask for help at the #blendercoders IRC channel.

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 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.

Microsoft Visual Studio specific issues

Blender builds, but doesn't run

From MSVC you need to load the project file Blender.sln from the Build Path,

Select the menu item: Build -> Build Solution.

You will have to build the INSTALL target, this copies DLL's and files used by Blender to the build directory so blender.exe can start-up.

You wont have to run this target every build, but do it after updating SVN libraries, otherwise you risk not having the correct libraries to run blender.

error LNK20260: module unsafe for SAFESEH image

Known issue, being tracked in [https://developer.blender.org/D682

Reporting Build Problems

  • ALWAYS include a full error log, just saying "It failed" with 1-2 lines containing the error isn't very helpful.
  • Include what build system you use, SCons/CMake, compiler version, git revision of blender.
  • There is usually someone on at the #blendercoders irc channel.