User Tools

Site Tools


guide:compiling_octave

This is an old revision of the document!


Compiling Octave from Source

This guide is written as to try and help CHPC users who are struggling to compile the Octave version required for their codes. This guide is written for the Sun Tsessbe Cluster. The reader is advise to read through the INSTALL file located in the Octave Source they wish to install before proceeding with this guide.

Before you begin, make sure your bash environmental variable are set correctly, for example . Also it recommended that you make you 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.

Also note that for this guide, all binary and libraries are installed home directory, i.e prefix=$HOME. My setup

$ export PATH=/opt/gridware/gcc-4.3/bin:$PATH
$ export LD_LIBRARY_PATH=/opt/gridware/gcc-4.3/lib/:$LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH=/opt/gridware/gcc-4.3/lib64/:$LD_LIBRARY_PATH
$ gcc --version
  gcc (GCC) 4.3.4
  

Download Source

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

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

Compile Prerequits (Optional)

Before you build Octave, you may to build some of these libraries

UMFPACK

FFTW

“FFTW is a C subroutine library for computing the discrete Fourier transform (DFT)” FFTW Homepage

$ cd ~/scratch
$ wget http://www.fftw.org/fftw-3.3.tar.gz
$ tar -xf fftw-3.3.tar.gz
$ cd fftw-3.3
$ mkdir BUILD
$ cd BUILD
$ ../configure --prefix=$HOME
$ make
$ make check #test it
$ make install #only if all tests are passed

Configuration

At the time this guide was written, the f77 compiler was broken [?]:

 $ f77 --help
 /usr/bin/dirname: missing operand
 Try `/usr/bin/dirname --help' for more information.
 NOTICE: Invoking /usr/bin/f90 -f77 -ftrap=%none --help
 /usr/bin/f77: line 43: /usr/bin/f90: No such file or directory
 /usr/bin/f77: line 43: exec: /usr/bin/f90: cannot execute: No such file or directory
 

So gfortran will be used in its place,

 $ cd ~/scratch/octave-3.2.4
 $ mkdir BUILD
 $ cd BUILD
 $ export F77=gfortran
 $ export LDFLAGS=-L$HOME/lib #if you compiled you own fftw3 in your home directory
 $ ../configure --prefix=$HOME --without-fftw3 --without-fftw3f --without-umfpack --enable-static

Options explained

  • — prefix=$HOME, configure for installation into home directory
  • —without-fftw3 –without-fftw3f, Use the included fftpack library for computing Fast Fourier Transforms instead of the fftw3 library. If this option is not chosen the following build was encounter :
/usr/bin/ld: /usr/local/lib/libfftw3f.a(apiplan.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libfftw3f.a: could not read symbols: Bad value
  • –without-umfpack (is the UMFPACK library available?)

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.

/app/dokuwiki/data/attic/guide/compiling_octave.1323114969.txt.gz · Last modified: 2021/12/09 16:42 (external edit)