Skip to content

Building appleseed on Linux

François Beaune edited this page Sep 8, 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 qt5-dev-tools

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

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):

    cd /directory/with/appleseed/code
    
    export APPLESEED_DEPENDENCIES=/directory/with/precompiled/dependencies
    export CMAKE_INCLUDE_PATH=$APPLESEED_DEPENDENCIES/include
    export CMAKE_LIBRARY_PATH=$APPLESEED_DEPENDENCIES/lib
    export LD_LIBRARY_PATH=$APPLESEED_DEPENDENCIES/lib
    
  4. Build appleseed:

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 printed below. You can check which cpu instruction extensions 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 line: -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0

mkdir build
cd build
cmake \
  -Wno-dev \
  -DWITH_DISNEY_MATERIAL=OFF \
  -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 \
  -DSEEXPREDITOR_INCLUDE_DIR=$APPLESEED_DEPENDENCIES/include \
  -DSEEXPREDITOR_LIBRARY=$APPLESEED_DEPENDENCIES/lib/libSeExprEditor.so \
  -DCMAKE_PREFIX_PATH=/usr/include/x86_64-linux-gnu/qt5 \
  ..
make

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

-DCMAKE_PREFIX_PATH=/usr/include/qt5 \

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

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