Build Blender 2.5, a visual guide

Today I will present a simple graphical guide to build Blender 2.5 on a Windows computer.  A lot of the instructions just need to be done one time, once you have a building environment setup, updating the build is a *really* simple process.  But if you just want a cutting-edge daily release, you can find those pre-compiled for you on Graphicall.org

Firstly, you will need a few piece of software: We are going to use Microsoft Visual Studio 2008 and Cmake to help us build Blender, and to fetch the source code from blender.org, we’ll also need a SVN client, I will use TortoiseSVN.

1. Get Visual Studio 2008. If you have access to a copy of Visual Studio, great!  But I heard the free Express Edition works too.  I went with a custom installation and this is all the components you’ll need to build Blender.

Custome Installation

2. Get CMake and install it.  It’s free.

3. Install TortoiseSVN, also free.

4. Once all the software are installed, we can begin to acquire the Blender source codes!  First, navigate to an empty directory and right click to do a SVN Checkout.  Use the following URL:

https://svn.blender.org/svnroot/bf-blender/trunk/blender

Put the source under C:\Blender\blender. Next, let’s also acquire the libraries needed to build Blender.  Do another check out with the following URL:

https://svn.blender.org/svnroot/bf-blender/trunk/lib/windows

Make sure you put the files under a directory like C:\Blender\lib\Windows.  If you want to make 64bit builds, also check out the 64bit libs:

 https://svn.blender.org/svnroot/bf-blender/trunk/lib/win64

Put that under C:\Blender\lib\Win64

04

Use TortoiseSVN to check-out the Blender Windows Library

Once you have done the 3 check-out, your directory structure should look like this, make sure all the folders and files are in the proper place, otherwise you will have a hard time building Blender:

Folder structure

Folder structure

5. Now that you have all the source files, it’s time to start the building process!

We are going to use CMake to generate a “solution” file for Visual Studio.  A solution is what Visual Studio would open to build the entire Blender. It’s a collection of smaller project, each project is a collection of source files.

Now open CMake, and In the top text box, type in where you put the Blender source code. (C:\Blender\blender, in my case)

In the second text box below it, select a fresh directory where you want the output file to go. I am using C:\Blender\build

Now click on Configure, this will bring up another dialog box where it asks you which generator to pick.  We are going to use Visual Studio 9 2008, or Visual Studio 9 2008 Win64, if you want to build a 64bit Blender.

CMake

Then CMake will populate the main window with a list of options that you can disable or enable.  The default selection is good, but if you want to speed up the building process, you can deselect certain options that you are not using.

Certain options might also be unavailable or broken on 64bit.  For example, if you are building a 64bit release, make sure you uncheck FFMPEG, JACK, and QUICKTIME, since there is no 64bit library for these media features yet.

CMake Options

For first timers, I would suggest unchecking all of these boxes to build a minimalist Blender.  It will be faster, smaller, and there is less chance of running into an error at compile time.  You can come back and re-enable these settings once your first build is successful.  Once you have made your selection, click on Configure at the bottom of the screen.  Then followed by clicking on Generate. These will generate the corresponding Visual Studio solution files in the directory you specified above.  (C:\blender\build\) in our case.  Close CMake.

6. Navigate to C:\blender\build, you should see the solution file you just generated.  Open “Blender.sln” with Visual Studio 2008.

Build folder

Once Visual Studio opens the solution, make sure you change the default build target from Debug to Release.  Otherwise you will end up with a debug build of Blender that is slower, bigger, and probably not helpful unless you are debugging.

Visual Studio 2008

After that, simply select Build Solution from the build menu.  After about 10 minutes of compiling and linking, a fully functional Blender installation should be ready under C:\Blender\build\Bin\Release.

