Building on Linux - LuxRender Wiki
Luxrender GPL Physically Based Renderer

Building on Linux

Personal tools

From LuxRender Wiki

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: You might wish to read the tips before starting.

If you run into trouble: take a look at the FAQ and Tips. Your problem might be listed there.

Contents

Compiling

Step 1: Obtaining the source code

First install mercurial if not installed. Then download the following repositories in the same folder:

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 http://src.luxrender.net (but without /luxrender in the URL) instead.

Updating to the latest development version

If you already have a hg clone and you wish to update your repositories follow the instruction below:

First go to the folder containing the lux and luxrays repository.

cd lux
hg pull
hg update
cd ../luxrays
hg pull
hg update

Step 2: Install the required dependencies

To compile Luxrender you need the following dependencies:

  • LuxRays (version in sync with LuxRender to be safe)
  • OpenCL v?
  • Bison v?
  • Flex v?
  • Boost 1.47 (compiled with python 3.2 to match Blender 2.5 requirements, please use exact this version for assure networking across builds)
  • OpenEXR
  • PNGlib v?
  • FreeImage v?
  • pthreads v?
  • Doxygen v?
  • Python v3.1 +
  • QT4 (not needed for luxconsole)

Obtain these using your distribution package manger or using the internet.

Step 3: Compiling LuxRender

NOTE: If you are using the ATI Stream SDK to supply your OpenCL functionality, you will first need to edit the CMakeLists.txt file from the luxrays AND lux source folders to specify where it is located on your system. First, find the 2 instances of:

"/home/david/src/ati-stream-sdk-v2.2-lnx64"

and change them to the path where the SDK is located on your machine. If you are unsure of this, it should be the same folder as your ATISTREAMSDKROOT environment variable. You can type the following and see what it is set to:

printenv | grep ATISTREAMSDKROOT

Change both occurrences to reflect your path, being sure to leave /include and /lib/x86_64 on each line, respectively.

Now go to the directory where you downloaded the repository lux and luxrays. Then compile luxrays:

cd luxrays
cmake ./

If you have your boost libraries in a different folder use instead:

BOOST_ROOT=<boost dir> cmake ./

Then compile luxrender

make luxrays

Then compile lux:

cd ..
cd luxrender
cmake ./

If you have your boost libraries in a different folder use instead:

BOOST_ROOT=<boost dir> cmake ./

For the console version run:

make luxconsole

For the GUI version run:

make luxrender

Tips

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.

Compiling boost

To compile boost:

./bootstrap.sh
./bjam python=3.1 stage

<boost dir>

This refers to the same location where you ran ./booststrap.sh

FAQ

Compile without OpenCL support

