Building on Linux - LuxRender Wiki

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.

Contents

Ubuntu / Debian

First of all, you need to install a couple of required packages:

sudo apt-get install mercurial
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install 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 libwxgtk2.8-dev glutg3-dev

then invoke:

hg clone http://www.luxrender.net/hg/lux lux
cmake lux
make

This will allow you to easily track new revisions with mercurial, but the initial download will be quite important. The alternative to the above hg clone command above is to go to the mercurial web portal and download the lux archive of your choice (tar.gz, tar.bz2 or zip) and expand it in a folder named lux.

LuxRender has been successfully compiled on:

* Ubuntu 7.10
* Ubuntu 8.04
* Ubuntu 8.10
* Debian 4 "etch", both intel and PPC.
* Debian 5.0 "lenny"
* OpenSuse 11.1 32bits
* Archlinux 64bits

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://www.luxrender.net/hg/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

The output should be something like:

-- Check for working C compiler: /opt/intel/cc/10.1.015/bin/icc
-- Check for working C compiler: /opt/intel/cc/10.1.015/bin/icc -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: /opt/intel/cc/10.1.015/bin/icpc
-- Check for working CXX compiler: /opt/intel/cc/10.1.015/bin/icpc -- works
-- /usr/lib
-- /usr/include
-- Found ZLIB: /usr/lib/libz.so
-- Found PNG: /usr/lib/libpng.so
-- Found TIFF
-- Found JPEG: /usr/lib/libjpeg.so
-- /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: /home/david/tmp/luxrender

Now you can compile:

make

After a while the luxconsole and luxRender executable will be available in the current directory.

Fedora

Update your apt database first:

sudo yum update

Then install the dependencies:

sudo yum install cmake mercurial
sudo yum install bison flex fltk boost fltk-devel OpenEXR OpenEXR-devel wxGTK wxGTK-devel

than invoke:

hg clone http://www.luxrender.net/hg/lux lux
cmake lux
make

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

LuxRender has been successfully compiled under:

Fedora release 7 (Moonshine)

Fedora release 8 (Werewolf)

Gentoo

For a gentoo ebuild visit: http://www.luxrender.net/forum/viewtopic.php?f=22&t=384&start=0&st=0&sk=t&sd=a