From BlenderWiki
Here you find information about how to build Blender on modern machines and distributions.
Troubleshooting
In case you're trying to build on old distributions, chances are that your package manager doesn't provide Python 3.2, Collada, etc: in those special cases please have a look at the troubleshooting page
|
To have latest Blender successfully running on Linux system you follow few simple steps.
This is not as hard as most people would think if you follow these instructions.
- Install needed package dependencies
- Download Blender source
- Compile Blender
Install the dependencies
sudo emerge dev-vcs/subversion \ sys-devel/gettext media-libs/openal \ x11-libs/libXi x11-misc/util-macros \ media-libs/libsndfile media-libs/openjpeg \ media-sound/jack-rack media-libs/libpng \ media-libs/openexr media-libs/freealut \ media-libs/libvorbis media-libs/mesa \ media-libs/freetype media-libs/libsdl \ media-libs/tiff sci-libs/fftw \ media-libs/x264 media-libs/libquicktime \ media-video/ffmpeg dev-lang/python
After installtion check your active Python with eselect. Note that while Blender 2.5 uses python 3, scons uses python 2, so you want to select python 2 here. Blender has its own copy of python 3.
eselect python list
output example:
Available Python interpreters: [1] python2.6 * [2] python3.2
Get the source
The first step is to get the latest Blender source code from blender.org's SVN repository.
Copy and paste the following instructions into a terminal window. This creates a blender-svn folder in your home directory by downloading the latest source code commonly referred to as 'trunk'. An Internet connection is needed.
cd ~ mkdir blender-svn cd blender-svn svn co https://svn.blender.org/svnroot/bf-blender/trunk/blender
If you want to update your svn checkout to the latest source (in ~/blender-svn/blender/)...
svn upDependencies from SVN
To build with FFMPEG and Cycles enabled, various libraries are needed. These can be built manually or installed through repositories, but it is often easiest to get the precompiled libraries from our svn, since this ensures the right version is used. Once these are checked out, they will be automatically picked up and used by the build system.
Run this for 64bit linux:
cd ~/blender-svn svn co https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux64 lib/linux64
For 32bit linux:
cd ~/blender-svn svn co https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux lib/linux
Similar to the source code, this can be updated by going into ~/blender-svn/lib/<platform>, and running:
svn upCompile Blender with CMake
Installing CMake
From within your package manager, install:
- cmake
- a cmake's configuration tool like
- ccmake (text based interface) or,
- cmake-gui (based on qt).
sudo emerge dev-util/cmake
Automatic CMake Setup
If you're not interested in manually setting up CMake build directory, configuring, building and installing in separate steps, we provide a convenience makefile in blenders source directory which sets up cmake for you.
cd ~/blender-svn/blender make
Updating blender is as simple as:
cd ~/blender-svn/blender svn up make
Once the build finishes you'll get a message like..
blender installed, run from: /home/me/blender-svn/build/linux/bin/blender
There are some pre-defeined build targets such as "make debug" or "make lite" - for a fast, small binary. For a full list of the optional targets type...
make help
Manual CMake Setup
If you want to have more control over you're build and have configuration, building and installation as separate steps or have multiple build directories for a single source dir. You can follow these steps.
Preparing CMake's directory
Let's suppose that you've checked out Blender's source in the folder ~/blender-svn/blender.
Please note that in some cases the "blender" directory may have a different name. Some branches are modified copies of the trunk/blender directory and are named e.g. soc-2009-name_of_participant.
Now you have to choose a location for CMake build files. In CMake you could do an "in-source" build or an "out-of-source" build, but currently in-source builds in Blender are not allowed.
Out-of-source build
By doing an "out-of-source" build you create a CMake's folder aside from ~/blender-svn/blender, for example ~/blender-svn/build:
mkdir ~/blender-svn/build cd ~/blender-svn/build cmake ../blender
This will generate makefiles in the build folder (~/blender-svn/build).
Warning
If CMake finds a If you have tried to do an in-source build, you should remove any CMakeCache.txt from the source code directory before actually running the out-of-source build: rm -f ~/blender-svn/blender/CMakeCache.txt |
Editing CMake's Parameters
Note that CMake should detect correct parameters so you shouldn't need change defaults to simply to compile blender, this is only if you want to change defaults, make a debug build, disable features etc,
so you may want to skip this section for now and come back to it later if you want to make adjustments.
You can modify the build parameters in different ways:
- editing
~/blender-svn/build/CMakeCache.txtfile in a text editor - using cmake-gui if your distro supports it
- using ccmake tool, with
ccmake ../blender- This opens a text interface where you can easily change parameters and re-configure things.
- cmake parameters can also be easily set on the command line, for eg.
cmake ../blender \ -DCMAKE_INSTALL_PREFIX=/opt/blender \ -DWITH_INSTALL_PORTABLE=OFF \ -DWITH_BUILDINFO=OFF \ -DWITH_GAMEENGINE=OFF
- These commands are exactly those found in
~/blender-svn/build/CMakeCache.txtso you can copy commands from there and use them in the command line without running ccmake.
|
|
Building Blender
After changes have been done and you have generated the makefiles, you can compile using the make command inside the build folder:
cd ~/blender-svn/build make make install
| Parallel Builds | |
| For multi-core / multi processor systems you can build much faster by passing the jobs argument to make: -j(1+number_of_cores). For example put "-j3" if you have a dual-core or "-j5" if you have a quad-core. For Shell-scripts use GNU-Syntax: expr `nproc` + 1 or Bash-Syntax: $((`nproc`+1)) |
Also notice the install target is used, this will copy scripts and documentation into ~/blender-svn/build/bin
For future builds you can simply update svn and re-run make.
cd ~/blender-svn/build; svn up ../blender; make; make install
Notice
Portable installation is default where scripts and data files will be copied into the build './bin' directory and can be moved to other systems easily. Disable |
See also
CMake
- Introduction to Cmake
- Bill Hoffman presents CMake at GoogleEdu (starts at 7:41, relevant to cmake until 31:18)