The compilation of Blender on Ubuntu

Source: Internet
Author: User
Tags using git

Here's the find information about what to build Blender on modern machines and distributions.

Troubleshooting

In the case you ' re trying-to-build on the old distributions, chances is that your the package Manager doesn ' t provide a recent Python , Collada, etc:in Those special cases the A look at the troubleshooting page


To has latest Blender successfully running on the Linux system you follow few simple steps.

This is not as hard as the most people would think if you follow these instructions.

    1. Install Required package dependencies.

    2. Download Blender Source.

    3. Compile Blender.

Get the source

The first step is for get the latest Blender source code from blender.org ' s GIT repository.

Copy and paste the following instructions into a terminal window. The following commands create a Blender-git folder in your home directory by downloading the latest source code commonly R Eferred to as ' master '. An Internet connection is needed.

mkdir ~/blender-gitcd ~/blender-gitgit clone http://git.blender.org/blender.gitcd blendergit submodule update--init-- Recursivegit submodule foreach git checkout mastergit submodule foreach git pull--rebase origin master

If you want to update your GIT clone checkout to the latest source does (in ~/blender-git/blender/):

Git pull--rebasegit submodule foreach git pull--rebase origin master

For additional information on using Git with Blender ' s sources, see:tools/git

Install the Dependencies Automatic Dependencies Installation

The preferred-to-install dependencies under Linux is now-to install_deps.sh -use the script featured with Blender sources. It currently supports Debian (and derived), Fedora, Suse and Arch distributions. When using install_deps.sh the script, you is only required to install the following dependencies:

sudo apt-get update; sudo apt-get install git build-essential

Then, get the sources and run as install_deps.sh explained below.

To build with FFMPEG and Cycles enabled, various libraries is needed. These can ...

    • Installed through your distributions repositories.

    • Built manually.

    • Skipped (many dependencies is optional).

    • Managed by a script which checks to missing dependencies and installs them or compiles from sources.

The later solution is now the preferred one! Simply Run:

CD ~/blender-git./blender/build_files/build_environment/install_deps.sh

This script works for Debian/redhat/suse based distributions, both and bits.

This scripts accepts some optional command lines arguments (use one --help to get a exhaustive list), among which:

    • --source <path>

    • Where to store downloaded sources for libraries we had to build (defaults to ~/src/blender-deps ).

    • --install <path>

    • The Where to install the libraries we has to build (defaults to /opt/lib ).

    • --with-osl

    • Try to build Openshadinglanguage. Note that this is still considered as experimental!

    • --skip-osl

    • Skip download and build Openshadinglanguage.

Some commands in this script requires sudo, so you'll be likely asked couple of the times for your password.

When the script is finish installing/building all the packages, it ' ll print which parameters for CMake and scons you should u SE to use compiled libraries.

If you had to compile your own boost libraries, you'll have the to-tell Linux where to find them to get blender running. Just run the following commands as root user, from a terminal window:

echo "/opt/lib/boost/lib" >/etc/ld.so.conf.d/boost.confldconfig
Manual Dependencies Installation

To manually install Blender ' s dependancy packages:

sudo apt-get update;  sudo apt-get install git build-essential libxi-dev libsndfile1-dev libpng12-dev libjpeg-dev libfftw3-dev Libopenexr-dev Libopenjpeg-dev libopenal-dev libalut-dev libvorbis-dev libglu1-mesa-dev libsdl1.2-dev libfreetype6-dev libtiff4-dev L Ibavdevice-dev libavformat-dev libavutil-dev libavcodec-dev libjack-dev libswscale-dev libx264-dev Libmp3lame-dev Python3.4-dev Libspnav-dev Libtheora-dev Libjack-dev Libglew1.6-dev

As a final note, here is the key libraries that want to use with Blender:

    • Python (3.4)

    • Needed for interface scripts (building without Python is supported and not meant for general use).

    • Boost (min 1.49)

    • necessary for Cycles, OSL, Audaspace, internationalization ...

    • Opencolorio (Min 1.0)

    • necessary to handle color spaces.

    • Openimageio

    • necessary for Cycles and OSL (min 1.1 in this case).

    • LLVM (min 3.0)

    • necessary for OSL.

    • Openshadinglanguage

    • Enable custom shaders under Cycles.

    • FFMPEG or Libav (FFMPEG fork)

    • For handling most video formats/codecs.

Compile 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 (GUI Configuration Tool).


Automatic CMake Setup

If you ' re not interested in manually setting up CMake build directory, configuring, building and installing in separate St EPS, we provide a convenience makefile in Blenders source directory which sets to CMake for you.

CD ~/blender-git/blendermake

Updating Blender is as simple as:

CD ~/blender-git/blendergit pull--rebasegit submodule foreach git pull--rebase origin mastermake

Once The build finishes you'll get a message like:

Blender installed, run from:/home/me/blender-git/build_linux/bin/blender

There is some pre-defined build targets:

    • Make-some is turned off by default because they can is difficult to correctly configure for newer developers A nd aren ' t essential to use & develop Blender in the most cases.

    • Make Lite -the quickest-I-get a Blender build up & running, can also help to avoid installing a lot of dependencies if you don ' t need video-codecs, Physics-sim & cycles rendering.

    • Make full – This makes a complete build with all options enabled, matching the releases on blender.org.