(Usefull for render farms without GPU's.) Edit MakeLists.txt and add the line

SET(LUXRAYS_DISABLE_OPENCL 1)

(Both in Lux and Luxrays)

Then delete CMakeCache.txt in both Lux and LuxRays. Rebuild both.

<Doesn't work !!! need help with this one >

error: ISO C++ forbids declaration of ‘BufferGL’ with no type

Make sure your OpenCL version is up to date.

Do I need boost version X ?

"it's a bugger to find a boost version which doesnt screw up at least one important bit"

On a more serious note, if you don't plan on using network rendering or pylux then you can most likely use a different boost version. To do this edit the CMakeLists.txt and replace the 1.47 bit in the lines that begin with "FIND_PACKAGE(Boost 1.47" to the boost version on your system.

Required package names per distribution

Note: packages provided by your distribution might not be recent enough. If required you will need to use unstable (see your distribution) or manually install a more recent version.

Debian (untested for v0.8)

mercurial build-essential cmake bison flex libboost-dev libboost-thread-dev libboost-date-time-dev libboost-program-options-dev libboost-filesystem-dev libopenexr-dev libboost-iostreams-dev libboost-regex-dev libboost-serialization-dev libboost-wave-dev libtiff4-dev libpng12-dev glutg3-dev

Fedora

su -c 'yum install cmake mercurial bison flex boost OpenEXR OpenEXR-devel' List might be not complete.

Annotation for Fedora 15 (32) Assuming you have installed and running nvidia drivers from rpm-fusion and using NVidia's CUDA TK. It's important to point to the TK in /usr/local/cuda.

You might symlink /usr/lib/nvidia/libOpenCL.so.1 to /usr/lib/libOpenCL

  • Please make sure your LD_LIBRARY_PATH
  • for 32-bit Linux distributions includes /usr/local/cuda/lib
  • for 64-bit Linux distributions includes /usr/local/cuda/lib64:/usr/local/cuda/lib
  • OR
  • for 32-bit Linux distributions add /usr/local/cuda/lib
  • for 64-bit Linux distributions add /usr/local/cuda/lib64 and /usr/local/cuda/lib
  • to /etc/ld.so.conf and run ldconfig as root

Addionally you need the C++ binding header.

wget http://www.khronos.org/registry/cl/api/1.1/cl.hpp

and su -c 'mv cl.hpp /usr/local/cuda/include/CL'

libpng error: Incompatible libpng version in application and library

This means different libpng versions are used in different dependencies and/or luxrender.

To resolve this issue ensure all your libraries are using the same libpng version. Then run make clean && make again.

Most common libs that can cause this are: (Atleast I think)

  • freeimage
  • gd
  • qt4

Tips

If you can't fix it: don't forget you might have installed a lib manually, this will not be fixed by your package manager.

Also note: freeimage comes with the code of libpng packed. So also make sure freeimage is using the libpng version installed on your system !

Another trick to resolve is: remove libpng12.so (preferably by using your package manger) and see what brakes.

Stubs

The following sections are possibly outdated and for a different version:

Building pylux against Python 3.2

0. Install the python3-dev package

sudo apt-get install python3-dev

1. open ../boost_1_47_0/project-config.jam for editing

Insert this line

using python : 3.2 : /usr ;

after this one:

using python : 2.6 : /usr ;

2. re-build boost using the following command:

./bjam --layout=system python=3.1 stage

3. Edit Lux's CMakeLists.txt file to force usage of Python 3. Insert

	SET(CMAKE_USE_PYTHON_VERSION 3.2)

before

	FIND_PACKAGE(PythonLibs)

4. Rebuild Lux as before:

BOOST_ROOT=../boost_1_47_0 cmake ../lux
make pylux

Compile with Intel Compiler (single pass method)

First of all install the Intel C++ Compiler. It is available for free for non-commercial use at Intel web site. Follow the installation instructions and verify it works:

source /opt/intel/cc/10.1.015/bin/iccvars.sh
icpc --version

The output should be something like:

icpc (ICC) 10.1 20080312
Copyright (C) 1985-2008 Intel Corporation.  All rights reserved.

Some platforms could require libstdc++5 in order to run the icc compiler:

sudo apt-get install libstdc++5

Checkout the latest sources form the LuxRender CVS:

mkdir luxrender
cd luxrender
hg clone http://src.luxrender.net/lux lux

See above for an alternate way of obtaining the source code.

Now edit the lux/CMakeLists.txt and change the lines:

# Dade - default compiler options
ADD_DEFINITIONS(-O2 -DLUX_USE_OPENGL -DHAVE_PTHREAD_H)

to:

# Dade - default compiler options (single pass, 32bit)
ADD_DEFINITIONS(-O3 -ip -mtune=core2 -xT -unroll -fp-model fast=2 -rcd -no-prec-div -DLUX_USE_OPENGL -DHAVE_PTHREAD_H '-D"__sync_fetch_and_add(ptr,addend)=_InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(ptr)), addend)"')

NOTE: 64bit requires some additional define (i.e. -DBOOST_NO_INTRINSIC_INT64_T "-D'__builtin_vsnprintf(__out, __size, __fmt, __args)'='__builtin_vsnprintf(__out, __size, __fmt, (char *) __args)'"):

# Dade - default compiler options (single pass, 64bit)
ADD_DEFINITIONS(-O3 -ip -mtune=core2 -xT -unroll -fp-model fast=2 -rcd -no-prec-div -DLUX_USE_OPENGL -DHAVE_PTHREAD_H '-D"__sync_fetch_and_add(ptr,addend)=_InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(ptr)), addend)"' -DBOOST_NO_INTRINSIC_INT64_T "-D'__builtin_vsnprintf(__out, __size, __fmt, __args)'='__builtin_vsnprintf(__out, __size, __fmt, (char *) __args)'") 


Now execute the following commands (edit paths if you installed the Intel compiler in another place, if you did a 32/64bit installation on a 64bit machine the correct path could be "/opt/intel/cce/10.1.015/bin" instead "/opt/intel/cc/10.1.015/bin"):

source /opt/intel/cc/10.1.015/bin/iccvars.sh
rm -rf CMakeCache.txt CMakeFiles
CC=/opt/intel/cc/10.1.015/bin/icc CXX=/opt/intel/cc/10.1.015/bin/icpc cmake lux