Compile Blender – Advanced
Compiling Blender 2.45 on Windows…Advanced Guide
An Easier guide: Compiling Blender 2.45 on Windows. The Easy way.
Please follow the guide precisely. The guide also assumes all software installations use the default path
This guide is provided as-is because a few people have requested it. I do not know if the same approach would build Blender 2.49a.
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 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
- For Vista Users: There is one more step involved
4. Python stuff…
Copy libpython25.a from C:\Python25\libs to C:\build\lib\windows\python\lib
5.Getting Ready (You can use this step to customize what features you want, and the optimization to use)
- 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:

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 -j2
- 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!
7. LargeAddressAware
More info one what it does here. But in a nut shell: making a program ‘LAA’ means it will be able to address more memory than conventional applications – a good thing for Blender when dealing with large scenes.
You will need install Visual C++ 2008 Express Edition (Free)
Then simply run this command
YOUR_PATH_TO_VISUAL_STUDIO_9\VC\bin\editbin.exe /LARGEADDRESSAWARE C:\install\win32-mingw\blender.exe
This will flag the binary as ‘LargeAddressAware’. However, do this step after you ’strip’ the executable, otherwise the flag might get stripped as well.
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
Acknowledgement: A big thanks goes to Nathan Letwory(jesterKing), lukep, Jonathan Jacobs and Johnny Matthews for the BlenderDev/SconsRefactoring article at mediawiki.blender.org; and jmk for pointing me to the python25.a solution.
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.