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.

Blender 2.6x SVN compiled with SCons on a 64 bit Debian based GNU/Linux system

  • Tested on Debian Sqeeze 6.0.4 - Kernel 2.6.32-5-amd64 x86_64 GNU/Linux - AMD Sempron 1800 MHz - 512 MB Ram (+ 1 GB swap) - ATI Radeon 9250


Official Blender Developer Guides here:

http://wiki.blender.org/index.php/Dev:2.5/Doc/Building_Blender/Linux/Generic_Distro/Scons

And here:

http://wiki.blender.org/index.php/Dev:2.5/Doc/Building_Blender/Linux/Troubleshooting


Note
This discussion talks about how to building Blender 2.6x on GNU/Linux with SCons using different installation paths for Python 3.2 and FFMPEG 0.10 Freedom


Building Blender 2.6x on GNU/Linux give us many Advantages, especially with Performance Improvement. Software is built on the basis of the computer hardware, optimizing access to Hard Disk, Memory, and Processor (even if with a single core). Advantages translates into improved time response in the entire application: opened, executed, and/or into multi-threading.


  • To build Blender you'll need Subversion, the program that allows you to download the Blender Source and Subsequent Updates. (http://subversion.tigris.org)

Every GNU/Linux distribution has its own "package", then there should be no problems for its availability.

First of all install dependencies

su
apt-get install subversion build-essential gettext libxi-dev libsndfile1-dev libpng12-dev libfftw3-dev libopenexr-dev libopenjpeg-dev libopenal-dev libalut-dev libvorbis-dev libglu1-mesa-dev libsdl-dev libfreetype6-dev libtiff4-dev libsamplerate0-dev libavdevice-dev libavformat-dev libavutil-dev libavcodec-dev libjack-dev libswscale-dev libx264-dev libmp3lame-dev scons libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev libspnav-dev tk-dev

Download the Blender Source

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

Install Python 3.2 in a non default path

Get the source from the Main page:

http://www.python.org/download/releases/3.2.2/

Or download directly:

http://www.python.org/ftp/python/3.2.2/Python-3.2.2.tgz


Extract the Python 3.2 source with:

wget -c http://www.python.org/ftp/python/3.2.2/Python-3.2.2.tgz 
tar -xvf Python-3.2.2.tgz

Into the folder where you extracted the Python 3.2 source open a terminal and type:

./configure --prefix="/usr/local/Py32"


Note
/usr/local/Py32 "path", is just an example - Configure your real path according to your system path. Just create as root the directory /usr/local/Py32 if doesn't exist. Already this will ensure that new Python 3.2 is not going to affect other versions of Python installed on your system. By default Python 3.2 doesn't build zlib, and some addons in Blender (ie: Luxblend). So it needs to install zlib-dev libraries into your system and then uncomment the following line Into the Modules/Setup file in the Python Source:

"zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz"


Compile Python 3.2

make
su
make install


  • Later you'll need to setup SCons (this Blender Build System) to find your Python 3.2 build.


- Make Python 3.2 the Default Python System Wide.


su
update-alternatives --install /usr/bin/python python /usr/local/Py32


- Ensure various versions of Python play nice with each other:


su
update-alternatives --config python

Install FFMPEG 0.10 Freedom in a non default path

With Blender 2.62 the old FFMPEG libraries was dropped to the new stable release FFMPEG 0.10. So its time to FFMPEG our system's default libraries. That means We'll need to supply the proper development libraries for FFMPEG. This is exactly the same process as for any other compilation. There are significant changes between FFMPEG stable releases and the ones into the new GIT repositories. Now Blender include the new Stable releases of FFMPEG 0.10. Depending on your platform, you will need to acquire the Stable release (http://ffmpeg.org/download.html), compile it, and configure your Blender configuration environment. Due to default library paths, compiling a local copy of ffmpeg can cause headaches. In order to prevent default library issues, it is advised that you locate the Stable version of ffmpeg away from the default library paths.

Download FFMPEG

wget -c http://ffmpeg.org/releases/ffmpeg-0.10.tar.gz

Compiling FFMPEG

cd ffmpeg-0.10
./configure --prefix=/usr/local/ffmpeg --enable-static --disable-avfilter --disable-vdpau --disable-bzlib --disable-libgsm --enable-libschroedinger --disable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-stripping --enable-runtime-cpudetect --disable-vaapi --enable-libopenjpeg --disable-libfaac --disable-nonfree --enable-gpl --disable-postproc --disable-x11grab --enable-libdirac --enable-libmp3lame --disable-librtmp --enable-libx264 --enable-libxvid --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-debug --enable-optimizations
make
su
make install


Note
./configure --help gives a list of command line arguments, for enabling or disabling additional features.


Setting Python 3.2.2 and FFMPEG 0.10 Path in SCons

SCons needs to know Python 3.2 and FFMPEG installation path. If your distro already uses you probably don't need to do anything.


In case you have compiled your own Python and FFMPEG into

/usr/local/


Go into your user-config.py file and change the following lines:


BF_PYTHON = '/usr/local'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '3.2'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/#config/libpython'+BF_PYTHON_VERSION+'.a'
BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic']
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION}.a'

into :

