Linux static building
Views
Personal tools
From LuxRender Wiki
Luxrender static building guide (! work in progress - jromang)
1) Install a fresh copy of Fedora 9 x64
this distribution is supported by Intel Compiler 11. Why a fresh install ? I will compile each needed dependency statically, and I want to avoid the build system to use already installed shared libraries. I do this in a virtual machine, using Sun XVM Virtualbox.
2)Update your system, but do not install any package
yum update
3)Install gcc compiler and tools
yum install gcc gcc-c++ compat-libstdc++-33.i386 compat-libstdc++-33 cvs cmake bison flex bzip2-devel zlib-static gtk2-devel mesa-libGLU-devel libtool
libjpeg-static libtiff-static
4) Get the Intel Compiler
http://www.intel.com/cd/software/products/asmo-na/eng/219771.htm Unpack/Install the compiler (intall only the 64 bit version)
5) add this line at the end of you .bashrc
source /opt/intel/Compiler/11.0/081/bin/iccvars.sh intel64
Now you have a working icc compiler.
6) Get boost 1.38.0 sources and bjam binary for linux x86
http://www.boost.org/users/download/ and uncompress create a bin directory in your home mkdir $HOME/bin copy bjam executable to $HOME/bin
7) Build and install boost to your home directory
bjam --toolset=intel --without-math --without-python --without-mpi link=static threading=multi release install --prefix=$HOME
Now you have latest static boost libraries built with icc.
- TODO : use LD_LIBRARY_PATH ???
Build libjpeg
ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz unpack
cp /usr/bin/libtool . configure --enable-static --prefix=$HOME make cp .libs/libjpeg.a $HOME/lib cp *.h $HOME/include
Build libtiff
Download from ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.8.2.tar.gz unpack
configure --disable-shared --prefix=$HOME --with-jpeg-include-dir=$HOME/include --with-jpeg-lib-dir=$HOME/lib make make install
8) Download latest wxGTK
http://www.wxwidgets.org/downloads/#latest_stable As this is not performance critical we are simply building this with gcc
configure --prefix=$HOME --disable-shared --with-opengl --enable-monolithic make make install
Now you have latest static wxGTK libraries
9) Download latest OpenEXR stable sources (ilmbase and openexr)
http://www.openexr.com/downloads.html As this is not performance critical we are simply building this with gcc First configure and install ilmbase
./configure --prefix=$HOME --disable-shared make make install
Next configure and install openexr Add the line
#include <string.h>
at the beginning of the files /exrmaketiled/main.cpp and /exrenvmap/main.cpp
export CC="gcc -lrt -fPIC" export CXX="g++ -lrt -fPIC" ./configure --prefix=$HOME --disable-shared make make install
10) Set icc as the default compiler
export CC=icc export CXX=icpc
11) get the latest luxrender sources
hg clone http://www.luxrender.net/hg/lux lux
12) change CMakeLists.txt
Add you home directory to OpenEXR search path in CMakeLists.txt
FIND_PATH(OPENEXR_INCLUDE_DIRS ImfXdr.h PATHS /usr/local/include/OpenEXR /usr/include/OpenEXR /sw/include/OpenEXR /opt/local/include/OpenEXR /opt/csw/include/OpenEXR /opt/include/OpenEXR /home/jeff/include/OpenEXR )
Add in the boost section
SET(Boost_LIBRARIES boost_thread-il-mt boost_program_options-il-mt boost_filesystem-il-mt boost_serialization-il-mt boost_iostreams-il-mt boost_regex-il-mt boost_system-il-mt)
In the Ilm section add IlmThread
SET(OPENEXR_LIBRARIES Half IlmImf Iex Imath IlmThread)
Comment
# Dade - default compiler options #ADD_DEFINITIONS(-O3 -msse2 -mfpmath=sse -ftree-vectorize -funroll-loops -Wall -DLUX_USE_OPENGL -DHAVE_PTHREAD_H)
And add
ADD_DEFINITIONS(-O3 -Wall -DLUX_USE_OPENGL -DHAVE_PTHREAD_H '-D"__sync_fetch_and_add(ptr,addend)=_InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(ptr)), addend)"')
in the tiff section delete all and add
SET(TIFF_FOUND 1)
SET(TIFF_INCLUDE_DIR ${HOME}/include)
SET(TIFF_LIBRARIES libtiff.a)
SET(TIFF_LIBRARY ${HOME}/lib)
in the jpeg section delete all and add
SET(JPEG_FOUND 1)
SET(JPEG_INCLUDE_DIR ${HOME}/include)
SET(JPEG_LIBRARIES libjpeg.a)
SET(JPEG_LIBRARY ${HOME}/lib)
13) Modify core/lux.h
comment line 41
//inline float expf(float a) { return exp(a); }
14)Run cmake
export BOOST_ROOT=$HOME export LD_LIBRARY_PATH=$HOME/lib/:$LD_LIBRARY_PATH cmake lux
Copy the headers ti lux core directory
I know it's ugly
(no more needed) cp $HOME/include/*.h lux/core
15)Build lux
make
16) Enjoy
- -)