Compile Blender 2.45 – a how to guide

This guide was written for Blender 2.45.  I have an updated guide for building Blender 2.5 available HERE.

1. Acquire Blender source code and libraries

- Download and install tortoisesvn from: tortoisesvn.tigris.org
-created a folder named “blender” under c:\build, select the folder and click on SVN checkout, and use the following location:

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

-created a folder named “windows” under c:\build\lib, select the folder and click on SVN checkout, and use the following location:

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

Once the above 3 steps are done, you will have the most up-to-date blender source code and library in the world.

OPTIONAL INFO: If you want to build an official release, you can grab the more stable source code (~10MB, library files are not included) from blender.org/download/source-code. Simply delete everything under C:\build\blender and then extract the tarball to the same directory. Building from the official release ensures the Blender you compiled is stable and relatively bug-free.

2. Acquire compiling softwares

- Download and install Python 2.5.1 (9MB) from www.python.org
- Download Mingw 5.1.3 (~10MB) from www.mingw.org . Run the installer, Pick any mirror, Select Current and install packages MinGW BASETOOLS and G++ COMPILER.
- Download and install SCons 0.97 Windows (300KB) from www.scons.org
- Download the experimental GCC4.x for MinGW package from tdragon.net. Extract it to the place where you installed MinGW, and this will serve as a ‘drop in’ replacement compiler. From my own testing, GCC4 is faster than the one that comes with MinGW, but can cause trouble when compiling OpenAL.

3. Environment setup

- Go to Start Menu >> Control Panel >> System >> Advanced (Tab) >> Envoronmant Variables (button) >> System Variables scroll area double click on the PATH item
- Add the following line to the end: ;C:\Python25;C:\mingw\bin

4. Python stuff…

Copy libpython25.a from C:\Python25\libs to C:\build\lib\windows\python\lib


5. Customization (Enable/disable features, add speed optimizations)

- Create a new file named user-config.py under C:\build\blender\
- Open user-config.py with notepad and copy the following text into it.

WITH_BF_GAMEENGINE=’true’
WITH_BF_BULLET = ‘true’
WITH_BF_ODE = ‘true’
WITH_BF_OPENEXR = ‘true’
WITH_BF_FTGL = ‘true’
WITH_BF_FMOD = ‘true’
WITH_BF_FFMPEG = ‘true’
WITH_BF_QUICKTIME = ‘false’
WITH_BF_OPENAL = ‘false’
WITH_BF_SDL = ‘false’
BF_PYTHON_VERSION = ‘2.5′

CCFLAGS.extend( ['-march=i686', '-ftracer', '-fomit-frame-pointer', '-finline-functions', '-ffast-math'])
CXXFLAGS.extend(['-march=i686', '-ftracer', '-fomit-frame-pointer', '-finline-functions', '-ffast-math'])

REL_CFLAGS = [ '-O3' ]
REL_CCFLAGS = [ '-O3' ]

‘-march=’ is probably the most important flag in this config file. Newer Intel CPU (Pentium D, Core 2) owners are recommended to use ‘-march=nocona’, AMD (A64, X2) owners can try ‘-march=k8′.
‘-mmmx’, ‘-msse’, ‘-msse2′, ‘-msse3′ are usually implied by using a valid march flag, therefore they are not included in the config file.
‘-ffast-math’ are in general stable enough for daily use (I’ve never seen a crash), but if you are running a real production server or can not tolorate crashes, remove this flag. It will make the binary a little slower.

This is how the directory should look like:
build2

6. Compile!

- Open a command prompt window by click on Start >> Run >> type in “cmd” and hit OK.
- Navigate to where the Blender source code is by typing this into the command prompt cd C:\build\blender
- Start the building process: scons BF_TOOLSET=mingw BF_BUILDDIR=c:\install -j4
- The above command should take about 5-10 minutes to process, and it helps if you have a dual-core processor!
- When it finishes, (Hopefully without error), you can nagivate to C:\install\win32-mingw\ and find a complete Blender installation ready to be zipped up and distributed!

Where to go from here?

You might want to rid the blender.exe of extra useless debug data by entering the following command into the command line:
strip C:\install\win32-mingw\blender.exe
This will reduce the size of the executable by 8mb or so without having any negative impact

The above ‘user-config.py’ file will result in a full-featured Blender that is optimized for speed and should run on almost all modern processors. To speed up the building process, you can chose to disable some of the features by replacing ‘true’ with ‘false’ (this will give you a blender binary without certain feaures such as gameengine, audio, etc…)
scons clean BF_TOOLSET=mingw BF_BUILDDIR=C:\install
can be used to clean the build data and getting ready for a new build


I also recommend: How to build Blender using Visual C++ Express Edition 2008 By Eugene (etr9j), MSVC produces faster binary, but takes a lot longer to setup for the first time.

    • Vasilli
    • October 18th, 2009

    Hi.how can i compile blender 2.45 with the current blender library without ending up with a build of blender 2.5.My videocard(Unichrome 32mb Direct3D) can’t handle blender 2.5.

    • mikepan
    • October 20th, 2009

    Hi, all you need to do is check out the old source file and library from the SVN. I believe SVN has a tag system that labels specific revisions, Blender 2.45 is probably rev 1****.

    • Vasilli
    • October 21st, 2009

    i downloaded the blender source for 2.45 but i’ve got problem at compiling.what should i do:
    http://img10.imageshack.us/i/compproblem.png/

    • mikepan
    • October 21st, 2009

    actually it seems like a problem with Scons, not blender itself. Try building with a different version of Scons :D

    • vasilli
    • November 25th, 2009

    hello sir.it’s me again.i tried building with scons 0.97 and 1.0 and got this:
    http://img268.imageshack.us/i/pictureofbuildfalied.png/
    these are my env.variables:

    include C:\Program Files\Microsoft Visual Studio\VC98\atl\include;C:\Program Files\Microsoft Visual Studio\VC98\mfc\include;C:\Program Files\Microsoft Visual Studio\VC98\include

    lib C:\Program Files\Microsoft Visual Studio\VC98\mfc\lib;C:\Program Files\Microsoft Visual Studio\VC98\lib

    PATH C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\Python25;C:\Python25\Scripts;C:\mingw\bin

    TEMP %USERPROFILE%\Local Settings\Temp
    TMP %USERPROFILE%\Local Settings\Temp
    if i use python scons /scons.py
    it says:”python:can’t open file ’scons/scons.py’:[Errno 2] No such file or directory”
    i know i’ve been bugging you for months but i’d be very gratefull if you could give an advice.if not please please point me to a forum for noobs.

    • mike pan
    • November 25th, 2009

    hi vasilli, i am writing an updated guide for Blender 2.5 Will post it in a day or two. It should fix all your problems :D

    • vasilli
    • November 25th, 2009

    i forgot to mention that i was trying to compile blender 2.45.

    • vasilli
    • November 28th, 2009

    i used the library from tags,just as you advised me…

    • mike pan
    • November 28th, 2009

    The new guide can be used to build Blender 2.4x as well, you just need the old source code. It’s probably simpler than using Scons. Why are you still building 2.45 again?

  1. No trackbacks yet.