BF_PYTHON_ABI_FLAGS = 'm' # Most common for linux distros
BF_PYTHON = '/usr/local/Py32'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'  # BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a'
WITH_BF_FFMPEG = True
BF_FFMPEG = '/usr/local/ffmpeg'
BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'


  • Note: this is just an example; use your own installation path (use the absolute path!). By default the file user-config.py does not exist. You have to create a file called user-config.py in the root directory of the Blender source. All the configuration in this file will override the ones in your Scons config file (for example, linux2-config.py).

Compile Blender

cd ~/blender-build/blender
svn up
python scons/scons.py


Tip
svn up - Typing the command "svn up" into ~/blender-build/blender and rebuilding the source with "python scons/scons.py" will update the Blender release


Issues Launching Blender

There are anomalies starting Blender? The different FFMPEG installation path could be the main reason. So I need to link the FFMPEG libs. To resolve that I create a shell script with something like this:


export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ffmpeg/lib ./install/linux/blender


  • Make it executable and rename it as "startup-blender-svn.sh" or another name desired.
  • PS - This little paragraph need more attention in the future, cause this is just a "trick" to link FFMPEG libs installed in a non default path.


Note
Use as always the exactly Blender Installation Path. /blender/blender-build/ and /usr/local/ffmpeg/lib are just examples


Adding Cycles

Official Guide here:

http://wiki.blender.org/index.php/Dev:2.6/Source/Render/Cycles/Building


To add Cycles into Blender, and compile with SCons, on GNU/Linux, is quietly easy now that's into the trunk. Cycles to works properly needs two important dependencies:


boost-1.47 - http://www.boost.org/users/history/version_1_47_0.html

and

OpenImageIO 0.10 - https://sites.google.com/site/openimageio/

Libraries

There are several ways to obtain that libraries:


- 1 build/install needed libraries yourself

- 2 use libraries from the Blender trunk lib. That will add boost, OpenImageIO, and FFMPEG.

- 3 use builds from buildbot - http://builder.blender.org/download/

Adding libraries from the Blender trunk

I choose to use libraries from the Blender trunk lib repo located on:

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


Just Checkout from terminal:


For 32 bit libs use:

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

For 64 bit libs use:

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


My Blender release directory structure its like this right now:


  • blender
  • build
  • install
  • linux64


That SVN Checkout will download the the following directories: /boost; /ffmpeg; /oiio

(That resolve the FFMPEG TROUBLE - Installing FFMPEG 0.10 Freedom into the default path, the build process will works without errors!)


Note
Just check out the right libraries with the above commands.


Tweak the file user-config.py

Now its time to tweak the file user-config.py located into the blender root directory in the same way it's done in Cycles section:

https://svn.blender.org/svnroot/bf-blender/trunk/blender/build_files/buildbot/config/user-config-x86_64.py


Look also:

https://svn.blender.org/svnroot/bf-blender/trunk/blender/build_files/scons/config/linux-config.py


To enable "Ocean" it's necessary to set FFTW3 = true into the user-config.py file.


# FFT
WITH_BF_FFTW3 = True
WITH_BF_STATICFFTW3 = True


For FFTW3 look dependencies here: http://wiki.blender.org/index.php/User_talk:Cobe571#First_of_all_install_dependencies


or:

su
apt-get install libfftw3-3 libfftw3-dev

user-config.py file examples

See two user-config.py examples


A) into a non default path

# Python configuration
BF_PYTHON_ABI_FLAGS = 'm' # Most common for linux distros
BF_PYTHON = '/usr/local/Py32'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'  # BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a'
 
# FFMPEG configuration
WITH_BF_FFMPEG = True
BF_FFMPEG = '/usr/local/ffmpeg'
BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
 
# FFT
WITH_BF_FFTW3 = True
WITH_BF_STATICFFTW3 = True
 
# Cycles
WITH_BF_CYCLES = True
WITH_BF_OIIO = True
WITH_BF_STATICOIIO = True
BF_OIIO = '/cobe/Source-Box/3D-Editor/Blender/Blender-SVN-Build/linux64/oiio'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_BOOST = True
WITH_BF_STATICBOOST = True
BF_BOOST = '/cobe/Source-Box/3D-Editor/Blender/Blender-SVN-Build/linux64/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'


B) Using libraries from Blender SVN trunk

# Python configuration
BF_PYTHON_ABI_FLAGS = 'm' # Most common for linux distros
BF_PYTHON = '/usr/local/Py32'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'  # BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a'
 
# FFT
WITH_BF_FFTW3 = True
WITH_BF_STATICFFTW3 = True
 
# Cycles
WITH_BF_CYCLES = True
WITH_BF_OIIO = True
WITH_BF_STATICOIIO = True
BF_OIIO = '/cobe/Source-Box/3D-Editor/Blender/Blender-SVN-Build/linux64/oiio'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_BOOST = True
WITH_BF_STATICBOOST = True
BF_BOOST = '/cobe/Source-Box/3D-Editor/Blender/Blender-SVN-Build/linux64/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'



Note
Use always the correct paths for BF_OIIO ; BF_BOOST ; BF_PYTHON and BF_FFMPEG.


More info about Cycles here:

http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles