Skip to content

Building appleseed on Linux

François Beaune edited this page Sep 21, 2019 · 159 revisions

Prerequisites

Tools

gcc

Red Hat Developer Toolset 6 gcc is currently the officially supported version to build appleseed. You may however use a more recent version of gcc (6.x, 7.x, 8.x or 9.x) to compile appleseed against the precompiled dependencies. While this will usually work, we do not officially support this scenario.

Required dependencies

appleseed has many dependencies, some of them not usually included in common Linux distributions. The recommended method to build appleseed on Linux is to use precompiled dependencies. This is the method documented here.

There is a repository containing most of appleseed dependencies compiled with gcc 6.3 here: https://github.com/appleseedhq/linux-deps

They are the same dependencies used to build appleseed on Travis, our continuous integration server.

You must also have the zlib and zlib-devel packages installed (they are usually already installed). On Ubuntu, you can install these packages with the following commands:

sudo apt install zlib
sudo apt install zlib-devel

On recent Fedora versions you will need to install libnsl.so.1 via:

dnf install libnsl

libnsl, the legacy support library for NIS services, is required by the Xerces-C++ XML parser. It was formerly part of glibc but is now standalone and therefore no longer installed by default.

Optional dependencies

You will need Qt 5 if you want to build appleseed.studio, the graphical user interface to appleseed.

appleseed will not build using Qt 4.x, you DO need a recent 5.x version of Qt.

Most Linux distributions allow to download the Qt 5 SDK from their package repositories. On Ubuntu, the Qt 5 SDK can be installed with the following command:

sudo apt install qtbase5-dev

For Fedora the respective command is:

sudo dnf install qt5-qtbase-devel

Alternatively, you may download the packages from the official Qt website Qt Online Installer for Linux (64-bit). Once the .run file is downloaded, give it execute permissions, e.g.

chmod +x qt-unified-linux-x64-3.1.1-online.run

and execute it, e.g.

./qt-unified-linux-x64-3.1.1-online.run

SeExpr

SeExpr is a simple expression language developed by Walt Disney Animation Studios. SeExpr is required by appleseed to combine layers in the Disney material (and may be used more pervasively in the future).

SeExpr is included in the precompiled dependency package. However SeExprEditor, a component of SeExpr, was built against a specific version of Qt (Qt 5.12.0 in the 2.1 version of the dependency package) which may be different than the version you are planning to build appleseed against. In that case, you will need to build SeExpr yourself using the instructions below.

Move to the directory of your choice then clone the repo and checkout the proper branch:

git clone https://github.com/appleseedhq/SeExpr
cd SeExpr
git checkout appleseed-qt5

If you are not using the compiler in Red Hat Developer Toolset 6, edit the top-level CMakeLists.txt file and add the following line between lines 50 and 51:

ADD_DEFINITIONS (-D_GLIBCXX_USE_CXX11_ABI=0)

The whole block should look like this:

## Setup platform specific helper defines build variants
IF(WIN32)
  include (GenerateExportHeader)
  ADD_DEFINITIONS (-DSEEXPR_WIN32)
ELSE(WIN32)
  ADD_DEFINITIONS (-Wall  -Wextra)
  ADD_DEFINITIONS (-pthread)

  SET( CMAKE_CXX_FLAGS "-fPIC")
  ADD_DEFINITIONS (-D_GLIBCXX_USE_CXX11_ABI=0)
ENDIF(WIN32)

You can now build and install SeExpr:

mkdir install
mkdir build
cd build 
cmake \
  -Wno-dev \
  -DCMAKE_PREFIX_PATH=/usr/include/x86_64-linux-gnu/qt5 \
  -DCMAKE_INSTALL_PREFIX=../install \
  ..
make install

Depending on the Linux distribution, you may have to change the -DCMAKE_PREFIX_PATH entry above to point to the correct location of the Qt 5 include directory. For Fedora users this would be:

-DCMAKE_PREFIX_PATH=/usr/include/qt5 \

When you will build appleseed, make sure to point CMake to your build of SeExpr by passing it the following arguments (make sure to replace placeholder paths):

-DSEEXPR_INCLUDE_DIR=/path/to/SeExpr/install/include \
-DSEEXPR_LIBRARY=/path/to/SeExpr/install/lib/libSeExpr.so \
-DSEEXPREDITOR_INCLUDE_DIR=/path/to/SeExpr/install/include \
-DSEEXPREDITOR_LIBRARY=/path/to/SeExpr/install/lib/libSeExprEditor.so

Building appleseed

  1. Download the prebuilt dependencies package and unpack it:
    https://github.com/appleseedhq/linux-deps/releases/download/v2.1/appleseed-deps-shared-2.1.tgz

  2. Clone the appleseed repository:

    git clone https://github.com/appleseedhq/appleseed.git
    cd appleseed
    
  3. Prepare the environment (make sure to replace placeholder paths):

    export APPLESEED_DEPENDENCIES=/path/to/prebuilt-linux-deps
    export CMAKE_INCLUDE_PATH=$APPLESEED_DEPENDENCIES/include
    export CMAKE_LIBRARY_PATH=$APPLESEED_DEPENDENCIES/lib
    export LD_LIBRARY_PATH=$APPLESEED_DEPENDENCIES/lib
    
  4. Build appleseed:

    mkdir build
    cd build
    cmake \
      -Wno-dev \
      -DCMAKE_PREFIX_PATH=/usr/include/x86_64-linux-gnu/qt5 \
      -DWITH_DISNEY_MATERIAL=ON \
      -DWITH_EMBREE=ON \
      -DUSE_STATIC_BOOST=OFF \
      -DBOOST_INCLUDEDIR=$APPLESEED_DEPENDENCIES/include/boost_1_61_0 \
      -DBOOST_LIBRARYDIR=$APPLESEED_DEPENDENCIES/lib/ \
      -DBoost_NO_SYSTEM_PATHS=ON \
      -DBoost_ATOMIC_LIBRARY_RELEASE=$APPLESEED_DEPENDENCIES/lib/libboost_atomic-gcc63-mt-1_61.so.1.61.0 \
      -DBoost_CHRONO_LIBRARY_RELEASE=$APPLESEED_DEPENDENCIES/lib/libboost_chrono-gcc63-mt-1_61.so.1.61.0 \
      -DBoost_DATE_TIME_LIBRARY_RELEASE=$APPLESEED_DEPENDENCIES/lib/libboost_date_time-gcc63-mt-1_61.so.1.61.0 \
      -DBoost_FILESYSTEM_LIBRARY_RELEASE=$APPLESEED_DEPENDENCIES/lib/libboost_filesystem-gcc63-mt-1_61.so.1.61.0 \
      -DBoost_PYTHON_LIBRARY=$APPLESEED_DEPENDENCIES/lib/libboost_python-gcc63-mt-1_61.so.1.61.0 \
      -DBoost_PYTHON_LIBRARY_RELEASE=$APPLESEED_DEPENDENCIES/lib/libboost_python-gcc63-mt-1_61.so.1.61.0 \
      -DBoost_REGEX_LIBRARY_RELEASE=$APPLESEED_DEPENDENCIES/lib/libboost_regex-gcc63-mt-1_61.so.1.61.0 \
      -DBoost_SYSTEM_LIBRARY_RELEASE=$APPLESEED_DEPENDENCIES/lib/libboost_system-gcc63-mt-1_61.so.1.61.0 \
      -DBoost_THREAD_LIBRARY_RELEASE=$APPLESEED_DEPENDENCIES/lib/libboost_thread-gcc63-mt-1_61.so.1.61.0 \
      -DBoost_WAVE_LIBRARY_RELEASE=$APPLESEED_DEPENDENCIES/lib/libboost_wave-gcc63-mt-1_61.so.1.61.0 \
      -DEMBREE_INCLUDE_DIR=$APPLESEED_DEPENDENCIES/include \
      -DEMBREE_LIBRARY=$APPLESEED_DEPENDENCIES/lib/libembree3.so \
      -DLZ4_INCLUDE_DIR=$APPLESEED_DEPENDENCIES/include \
      -DLZ4_LIBRARY=$APPLESEED_DEPENDENCIES/lib/liblz4.so \
      -DOPENIMAGEIO_OIIOTOOL=$APPLESEED_DEPENDENCIES/bin/oiiotool \
      -DOPENIMAGEIO_IDIFF=$APPLESEED_DEPENDENCIES/bin/idiff \
      -DOSL_COMPILER=$APPLESEED_DEPENDENCIES/bin/oslc \
      -DOSL_MAKETX=$APPLESEED_DEPENDENCIES/bin/maketx \
      -DOSL_QUERY_INFO=$APPLESEED_DEPENDENCIES/bin/oslinfo \
      -DSEEXPR_INCLUDE_DIR=$APPLESEED_DEPENDENCIES/include \
      -DSEEXPR_LIBRARY=$APPLESEED_DEPENDENCIES/lib/libSeExpr.so \
      -DSEEXPREDITOR_INCLUDE_DIR=$APPLESEED_DEPENDENCIES/include \
      -DSEEXPREDITOR_LIBRARY=$APPLESEED_DEPENDENCIES/lib/libSeExprEditor.so \
      ..
    make
    

    This will install appleseed binaries under the sandbox/bin/Ship/ directory.

    If you have an older CPU which does not support SSE4.2 instructions, replace -DUSE_SSE42=ON \ with -DUSE_SSE=ON \ in the CMake command above. You can check which instruction sets your CPU supports with cat /proc/cpuinfo. It will be shown under flags:.

    If you are not using the compiler in Red Hat Developer Toolset 6, add the following line to the CMake command:

    -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
    

    Depending on the Linux distribution, you may have to change the -DCMAKE_PREFIX_PATH entry above to point to the correct location of the Qt 5 include directory. For Fedora users this would be:

    -DCMAKE_PREFIX_PATH=/usr/include/qt5 \
    

A note regarding compiler warnings

The default build configuration (or build type in CMake's terminology) is Ship (check Build Configurations for details). In Ship and Profile configurations, warnings emitted by the compiler don't cause builds to fail.

However, if you decide to build appleseed in Debug or Release configurations, any compiler warning will be treated as an error and will cause builds to fail.

We always make sure that the master branch of appleseed builds cleanly (without any warning) on all platforms and with all supported compiler and compiler versions. However your compiler may emit new warnings which will cause builds to fail.

Ideally, we would appreciate that you investigate the cause of these warnings and submit a pull request that fix them. Alternatively, you can add -DWARNINGS_AS_ERRORS=OFF to CMake's command line, then run make again. Warnings will still be emitted by the compiler but they won't cause builds to fail anymore.

Building appleseed with static libraries

In some very rare cases you may need to use static libraries instead of the shared ones. If you are unsure about which libraries to take, use the shared ones.

Running appleseed

appleseed binaries, appleseed.studio in particular, need an "environment" with a specific directory structure and a number of support files in order to run properly. We call this environment the sandbox. The appleseed repository comes with a fully configured sandbox in the sandbox/ directory.

When appleseed is built, binaries get automatically deployed to sandbox/bin/<config> where <config> is the build configuration you selected with CMake's CMAKE_BUILD_TYPE option.

In addition to the sandbox, developer builds of appleseed.studio need to find the standard library of a Python 2.7 installation for the embedded Python 2.7 to function properly. They rely on the PYTHONHOME environment to find it. To set this variable, type

export PYTHONHOME=/usr

You should now be able to run appleseed.studio: navigate to sandbox/bin/<config> (e.g. sandbox/bin/Ship) and type

./appleseed.studio

Note that official builds of appleseed ship with a Python 2.7 standard library so they don't need one to exist on the user's system.

Clone this wiki locally