User Tools

Site Tools


guide:compiling_octave

Compiling Octave 3.4.3 from Source

This guide is written for the Sun Tsessbe Cluster. The reader is advise to read through the INSTALL file located in the Octave Source Folder before proceeding with this guide. Also it recommended to make use of temporary or scratch directory to do all the compilation in (i.e. ~/scratch or /tmp/$USER), as to save disk space in your home directory. This guide assumes GCC 4.6.2 has been installed in your home directory as in Compiling GCC from Source. Paste the following lines at the end of your ./bashrc file

export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/lib64:$LD_LIBRARY_PATH
export PATH=$HOME/bin:$PATH
export LDFLAGS="-L$HOME/lib64 -L$HOME/lib"
export CPPFLAGS="-I$HOME/include -L$HOME/lib64 -L$HOME/lib"
export CXXFLAGS=$CPPFLAGS
export F77=gfortran

log out and in again,

$  gcc --version
gcc (GCC) 4.6.2

Prerequisites

Before you build Octave, you some libraries need to be built

LAPACK and BLAS

Download the LAPACK source and extract, setup make and build as follows,

$ cd ~/scratch
$ wget http://www.netlib.org/lapack/lapack-3.4.0.tgz
$ tar -xf lapack-3.4.0.tgz
$ cd lapack-3.4.0

Setup make,

$ cp make.inc.example make.inc
$ emacs make.inc
# change 
#  OPTS     = -O2  and, NOOPT    = -O0
# to
#  OPTS     = -O2 -fPIC and, NOOPT    = -O0 -fPIC
# save (crtl-x crtl-s) and exit (crtl-x ctrl-c)
$ make

Make BLAS

$ cd BLAS/SRC
$ make

Make LAPACK

$ cd ../../
$ make

Which should give you test results such as

  			-->   LAPACK TESTING SUMMARY  <--
		Processing LAPACK Testing output found in the TESTING direcory
SUMMARY             	nb test run 	numerical error   	other error  
================   	===========	=================	================  
REAL             	1070421		38	(0.004%)	0	(0.000%)	
DOUBLE PRECISION	1052315		204	(0.019%)	0	(0.000%)	
COMPLEX          	508588		2	(0.000%)	0	(0.000%)	
COMPLEX16         	549510		24	(0.004%)	0	(0.000%)	

--> ALL PRECISIONS	3180834		268	(0.008%)	0	(0.000%)

For more information visit Quick Installation Guide for LAPACK on Unix Systems

PCRE - Perl Compatible Regular Expressions

From the PCRE website, follow the link source forge to download the appropriate source file. Extract, go into directory, make BUILD directory, enter build directory. ../configure with home prefix. make. make check. make install. If $HOME/lib is not in your LD_LIBRARY_PATH, add it via export or in your .bashrc file.

FFTW

binutils and libtools (optional)

binutils

$ wget http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2
$ tar -xf binutils-2.22.tar.bz2
$ cd binutils-2.22
$ mkdir BUILD
$ cd BUILD
$ ../configure --prefix=$HOME
$ make
$ make -k check
# If all the tests are passed, install into you home directory
$ make install

libtools

$ wget http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/libtool/libtool-2.4.2.tar.gz
$ tar -xf libtool-2.4.2.tar.gz
$ cd libtool-2.4.2.tar.gz
$ mkdir BUILD
$ cd BUILD
$ ../configure --prefix=$HOME
$ make 
$ make -k check
# If all the tests are passed, install into you home directory
$ make install

If you have not already add the following line in your .bashrc file

export PATH=$HOME/bin:$PATH

then logout and login again, you should see

$ ld -v
GNU ld (GNU Binutils) 2.22

UMFPACK (optional)

“UMFPACK is a set of routines for solving unsymmetric sparse linear systems, Ax=b, using the Unsymmetric MultiFrontal method.” UMFPACK. See Compiling UMFPACK

$#still to be done

Download Source

Since the ftp is blocked on the Tsessbe login node, make use of an http mirror to download octave.

$ cd ~/scratch 
$ wget http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/octave/octave-3.4.3.tar.bz2
$ tar -xf octave-3.4.3.tar.bz2

Configuration

 $ cd ~/scratch/octave-3.4.3
 $ mkdir BUILD
 $ cd BUILD
 $ ../configure --prefix=$HOME --with-blas=$HOME/scratch/lapack-3.4.0/librefblas.a --with-lapack=$HOME/scratch/lapack-3.4.0/liblapack.a  --disable-docs 
 $ cp ../AUTHORS ./ #this is a bug in the configuration script...

After configuration is complete, alot of warning about missing librarys are given

Build

 $ make
 

If errors occur such as

  • g++: Internal error: Killed (program cc1plus)

wait a while and then make again, as the process was killed by the usage limiter which runs on the login node. If nessary try the approach shown in Compiling GCC from Source.

Check

$ make check

notable failures are

scripts/linear-algebra/onenormest.m .................... PASS    3/4    FAIL 1
scripts/optimization/sqp.m ............................. ** On entry to DORGLQ parameter number  5 had an illegal value 
  PASS   16/17   FAIL 1

Summary:

PASS   6829
FAIL     11

Install

$ make install

Add the following to the end of your .bashrc file

# for Octave 3.4.3 installed in $HOME
export LD_LIBRARY_PATH=$HOME/lib/octave/3.4.3:$LD_LIBRARY_PATH

Log in and out, then

$ octave --version
GNU Octave, version 3.4.3
Copyright (C) 2011 John W. Eaton and others.
/var/www/wiki/data/pages/guide/compiling_octave.txt · Last modified: 2012/04/12 13:55 by hamish