Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Linux Installation Instructions

Getting the Code

Download

Select the appropriate stable release from here or check out directly from the repository by following the instructions below.

Repository

For the development branch use:

git clone https://github.com/sgould/drwn.git $DARWIN

or

svn co https://github.com/sgould/drwn $DARWIN

For a stable release (e.g., <x>.<y>) use:

svn co https://svn.anu.edu.au/AI/drwn/release/<x>.<y> $DARWIN

Here $DARWIN refers to the name of the base Darwin directory.

Projects

After downloading or checking out the main Darwin codebase third-party projects can be installed in $DARWIN/projects along with the released Darwin projects. They will then be automatically built when you build the Darwin projects.

Note
If you develop or install third-party projects in a different directory you can still get Darwin to automatically build them by adding the relative directory path to the DRWN_PROJECTS variable in your make.local file.

Building the Code

The following instructions assume that you have downloaded or checked out the code and have changed to the base Darwin directory (i.e., $DARWIN). Before building Darwin you will need to install a number of external libraries that are required by the main Darwin libraries or optionally used by the specific projects you'd like to compile. If you have any of these libraries pre-installed on your system you can just create symbolic links to them, e.g.:

ln -s /usr/local/opencv-2.4 external/opencv

You may also need to install some system build tools (see Installing Build Tools and External Libraries below).

The required libraries can be installed using a C-shell script included in the $DARWIN/external directory. (You will need to have the csh shell installed). The commands to install them are:

cd external
./install.sh Eigen
cd ..

If something goes wrong with the install script you can try following the detailed install instructions.

The optional libraries can be installed with:

cd external
./install.sh zlib
./install.sh OpenCV
./install.sh wxWidgets
./install.sh lua
cd ..

Make sure you update your LD_LIBRARY_PATH variable to avoid runtime errors:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DARWIN}/external/opencv/lib

After the external libraries are installed, you can build the Darwin libraries, applications and projects. See make.local below for how to control the build process.

make
make drwnprojs

You can also build specific projects using

cd project/<PROJECTNAME>
make
cd ../..

make.local

You can control how the Darwin libraries get built by setting various flags in a file called make.local in the base directory. A typical make.local file might look like:

# local make definitions
DRWN_DEBUG_SYMBOLS = 0
DRWN_SHARED_LIBS = 1
DRWN_FORCE_32BIT = 0
# debug statistics
EXTRA_CFLAGS += -DDRWN_DEBUG_STATISTICS
EXTRA_CFLAGS += -DDRWN_FACTOR_DEBUG_STATISTICS
# third-party project directories
DRWN_PROJECTS = path_to_my_projects
# profiling
#EXTRA_CFLAGS += -pg
#EXTRA_LFLAGS += -pg
#DRWN_SHARED_LIBS = 0

If you choose to link to shared libraries (recommended) then you will need to add the darwin/bin path to your LD_LIBRARY_PATH environment variable.

The following table details the various build options that can be set in make.local.

OptionDescriptionDefault
DRWN_FORCE_32BIT Force 32-bit build even on 64-bit environments. This is useful if you are deploying your applications on heterogeneous (32-bit and 64-bit) clusters. 0
DRWN_DEBUG_SYMBOLS Include debugging information in binaries. 0
DRWN_SHARED_LIBS Build and link to shared libraries. 1
DRWN_BUILD_VISION_LIB Force building the vision library. 1 if OpenCV is installed
0 otherwise

Additional debugging/statistics information can be included by defining the following compiler symbols: DRWN_DEBUG_STATISTICS, DRWN_FACTOR_DEBUG_STATISTICS.

Installing Build Tools and External Libraries

The following commands will install the a number of packages required to build Darwin libraries and applications on Ubuntu systems. You will need superuser privledges to install these packages.

# required to get access code repository
sudo apt-get install subversion
# required for building the code
sudo apt-get install build-essential csh g++ wget
# required by opencv
sudo apt-get install cmake ffmpeg
sudo apt-get install gtk+-2.0 gtk2.0-dev libgl1-mesa-dev libglu1-mesa-dev
sudo apt-get install pkg-config
# required by lua
sudo apt-get install libreadline6-dev
# required for building documentation
sudo apt-get install doxygen graphviz

Detailed Install Instructions for Third-Party Libraries

Third-party libraries required by Darwin (and associated projects) can be installed as described above. However, if something goes wrong you may need to install these libraries manually. The following describes that process.

"Eigen Linear Algebra Library"

cd external
wget http://bitbucket.org/eigen/eigen/get/3.2.3.tar.bz2 -O eigen-3.2.3.tar.bz2
bunzip2 eigen-3.2.3.tar.bz2
tar xvf eigen-3.2.3.tar
mv eigen-eigen-36fd1ba04c12 eigen-3.2.3
rm -f eigen-3.2.3.tar
ln -s eigen-3.2.3/Eigen Eigen
cd ..
Warning
Sometimes Eigen changes the name of the directory within the tarball. If the mv step fails, check the directory name and modify appropriately.

"OpenCV Computer Vision Library"

cd external
wget -c https://github.com/Itseez/opencv/archive/2.4.9.tar.gz
tar zxvf 2.4.9.tar.gz
cd opencv-2.4.9
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=../opencv \
-D BUILD_NEW_PYTHON_SUPPORT=OFF .
make
make install
cd ../..

Make sure the file external/opencv/lib/pkgconfig/opencv.pc exists. If not you have probably installed OpenCV in the wrong location.

If you experience linker problems (e.g., "/usr/bin/ld: error: cannot find -lcudart") then try compiling OpenCV without CUDA support by adding "-D WITH_CUDA=OFF" to the cmake command above.

Matlab

Building the Matlab project requires Matlab to be installed on the system and a symbolic link setup in the external directory, e.g.,

ln -s /usr/local/MATLAB/R2010b/ external/matlab

Furthermore, the Matlab library directory should be added to the path,

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/MATLAB/R2010b/bin/glnx86/
See Also
Compiling Mex Projects

NCI National Facility (nf.nci.org.au)

If you are running Darwin on the NCI cluster machines then you will need to follow these instructions. Before installing externals:

setenv CC gcc
setenv CXX g++
module load cmake/2.8.2

Add to .login

setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${DARWIN}/external/opencv/lib

or .profile

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DARWIN}/external/opencv/lib

Linking Darwin from External Projects

The following is a sample Makefile that demonstrates how to link the Darwin libraries from external projects

DRWN_DIR =
INC_DIRS = -I${DRWN_DIR}/include -I${DRWN_DIR}/external
LIBS = -L${DRWN_DIR}/bin -ldrwnML -ldrwnPGM -ldrwnIO -ldrwnBase -lm -lpthread
main:
g++ -g -o main main.cpp ${INC_DIRS} ${LIBS}
clean:
rm -f main
Warning
The Darwin libraries should be included in reverse dependency order (as listed above) to avoid linker errors.