29 thoughts on “Build Blender 2.5, a visual guide

  1. The linker is trying to build the binary by linking it with BF_ELBEEM, which is the fluid module. Maybe you have deselected it in CMake, but for some reason it doesn’t quite work. The easiest solution is simply to go back to CMake, enable Elbeem, regenerate solution files, and then re-build from Visual Studio.

  2. Yes! My first successful build, thanks to your tut! I couldn’t wait to try out Nexyon’s sound stuff he committed today so I built blender myself! Yeah… now, off to work with my new build…hee hee.

  3. halo, i use VS2005 to compile the project, the following error message shown
    “cannot open input file ‘..\..\lib\Release\bf_audaspace.lib”

  4. Nicky, bf_audaspace does not exist probably because the bf_audaspace project did not build successfully. Check the error console for more information.

  5. The following is the error message:

    1>AUD_LowpassReader.cpp
    1>..\..\..\blender\intern\audaspace\FX\AUD_LowpassReader.cpp(54) : error C2065: ‘M_PI’ : undeclared identifier
    1>..\..\..\blender\intern\audaspace\FX\AUD_LowpassReader.cpp(85) : warning C4018: ‘AUD_HighpassReader.cpp
    1>..\..\..\blender\intern\audaspace\FX\AUD_HighpassReader.cpp(54) : error C2065: ‘M_PI’ : undeclared identifier
    1>..\..\..\blender\intern\audaspace\FX\AUD_HighpassReader.cpp(85) : warning C4018: ‘AUD_EnvelopeReader.cpp
    1>..\..\..\blender\intern\audaspace\FX\AUD_EnvelopeReader.cpp(47) : error C2666: ‘pow’ : 6 overloads have similar conversions
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(575): could be ‘long double pow(long double,int)’
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(573): or ‘long double pow(long double,long double)’
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(527): or ‘float pow(float,int)’
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(525): or ‘float pow(float,float)’
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(489): or ‘double pow(double,int)’
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(123): or ‘double pow(double,double)’
    1> while trying to match the argument list ‘(float, double)’
    1>..\..\..\blender\intern\audaspace\FX\AUD_EnvelopeReader.cpp(48) : error C2666: ‘pow’ : 6 overloads have similar conversions
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(575): could be ‘long double pow(long double,int)’
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(573): or ‘long double pow(long double,long double)’
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(527): or ‘float pow(float,int)’
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(525): or ‘float pow(float,float)’
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(489): or ‘double pow(double,int)’
    1> C:\Program Files\Microsoft Visual Studio 8\VC\include\math.h(123): or ‘double pow(double,double)’
    1> while trying to match the argument list ‘(float, double)’
    1>..\..\..\blender\intern\audaspace\FX\AUD_EnvelopeReader.cpp(66) : warning C4018: ‘AUD_ButterworthReader.cpp
    1>..\..\..\blender\intern\audaspace\FX\AUD_ButterworthReader.cpp(54) : error C2065: ‘M_PI’ : undeclared identifier
    1>..\..\..\blender\intern\audaspace\FX\AUD_ButterworthReader.cpp(94) : warning C4018: ‘<' : signed/unsigned mismatch

  6. Hi Nicky,

    Can you try another revision? Sometimes the SVN does not build simply because people are constantly doing modifications. I am not too sure about the error, but it looks like you are using Visual Studio 2005. You should try to build it with VS2008 Express, which is free.

  7. Finally having a working latest build using this GUI method. The builds using Visual Studio CMD always fail.

    Also found you need something like sliksvn installed if you want the splash screen to include the build number.

    Anyway is there anyway of making this more automated. Like a batch file to update the SVN, cmake, visual compile, deleted the not needed visual studio files and compress it using 7zip?

    Also how do you add/get things like bmesh or other interesting developments to messy around with like the optmized builds you find on graphicall?

    Thanks for the guide.

  8. @mike, thanks for the link. I assume I just set up a new folder @ the root of builds\ called branches. Then do an SVN pull on a particular project which will compile blender + [branch project]. Maybe you could do a walk through on how people create optimized builds with xyz features added…

    Lastly how do I set up a shared user preferences folder for blender. Is there something I’ve missed in the above steps. Only since creating my own build I was using the latest beta release with the default win-installer. Except when I run my own build it doesn’t use the preference from the %AppsData% created by the beta install?

  9. @mike, don’t worry I figured it out. In each new build I do if I move the \config and \plugins folder to the %AppData% and overwrite those the new build grabs my current preferences. Not sure how it affects my offical beta install, nevertheless it works.

  10. Thanks for your guide. i’m new to both blender and visual studio but i could build my own build.

    The only problem i have is that the revision number is shown as “runknown”. can you please explain the steps i need to take to show the actual revision number on the splash screen?

  11. Answering my own question, thanks to people in #blendercoders i figured it out.

    You need to have svnversion.exe (sliksvn has it where you install it in bin folder for example as mentioned above) and then you need to add it to your PATH and after that build blender like you did before. this time the revision number will show fine on the splash screen.

  12. I’m new to this and have been trying to compile blender.
    Have faced many errors.
    wanted to know that does this this method use python and which version.?

  13. Also i wanted to know that I have already downloaded the source and that was from another machine. So can i do a local checkout ?

  14. Hi cj, you don’t need to install Python to build blender, the python library comes with the Blender /lib SVN. Where are you running into the errors, and what are the errors?

    If you already have a copy of the source, you can just copy the source from one computer to the other like a regular folder.

  15. Hi Mike,

    Thanks to your guide I’ve been able to successfully build 64-bit versions of Blender 2.5. :)

    Recently however, I’ve been attempting to build the sculpt branch, but without success, and I can’t really tell what’s going wrong. Everything seems to compile and link correctly, but it appears that it fails while it is copying files to the output directory. I’ve attached a few screenshots to help illustrate the problem.

    Basic directory structure:
    http://i768.photobucket.com/albums/xx328/Kira_Vakaan/dir.jpg

    CMake configuration window:
    http://i768.photobucket.com/albums/xx328/Kira_Vakaan/cmake.jpg

    VC 2008 Build Output window:
    http://i768.photobucket.com/albums/xx328/Kira_Vakaan/vcoutput.jpg

    Any light you might be able to shed on the problem would be very appreciated. Thanks :)

  16. Chris, like you said the error is due to Visual Studio enable to run the ‘post-build’ installation step of the build process. It’s usually not critical, your Blender should have been built already, go check the ‘release’ folder :)

  17. Alright, hmm, I tried to run the blender.exe in the release folder, but it tells me that it cannot find python31.dll. It would appear that the .exe’s dependencies were not properly put in place. Also, there seem to be some intermediate files left around. Is there a way to run the post-build steps to complete the process?

  18. You can go through the log and find out at which step is failed. Otherwise, you can manually find the dlls. and stuff from the lib directory and copy it over manually.

  19. Hi mike. Great tutorial. However, I`m using tortoiseSVN, cmake and visual studio 10, and blender`s newest release as of aug 23 and i get some differences from your tutorial.

    This is the first time i`ve tried cmake or any of the other tools, so it might be a simple problem.
    I notices that my svn download gives me a blender folder different from the picture in your tutorial.
    I get 8 folders and 4 files whereas you get 16 folders 0 filds.

    bf-blender – Revision 39669: /trunk/blender

    ..
    CMakeLists.txt
    COPYING
    GNUmakefile
    SConstruct
    build_files/
    doc/
    extern/
    intern/
    po/
    release/
    scons/
    source/

    Has blender changed the structure of the svn trunk? When i use cmake on the blender folder i get a pop-up saying Error in configuration process, project files may be invalid.

    Does this tutorial need updating to match a new svn or am i missing something?

    thanks,

    kesten

  20. a little more info from the cmake error port

    Check for working C compiler using: Visual Studio 10 Win64
    Check for working C compiler using: Visual Studio 10 Win64 — broken
    CMake Error at C:/cmake-2.8.5-win32-x86/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
    The C compiler “cl” is not able to compile a simple test program.

    It fails with the following output:

    Change Dir: C:/BlenderSVN/cmake_build/CMakeFiles/CMakeTmp

    Run Build Command:C:\PROGRA~2\MICROS~2.0\Common7\IDE\devenv.com
    CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec

    Microsoft (R) Visual Studio Version 10.0.30319.1.
    Copyright (C) Microsoft Corp. All rights reserved.

    The evaluation period for this product has ended.

    CMake will not be able to correctly generate this project.
    Call Stack (most recent call first):
    CMakeLists.txt:91 (project)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>