This is an old revision of the document!
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
Before you build Octave, you some libraries need to be built
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%)
Copy Library your lib directory
$cp lib* $HOME/lib
For more information visit Quick Installation Guide for LAPACK on Unix Systems
“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 $ export F77=gfortran $ export FFLAGS=-fPIC $ ../configure --prefix=$HOME $ make $ make check #test it $ make install #only if all tests are passed
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
The tool is required, as if the default ld is used error of the following nature occur during the octave build
$ /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
use a later version of ld should hopefully avoid this error…
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 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
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.0.tar.bz2 $ tar -xf octave-3.4.0.tar.bz2
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.4.0 $ mkdir BUILD $ cd BUILD $ export F77=gfortran $ ../configure --prefix=$HOME --with-blas=$HOME/lib/librefblas.a --with-lapack=$HOME/lib/liblapack.a --enable-static $ ../configure --prefix=$HOME --without-fftw3 --without-fftw3f --without-umfpack --enable-static
Options explained
/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
After configuration is complete, alot of warning about missing librarys are given
$ make
If errors occur such as
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.