Building on Ubuntu 10.10
From LuxRender Wiki
ATTENTION: THIS TUTORIAL WAS WRITTEN IN LATE 2010 AND SOME THINGS HAVE CHANGED IN THE MEANTIME; CONSEQUENTLY THE DESCRIBED PROCESS GIVES AN IDEA OF HOW TO COMPILE LUXRENDER BUT SOME DETAILS ARE NOT UP TO DATE.
This wiki will demonstrate how to build a working copy of Luxrender 0.8 dev on Ubuntu 10.10 Maverick Meerkat 64-bit. The method to compile on Ubuntu 32-bit is very similar, but some of the package names are different.
I will also show how to get Blender 2.55 up and working with both SLG and Luxrender, though the programs compiled here can be used standalone or with any other exporter.
We're going to need to install some various tools and libraries. The following should be everything you need to build Luxrender and run Blender. Open a terminal window and copy/paste the following:
sudo apt-get install build-essential mercurial cmake python2.6-dev python3.1-dev gettext libopenal1 libopenexr-dev libavdevice52 freeglut3-dev libglew1.5-dev libxmu-dev libxi-dev libfreeimage-dev doxygen libqt4-dev bison flex libbz2-dev libpng12-dev
You will be prompted to additionally install a lot of related extra packages that the above are dependent on. Go ahead and press Y to continue. Depending on how many you don't already have and the speed of your internet connection, this may take a little while.
Getting the Source Code
Next let's create a folder to keep all the source code and our compiled work in.
cd ~ mkdir lux-src cd lux-src
Now we'll use the Mercurial source code management system to clone a current copy of the source code.
hg clone http://src.luxrender.net/lux hg clone http://src.luxrender.net/luxrays hg clone http://src.luxrender.net/luxblend25
Due to some limitations of the current web hosting system, you may get an error message while downloading the source code. If that happens, simply try the command again. It will usually complete succesfully after a couple of tries. If you still can't get through, there is a mirror of the host that is much more reliable, though a few hours behind in the latest updates. To use the mirror instead, copy/paste the following instead of the above.
hg clone http://bitbucket.org/luxrender/lux hg clone http://bitbucket.org/luxrender/luxrays hg clone http://bitbucket.org/luxrender/luxblend25
The Luxrays library uses the relatively new OpenCL language, which allows the GPU to be utilized. If you are using an NVIDIA card, all the required OpenCL libraries are already included in the NVidia driver installer, but you may need to install CUDA.
If you are using an ATI card, in addition to the Catalyst display driver, you will need to separately install the ATI Stream SDK to get the needed OpenCL libraries. You can either download and install it yourself, or use Nou's pre-packaged version.
ATI Stream SDK DEBs
User Nou was kind enough to create some .deb installer files for the SDK avaialble here: http://forums.amd.com/forum/messageview.cfm?catid=390&threadid=125792
Either download and install his debs, or proceed with the next steps to install the SDK yourself.
Download and Install the ATI Stream SDK Yourself
The ATI Stream SDK can be found here: http://developer.amd.com/gpu/atistreamsdk/pages/default.aspx
Scroll to the bottom of the page and download both icd-registration.tgz and ati-stream-sdk-v2.2-lnx64.tgz
In a terminal window, perform the following:
cd ~ tar xfvz Downloads/ati-stream-sdk-v2.2-lnx64.tgz cd / sudo tar -xfv ~/Downloads/icd-registration.tgz
Next, there are a few environment variables we need to set in a way that they will persist. This can be done by editing the /etc/environment file.
sudo gedit /etc/environment
Add the following to the end of the file, putting your actual username in place of <username>:
Save and close the file. There is one more variable to edit, LD_LIBRARY_PATH, but due to some security changes in Ubuntu, it's not as easy to set as it used to be. Just type the following to take care of it (again be sure to put in your actual username in place of <username>):
echo "/home/<username>/ati-stream-sdk-v2.2-lnx64/lib/x86_64" | sudo tee /etc/ld.so.conf.d/atistreamsdk.conf sudo ldconfig
Finally, you'll need to reboot (or just log out and back in) to make these environment variable takes effect.
NVidia - Installing CUDA
If you do not have the directory /usr/include/CL you will need to install CUDA and make some modifications.
Go to NVidia's website and download the latest version of their CUDA toolkit (the Ubuntu 10.04 worked for me on 10.10). You'll then need to run the .run script:
sudo sh cudatoolkit_3.2.16_linux_64_ubuntu10.04.run
Then, download cl.hpp and put it in /usr/local/cuda/include/CL
sudo mv cl.hpp /usr/local/cuda/include/CL
Getting Boost 1.47.0
As of this writing, Ubuntu 10.10 only has boost 1.42.0 in it's repositories, so you'll need to manually build and install version 1.47.0 instead. Note that later versions (currently up to 1.45.0) are available and should also work, but 1.47.0 is the "officially" tested/used version for LuxRender so I recommend using it to avoid any unforeseen issues.
Download Boost source here: http://www.boost.org/users/news/version_1_47_0
Extract to its own folder and prepare it for compiling:
cd ~ tar -xfvz Downloads/boost_1_47_0.tar.gz cd boost_1_47_0 ./bootstrap.sh
By default, this version of Boost uses Python 2.6. However, to make use of all of LuxRender's special features (namely Pylux) we'll need to build it with Python 3.1 instead. Don't worry, you already installed Python 3.1 at the beginning of this wiki. Now we just need to change the Boost config to compile using it instead.
Change the line
using python : 2.6 : /usr ;
using python : 3.1 : /usr ;
Save and close the file. Now time to build the boost libraries (this may take a little while):
./bjam --layout=system python=3.1 stage
We're just about ready to start compiling the fun stuff. First, go to your luxrays source folder because we'll need to edit something first:
cd ~/lux-src/luxrays gedit CMakeLists.txt
OpenCL for ATI
Ctrl-F to find the two instances of "david" (the genius behind Luxrays) and change the portion of the line that reads:
Don't forget to put your actual username instead of <username>. There are 2 lines total that need this change. Once done, save and exit the file. Let's get the build files prepped:
OpenCL for Nvidia
Find the section on OpenCL (around line 80) and change:
find_path(OCL_INCLUDE_PATH NAMES CL/cl.hpp OpenCL/cl.hpp PATHS /home/david/src/ati-stream-sdk-v2.2-lnx64/include /usr/local/cuda/include) find_library(OCL_LIBRARY OpenCL /home/david/src/ati-stream-sdk-v2.2-lnx64/lib/x86_64)
find_path(OCL_INCLUDE_PATH NAMES CL/cl.hpp OpenCL/cl.hpp PATHS /usr/local/cuda/include) find_library(OCL_LIBRARY OpenCL /usr/lib)
Make (both ATI & NVidia)
BOOST_ROOT=~/boost_1_47_0 cmake . -Wno-dev
You shouldn't get any errors if you followed everything OK up to here. If all is well, you are ready to compile.
Or if you have multiple CPU's, you can use the -j parameter to speed things up. For a quad core, you might use:
make -j 4
If all goes well, it should count up to 100% without any errors. You can test it by typing:
You should see the familiar Luxball begin to render (at awesome GPU-enhanced speeds). The last section of this wiki will cover how to set up the exporter with Blender. In the meantime, let's continue with building the full LuxRender.
First we'll want to modify the build instructions to make use of Python 3.1 instead of 2.6. This will allow us to create a usable Pylux.so and all its goodness (such as material previews in Blender!)
If you are using a NVidia card, you will need to change the OpenCL paths like before in the CMakeList.txt for LuxRay
Save the file and quit gedit.
We're just about ready to begin, but we don't want to make a mess and compile our build in the same folder as our source, so let's make a new place to build it.
mkdir ~/lux-src/build_lux cd ~/lux-src/build_lux BOOST_ROOT=~/boost_1_47_0 cmake ../lux
(note, if Boost can still not be found, just build from the lux directory
CMake should find everything it needs and not show any errors. If so, we're ready to compile (this will take a little while).
Or if you have multiple cores, you can use -j to speed up the process.
make -j 4
It should progress all the way through 100%. Test to make sure luxrender starts okay with:
If it starts ok, go ahead and close it and we'll move on to setting up Blender.
Get Blender 2.55
You can get the most recent Blender builds from: http://www.graphicall.org
For example, I just tested this one successfully: http://www.graphicall.org/builds/builds/showbuild.php?action=show&id=1343
Extract Blender it to its own folder and then go to the addons folder:
cd ~ tar xfvz Downloads/1344_64bit-blender25.tar.gz cd blender25/2.55/scripts/addons
Some of the builds from Graphicall already include a version of Luxblend25, but we want to use our own so let's delete the included one:
rm -rf luxrender
Next, we'll create a symbolic link to our clone of LuxBlend25. That way we won't have to reinstall it again after future updates - it will already be there!
ln -s ~/lux-src/luxblend25/src/luxrender
One other file we'll want to link is PyLux.so, which enables all sorts of nifty features (like material previews!).
cd ~/lux-src/luxblend25/src/luxrender ln -s ~/lux-src/lux/pylux.so
Finally, let's link up SLG's export script while we're at it.
cd ~/blender25/2.55/scripts/io ln -s ~/lux-src/luxrays/samples/smallluxgpu/blender/render_smallluxgpu.py
How to Update
Luxrender (and Luxrays and LuxBlend25) are developed at a pretty rapid pace. The following is how to update your clones of the source code periodically and recompile them.
How to Update LuxBlend25
Since there is nothing to compile, this is very quick and easy to update.
cd ~/lux-src/luxblend25 hg pull hg update
Because we used symbolic links to connect everything to Blender, we won't have to make any changes there - Blender will automatically see the new LuxBlend25.
How to Update Luxrays
cd ~/lux-src/luxrays hg pull hg update cmake . make -j 4
How to Update Lux
cd ~/lux-src/lux hg pull hg update cd ../build_lux cmake ../lux make -j 4