From BlenderWiki

Jump to: navigation, search

Subversion

Certificate verification error

If you try to check out your code from a hosted subversion repository, under Ubuntu 10.04 or newer, you may be disappointed to have it fail with the error:

svn: OPTIONS of 'https://server.com/repo': Certificate verification error: signed using insecure algorithm  (https://server.com/repo)

Here is the work around:

In the [groups] section (before [global]) of your ~/.subversion/servers add the following:

blender = svn.blender.org
[blender]
ssl-trust-default-ca = no

Python

Compiling

Blender 2.7x needs Python 3.4, it won't build with any older Python versions, thus it is an important dependency.

If your distro has no python3.4 package yet, this is very easy to compile without installing into your system and confusing the package manager.

  1. Get the Python 3.4 source from here (Python-3.4.0.tar.bz2)
  2. Extract the Python 3.4 source.
  3. In the folder where you extracted Python 3.4 source type (note, /opt/py34 is just an example):
    ./configure --prefix="/opt/py34"

by default Py3.X doesn't build zlib, and some addons in blender (ie:luxblend) need it so make sure to install zlib and zlib-dev libraries in your system and then uncomment the following line

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

in the Modules/Setup file in the python source

  1. Now type:
    make; sudo make install
  2. Later you will need to setup your blender build system (cmake or scons) to find your Python 3.4 build.

Compiling (Linux/Generic)

# get source
wget http://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz
tar -xvf Python-3.4.0.tgz
 
# make install
cd Python-3.4.0
./configure --prefix=/opt/py34
make
sudo make install

Compiling (Linux/Ubuntu)

# get required packages for build
sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev
 
# get source
wget http://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz
tar -xvf Python-3.4.0.tgz
 
# make install
cd Python-3.4.0
./configure
make
sudo make altinstall
 
# make 3.4 the default python system wide (number 1 at the end stays there)
sudo update-alternatives --install /usr/bin/python python /your/path/to/python3.4
 
# ensure various versions of python play nice with each other
sudo update-alternatives --config python

Setting Python Path in SCons

Distro Python package

Scons needs to know the Python 3.4 installation path. If your distro already uses Python 3.4, you probably don't need to do anything. But do check what ABI settings have been used for your distro package. The variable to govern this is

BF_PYTHON_ABI_FLAGS_SUFFIX

Set its content to any combination of 'dmu', or empty.

Manually built Python

In case you have compiled your own Python in

 /opt/py34

go in in your user-config.py file and change the following :

BF_PYTHON = '/usr/local'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '3.4'
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_SUFFIX = "m"  # may be any combination of 'dmu' or empty
BF_PYTHON = '/opt/py34'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '3.4'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}' + BF_PYTHON_ABI_FLAGS_SUFFIX
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' + BF_PYTHON_ABI_FLAGS_SUFFIX
BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic', '-ltk8.5', '-ltcl8.5', '-lz']
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION}' + BF_PYTHON_ABI_FLAGS_SUFFIX + '.a'

Note that this is an example, use your own Python 3.4 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).

Setting Python Paths in CMake

In case you have compiled your own Python in

/opt/py34

please update CMakeCache.txt file like this:

PYTHON_INCLUDE_DIR:STRING=/opt/py34/include/python3.4
PYTHON_LIBPATH:STRING=/opt/py34/lib
PYTHON_LIBRARY:STRING=python3.4;-ltk8.5;-ltcl8.5;-lz
PYTHON_VERSION:STRING=3.4

This is an example, use your own python installation path.

Note, a debug python will have a 'd' suffix, depending on your configuration you may have to add suffix chars 'd', 'm' & 'u' eg

PYTHON_INCLUDE_DIR:STRING=/opt/py34/include/python3.4d
PYTHON_LIBPATH:STRING=/opt/py34/lib
PYTHON_LIBRARY:STRING=python3.4d;-ltk8.5;-ltcl8.5;-lz
PYTHON_VERSION:STRING=3.4

Note, these settings can now be done from the ccmake or cmake-gui section (as outlined above) by entering these values in the appropriate sections.

If you choose a GUI, after you modify the parameters you need to re-configure and re-generate makefiles: for example in ccmake you can re-configure by pressing C and re-generate makefiles by pressing G.

OpenCOLLADA

TR1
To be able to use OpenCOLLADA, make sure your compiler supports TR1

Dependencies

On some distros (ubuntu) you need to install the pcre lib:

