Building luxrender on linux

I wrote this little article mostly because I had to reinstall Luxrender (mostly to try Luke's work), and this will serve me as a memo for another time. The info below comes mostly from the official instructions.

First, you must install the dependencies listed on the official page above. Here luckily I already had all of them. Then, the luxrender system comes in 2 parts, luxrender and luxrays. So it's best to create first a containing folder, then clone the 2 repositories:

mkdir Luxrender-sourcecd Luxrender-sourcehg clone clone clone

Then, prepare for out-of-source build for luxrays:

cd ..mkdir Luxrendercd Luxrendermkdir luxrayscd luxrayscmake ../../Luxrender-source/luxrays

Then, because of some bug between openCL 1.2 (which is the version I have here on debian wheezy) and 1.1 (which is used by lux), you must use the -DCL_USE_DEPRECATED_OPENCL_1_1_APIS option when compiling. The easiest way is to use cmake-gui:

cmake-gui .

Then add "-DCL_USE_DEPRECATED_OPENCL_1_1_APIS" to CXX_FLAGS and C_FLAGS. Press "Configure" then "Generate".

For me the luxrays library then compiles fine, but the benchmarks failed. But there is an option to compile the luxrays lib only:

make luxrays

If all went okay, let's do lux:

cd ..mkdir luxcd luxcmake ../../Luxrender-source/lux

It will complain that luxrays was not found. Then, start cmake-gui:

cmake-gui .

And change the value of LUXRAYS_LIBRARY to the path of your luxrays/lib/libluxrays.a file. Also add the same compiler option as in luxrays above. Press "Configure" then "Generate". Then, build:

make luxconsolemake luxrendermake pylux

Now, go back to the luxblend folder and link pylux there:

cd ../../Luxrender-source/luxblend25ln -s ../../Luxrender/lux/

Then link the luxblend folder and the presets into your blender scripts folder:

cd ~/.blender/2.6X/scripts/addonsln -s /path/to/Luxrender-source/luxblend25/src/luxrendercd ../presetsln -s /path/to/Luxrender-source/luxblend25/src/presets/luxrender

Then, all you need to do is open blender, activate the plugin, and set the path to /path/to/Luxrender/lux/ in the render options.