For a full list of the optional targets type ...

Make Help
Manual CMake Setup

If you want to has more control over your build and has configuration, building and installation as separate steps or ha ve multiple build directories for a single source dir. You can follow these steps.

Preparing CMake ' s directory

Let's suppose that ' ve checked out Blender's source in the folder ~/blender-git/blender .

Please note this in some cases the ' blender ' directory may have a different name. Some branches is modified copies of the Trunk/blender directory and is named e.g. Soc-2009-name_of_participant.

Now there are to choose a location for CMake build files. In CMake you could does an "In-source" Build or a "Out-of-source" build, but currently In-source Buil DS in Blenderis not allowed.

Out-of-source Build

By doing an "out-of-source" build you create a CMake ' s folder aside from ~/blender-git/blender , for example ~/blender-git/build :

mkdir ~/BLENDER-GIT/BUILDCD ~/blender-git/buildcmake. /blender

This would generate makefiles in the Build folder ( ~/blender-git/build ).

Warning

As said above, In-source-builds where you build blender from the source code directory is not supported.

If CMake finds a CMakeCache.txt in the source code directory, it uses that instead of using ~/blender-git/build/CMakeCache.txt .

If you had tried to do a in-source build, you should remove any CMakeCache.txt from the source Code directory before Act Ually running the Out-of-source build:

Rm-f ~/blender-git/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 the if you want to change defaults, make a debug build, disable features etc,
So-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-git/build/CMakeCache.txt file in a text editor

    • Using Cmake-gui If your distro supports it

    • Cmake-gui. /blender
    • Opens a graphical interface where can easily change parameters and re-configure things.

    • Using ccmake tool, with

    • Ccmake. /blender
    • Opens a text interface where can easily change parameters and re-configure things.

    • CMake parameters can also is easily set on the command line, for eg.

CMake. /blender-dcmake_install_prefix=/opt/blender-dwith_install_portable=off-dwith_buildinfo=off-dwith_gamee Ngine=off
    • These commands is exactly those found in so ~/blender-git/build/CMakeCache.txt can copy commands from there and use them on the command line Witho UT running ccmake.

Screenshot from Cmake-gui, QT based GUI for CMake

Screenshot from Ccmake, curse-based GUI for CMake


Building Blender

After changes has been do and you has generated the makefiles, you can compile using the make command inside The Build folder:

CD ~/blender-git/buildmakemake Install

Parallel Builds

For Multi-core/multi processor Systems you can build much faster by passing the jobs argument to make:-j (1+number_o F_cores).

For the example put "-j3" If you had a dual-core or "-j5" If you had a quad-core.
For shell-scripts use gnu-syntax:expr ' nproc ' + 1 or Bash-syntax: $ ((' Nproc ' + 1))

If it ' s still not using all your CPU power, leave out the number: "-j" to spawn as many as possible build process ES (usually 64).
Note that it could build faster, but make your system lags in the meanwhile.


Also Notice the install target is used, this would copy scripts and documentation into ~/blender-git/build/bin

For future builds you can simply update the repository and re-run make.

CD ~/blender-git/blendergit pull--rebasegit submodule foreach git pull--rebase origin mastercd ~/blender-git/buildmakem Ake Install


Notice

Both Portable & System installations is supported.

Portable installation is default where scripts and data files would be copied into the build ' ~/blender-git/build/bin ' dire Ctory and can is moved to other systems easily.

Disable to WITH_INSTALL_PORTABLE install into CMAKE_INSTALL_PREFIX which uses a typical Unix FHS layout:bin/, share/blender/, man/etc.


Static linking

If you want to share your build with others (for example through Graphicall), you should statically link against as much L Ibraries as possible.

Listing needed shared Libs

You can see all needed GKFX libraries by simply running ldd path/to/blender ! Nice and easy!


Note:by default, Python is not static. To make it so, you'll have the to-edit to PYTHON_LYBRARY something like /usr/lib/x86_64-linux-gnu/libpython3.3m.a;/usr/lib/x86_64-linux-gnu/libexpat.a (exact paths depend on your OS).

Static linking each Library:

    • Enable General static linking

    • Set with_static_libs to In, so, CMake would try to make blender link against STATIC LIBS when available. Though not perfect, this should reduce quite nicely needed shared libs.

    • Ffmpeg

    • Set the ffmpeg_libraries var to full paths of all needed libs (XviD, x264, etc.).

    • Boost

    • Set (or create) Boost_use_static_libs to True. If you is using boost automatically built by the install_deps.sh script, you should not need to do anything else.

    • But if you're using your own distro's boost package, the most likely would have the to set (or create) Boost_use_icu to True T OO (and install the relevant LIBICU development package), to get blender linking.

Todo:other Libs?

See also CMake
    • Introduction to CMake

    • Bill Hoffman presents CMake at googleedu (starts at 7:41, relevant to CMake until 31:18)

IDE setups with CMake
    • How to compile Blender using CMake with Qtcreator on Linux


The compilation of Blender on Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.