Building with Blender's install deps.sh Script - LuxRender Wiki
Luxrender GPL Physically Based Renderer

Building with Blender's install deps.sh Script

Personal tools

From LuxRender Wiki

Revision as of 22:10, 17 December 2012 by Gdh (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

You can find help about how to compile the Luxrender source in the dedicated forum. Please, do not underestimate the value of a well compiled/optimized binary for your platform: a statically linked, well optimized binary compiled with Intel CC can be up to 40% faster than a generic version compiled with GCC.

NOTE: Everyone likes to put their source trees in different places. On this page, the path to the root of the source tree will be labeled as "$SRC".

NOTE: This has only been tested on Ubuntu 12.04.

If you run into trouble: take a look at the FAQ and Tips. Your problem might be listed there. If it is not, contact gdh on IRC.

Contents

Compiling

Step 1: Get the VCS Dependencies

Open a terminal and run the following commands:

sudo apt-get update
sudo apt-get install subversion mercurial cmake cmake-curses-gui


Step 2: Obtaining and Building Blender

Obtaining Blender

First, open a terminal and cd to $SRC. Then run the following commands:

mkdir blender-svn
cd blender-svn
svn co https://svn.blender.org/svnroot/bf-blender/trunk/blender

NOTE: If you have never used SVN before you may get the error

Certificate verification error: signed using insecure algorithm (https://svn.blender.org)

To get around this problem, you need to add the following line to the bottom of your ~/.subversion/servers file:

ssl-trust-default-ca = no


Compiling Blender

Run the following command (replacing "$SRC"):

cd $SRC/blender-svn/blender/build_files/build_environment
gedit ./install_deps.sh

(You can use whatever text editor you like.) Find the "compile_Boost()" function (currently at line 486). Find the two lines in that function that say:

./b2 -j$THREADS -a --with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time \
--prefix=$_inst --disable-icu boost.locale.icu=off install

Comment them out (if you want them for safekeeping) and write instead:

./b2 -j$THREADS -a --prefix=$_inst --disable-icu boost.locale.icu=off install

Save the file and return to the terminal. Run:

./install_deps.sh --help

and make sure you get what you want. You MUST install Boost. The recommended command is:

./install_deps.sh --force-all [--with-osl] --threads=<nbr>

where "<nbr>" is the number of threads you want to use for compiling. The "--with-osl" option is for building Blender with Open Shading Language. It is entirely optional.

The script will ask you for your sudo password several times. Once it finishes, run:

cd $SRC/blender-svn
mkdir build
cd build

Now, run:

ccmake ../blender

and change the CMake variables as you need. When you are done, exit and run:

cmake ../blender

Then run:

make [-j<number of threads>]

If all goes well, you should have a full build of Blender in your $SRC/blender-svn/build directory.


Step 3: Install the required dependencies

Blender's install_deps.sh does not install every dependency. To compile Luxrender you need the following extra dependencies:

  • OpenCL
  • FreeImage
  • Doxygen
  • QT4 (not needed for luxconsole)


OpenCL

Open the terminal and run:

cd ~/Downloads

For 32-bit Linux, run:

wget http://download2-developer.amd.com/amd/Stream20GA/ati-stream-sdk-v2.3-lnx32.tgz
tar -zxvf ati-stream-sdk-v2.3-lnx32.tgz
mv ati-stream-sdk-v2.3-lnx32 $SRC/ati-stream/

For 64-bit Linux, run:

wget http://download2-developer.amd.com/amd/Stream20GA/ati-stream-sdk-v2.3-lnx64.tgz
tar -zxvf ati-stream-sdk-v2.3-lnx64.tgz
mv ati-stream-sdk-v2.3-lnx64 $SRC/ati-stream/


FreeImage, Doxygen, and QT4

For the rest of the dependencies, run:

sudo apt-get install doxygen libfreeimage3 libfreeimage-dev libqt4-dev


Step 4: Obtaining Lux's Source Code

Run the following commands:

cd $SRC
mkdir lux-hg
cd lux-hg

To clone the repository, run:

hg clone http://bitbucket.org/luxrender/lux
hg clone http://bitbucket.org/luxrender/luxrays

Note: the bitbucket.org repository is a mirror. It runs a few hours behind. If you needed the very latest version use:

hg clone http://src.luxrender.net/lux
hg clone http://src.luxrender.net/luxrays

Step 5: Compiling LuxRays

Run the following commands:

cd $SRC/lux-hg/luxrays
ccmake .

Find the OPENCL_INCLUDE_DIR variable (press 't' to go into advanced mode), and change it to:

$SRC/ati-stream/include

Configure and generate, or exit and run:

cmake .

Now we can compile:

make [-j<number of threads>] [-s]

The "-s" option is there to stop make from repeating the commands, which it does while compiling Lux. If you want it to repeat commands, remove it.


Step 6: Compiling LuxRender

Run the following commands:

cd $SRC/lux-hg/lux
ccmake .

Again, find the OPENCL_INCLUDE_DIR (press 't' to go into advanced mode), and change it to:

$SRC/ati-stream/include

Change the Boost_INCLUDE_DIR variable to:

/opt/lib/boost/include

Change the Boost_LIBRARY_DIRS to:

/opt/lib/boost/lib

Configure and generate, or exit and run:

cmake .

For the console version run:

make [-j<number of threads>] [-s] luxconsole

For the GUI version run:

make [-j<number of threads>] [-s] luxrender

For everything, run:

make [-j<number of threads>] [-s]

The "-s" option is there to stop make from repeating the commands, which it does while compiling Lux. If you want it to repeat commands, remove it.


Tips

Automatic Update and Build Script

This is the script I use to automatically update and build Blender, LuxRays, and LuxRender.

Change SRC to your source directory that you used above.

Change THREADS to the number of threads you want to use for compiling.

#!/bin/sh
set -x
set -V
SRC=/home/gavin/CodeResources
THREADS=8
cd $SRC/blender-svn/blender
svn up
cd ../build
cmake ../blender
make -j$THREADS
make install


cd ../../lux-hg/lux
hg pull
hg update
cd ../luxrays
hg pull
hg update
cmake ./
make -j$THREADS -s
cd ../lux
cmake ./
make -j$THREADS -s


set +x
set +v


Custom compilation options (Using make)

If you wish to use custom C/CXXFLAGS you must specify these during the make phase.

Example:

CFLAGS="-mystuff" CXX="-mystuff" make

Before submitting bugs, please first test with the default compile flags!

Example:

make clean
make


Custom compilation options (Using cmake)

(stub)


Compiling faster

When running make use:

make -j<number of processors or more>

This will initiate parallel building and speedup the compilation considerably.


FAQ

(stub)