sudo apt-get install libpcre3-dev

Installing

Build with install_deps.sh

The preferred way to build Opencollada is to use the script install_deps.sh which knows which exact version of collada is needed for the Blender release that you want to build. you can find the script in the Blender source distribution at the location:

./build_files/build_environment/install_deps.sh

Build manually from source

If you want to build Opencollada, then get the sources from github.com. Make sure to make a fresh git check out. However you need to know which exact version you have to checkout. You find this information in install_deps.sh, function compile_OpenCOLLADA().

For Blender 2.68 you can checkout:

git checkout e886e196673222f2f4bc32b936dc96419fff815f 

Then follow the build instructions.

Build OpenCollada

scons XMLPARSER=expatnative

Copy libs into ./lib

Blender's scons and cmake expect OpenCollada's libs to be in [opencollada-dir]/lib directory. Create ./lib and copy OpenCollada libs into it with:

mkdir lib
find . -iname "*.a" | xargs cp -vt lib

Enable COLLADA support in Blender

scons

Add these lines to your user-config.py:

WITH_BF_COLLADA = True
BF_OPENCOLLADA = "[opencollada-dir]" # replace [opencollada-dir] with an _absolute_ path to your opencollada source tree

Build

python scons/scons.py

cmake

mkdir build-cmake
cd build-cmake
# generate makefiles
env OPENCOLLADA_ROOT_DIR=[opencollada-dir] cmake -G 'Unix Makefiles' -D EXPAT_LIB=expat -D WITH_OPENCOLLADA=ON [other build options] [source-directory] # optional: -D CMAKE_BUILD_TYPE=Debug
make

Note: [source-directory] is NOT optional in the above cmake command. Just replace it with your blender source directory (as usual with cmake out-of-source builds).

You can also set PCRE and EXPAT paths with the above cmake command. By default they are expected to be in /usr/lib and /usr/include.

FFMPEG

FFMpeg for blender 2.59 and higher
The dependency has changed to ffmpeg 0.7. For windows, new libraries are already included in the lib folder. For linux, check the migration guide: User:Nazg-gul/FFmpegUpdate

Introduction

Since Blender's revision r26894, FFMPEG your system's default libraries. If you are compiling Blender from the sources, you will likely encounter a few migration issues.

What does this mean to me?

This now means that you will need to supply the proper development libraries for ffmpeg. This is exactly the same process as for any other compilation.

What are the libraries?

Depending on your platform, ffmpeg will sometimes be packaged into separate libraries. For example, under Ubuntu 9.10, the libraries in question are libavcodec-dev, libavdevice-dev, libavformat-dev, libswscale-dev, and libavutil-dev by default.

What if I want to use the official FFMPEG SVN?

There are significant changes between FFMPEG stable releases and the ones in SVN. Stable releases of FFMPEG may cause blender to not build due to header file include path issues. Depending on your platform, you will need to acquire the SVN version, compile it, and configure your Blender configuration environment.

Compiling FFMPEG in a non default path

(Tested on Linux: Ubuntu 9.10 amd64 / i386)

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 SVN version of ffmpeg away from the default library paths.

  1. Change to a non default library path. Your home directory would work such as /home/yourhome/yoursources.
  2. Checkout ffmpeg:
    svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
  3. Configure ffmpeg:
    cd ffmpeg; ./configure --enable-gpl --prefix=/home/yourhome/yoursources
  4. Make ffmpeg:
    make
  5. Install it. Note that sudo is not required if you stay within your home directory.
    make install

Setting Scons to use your new FFMPEG path

  1. Configure Blender.
    If you already have a user-config.py file in your Blender source directory, you will edit it.
    If you don't, copy the linux2-config.py file from ./config to the root directory and rename it user-config.py.
    Adjust the following variable:
    BF_FFMPEG = '/home/yourhome/your-ffmpeg-prefix-setting-above'
  2. Compile Blender as normal.

Depending on your system configuration, you may need to further refine the above steps. The most important thing to note here however, is that default library paths will overrule your customized libraries.

Setting paths for system FFmpeg in Scons

If you have compiled your own FFMPEG please follow instructions written here.

Otherwise, if you want to build Blender with the system ffmpeg, go in in your user-config.py file and add

 # enable ffmpeg  support
 WITH_BF_FFMPEG = True
 BF_FFMPEG = '/usr'
 BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include/ffmpeg'
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'

This should help finding the header files that ubuntu install in a ffmpeg directory.