「Dev:Doc/Building Blender/Linux/Dependencies From Source」の版間の差分

提供: wiki
移動先: 案内検索
 
(1版 をインポートしました)
 
(相違点なし)

2018年6月29日 (金) 04:37時点における最新版

Building Dependencies From Source

Python

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

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

  1. Get the Python 3.5 source (Python-3.5.1.tgz)
  2. Extract the Python 3.5 source.
    tar -xvf Python-3.5.1.tgz
    
  3. Now type:
    make; sudo make install
    

Later you will need to setup your Blender build system to find your Python 3.5 build.

Newer Python Versions
Usually, Blender does build and work nice with newer Python versions. However, we do not officially support those, so if you want to be on the cutting edge you are on your own…


Compiling (Linux/Generic)

# get source
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
tar -xvf Python-3.5.1.tgz

# make install
cd Python-3.5.1
./configure --prefix=/opt/py35
make
sudo make install

Dependencies

Depending on your distribution you may need to install build dependencies.

Ubuntu
sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev

Setting Python Paths in CMake

In case you have compiled your own Python in

/opt/py35

CMake will find this automatically, since "/opt/py${PYTHON_VERSION}" is added to the search path.



In the case you have a different Python path which isn't in your system path, you can simply tell CMake to look for a Python prefix, which will then fill in other Python fields from this.

For a fresh build, you just need to set the PYTHON_ROOT_DIR, eg:

The following commands assume that you're already in the build directory and ../blender points to Blender's source code.

cmake ./ ../blender -D PYTHON_ROOT_DIR=/opt/my_python

For existing builds, you will need to undefined (-U) all PYTHON variables first, so the existing cached values aren't used.

cmake ./ ../blender -U PYTHON* -D PYTHON_ROOT_DIR=/opt/my_python

This un-defines all PYTHON_* variables, and re-defines them based on your Python prefix.

In rare cases you may want to manually edit the PYTHON_* fields in the CMakeCache.txt file afterwards.

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 build system 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

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

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
    

OpenVDB

The officially supported version of OpenVDB is 3.1.0.

Dependencies

The required dependencies for OpenVDB are OpenEXR, TBB, and Boost. For better interoperability with other software, it is recommended to compile OpenVDB with Blosc.

Here is a short script/guide to get and compile blosc for Linux:

# get the source
wget https://github.com/Blosc/c-blosc/archive/v1.7.0.tar.gz

tar -xvf v1.7.0.tar.gz
cd c-blosc-1.7.0/

# set up build dir
mkdir build
cd build/

# set up install dir
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install ..

# compile and install
cmake --build . --target install

It can also be desirable to link OpenVDB against a concurrent allocator, like jemalloc.

Compilation

# get the source
wget http://www.openvdb.org/download/openvdb_3_1_0_library.zip
unzip openvdb_3_1_0_library.zip

cd openvdb/

To compile the library, simply use this command line (adapt it to your configuration):

Note you can run this command first with, then without the "install" target, but both times must have all configuration args passed in.

make -j8 install \
    DESTDIR="/opt/lib/openvdb" \
    BOOST_INCL_DIR="/opt/lib/boost/include" \
    BOOST_LIB_DIR="/opt/lib/boost" \
    BOOST_LIB="-lboost_iostreams -lboost_system" \
    BOOST_THREAD_LIB="-lboost_thread" \
    EXR_INCL_DIR="/opt/lib/openexr/include" \
    EXR_LIB_DIR="/opt/lib/openexr/lib" \
    EXR_LIB="-lIlmImf" \
    ILMBASE_INCL_DIR="/opt/lib/openexr/include" \
    ILMBASE_LIB_DIR="/opt/lib/openexr/lib" \
    ILMBASE_LIB="-lIlmThread -lIex -lImath" \
    HALF_LIB="-lHalf" \
    TBB_INCL_DIR="/usr/include" \
    TBB_LIB_DIR="/usr/lib" \
    TBB_LIB="-ltbb" \
    BLOSC_INCL_DIR="/opt/lib/blosc/include" \
    BLOSC_LIB_DIR="/opt/lib/blosc/lib" \
    BLOSC_LIB="-lblosc -lz" \
    CONCURRENT_MALLOC_LIB="-ljemalloc" \
    CONCURRENT_MALLOC_LIB_DIR="/usr/lib/x86_64-linux-gnu" \
    CPPUNIT_INCL_DIR="" \
    CPPUNIT_LIB_DIR="" \
    CPPUNIT_LIB="" \
    LOG4CPLUS_INCL_DIR="" \
    LOG4CPLUS_LIB_DIR="" \
    LOG4CPLUS_LIB="" \
    GLFW_INCL_DIR="" \
    GLFW_LIB_DIR="" \
    GLFW_LIB="" \
    GLFW_MAJOR_VERSION="" \
    PYTHON_VERSION="" \
    PYTHON_INCL_DIR="" \
    PYCONFIG_INCL_DIR="" \
    PYTHON_LIB_DIR="" \
    PYTHON_LIB="" \
    BOOST_PYTHON_LIB_DIR="" \
    BOOST_PYTHON_LIB="" \
    NUMPY_INCL_DIR="" \
    EPYDOC="" \
    PYTHON_WRAP_ALL_GRID_TYPES="no" \
    DOXYGEN=""