Pages

Saturday, January 18, 2014

GNU Octave -- MATLAB-like Language

Compiling & Installing Octave on GNU/Linux:

GNU Octave is a high-level programming language, primarily for Numerical Computations. It is an active GNU project, and this article will discuss the major steps to install Octave 3.8.0 on GNU/Linux (x86-64).

At first, I have downloaded the source code of the following software projects(all are free):

    Octave-3.8.0, ATLAS-3.10.1, LPACK-3.4.1, PCRE-8.34, Ncurses-5.9 and FFTW-3.3.3.

Secondly, follow the next 5 steps to compile and install Octave.

1, Build PCRE(Perl Compatible Regular Expressions):
      $cd pcre-8.34

      $configure --prefix=/my/usr/local
      $make
      $make install
2, Build Ncurse(New curses):
      $export CFLAGS='-fPIC'
      $configure --prefix=/my/usr/local
      $make
      $make install
3, Build FFTW(for discrete FFT):
      $configure --prefix=/my/usr/local
      $make
      $make install
4, Build ATLAS(Automatically Tuned Linear Algebra Software) and LAPACK(Linear Algebra Package) :
      $mkdir atlas-build
      $cd altas-build;
      $../ATLAS/configure -Fa acg '-fPIC' -shared --prefix=/my/usr/local --with-netlib-lapack-tarfile=/path/to/lapack-43.4.2.gz

       $make
       $make install

5, Build Octave:
       $cd octave-3.8.0
       $configure --prefix=/my/usr/local
       $make
       $make install
6, Let's go!
        $octave
         octave:1>magic(3)
         ans = 
              8  1  6
              3  5  7
              4  9  2

Note: Octave-Forge  project is a community-maintained set of packages for GNU Octave. It's worth to give it try, although it's optional.

============================================================

If the GCC on your Unix Server is outdated, you may need to build and install GCC v4.8.2:

1, Download GCC source tar file from http://gcc.gnu.org/ and extract it into gcc-4.8.2/.
2, $cd gcc-4.8.2/contrib
    $download_prerequisites; [set http_proxy if necessary]
3, $mkdir gcc-build
    $cd gcc-build;
4, $../gcc-4.8.2/configure --prefix=/my/usr/local --disable-multilib
5, $make
6, $make install

Note: make sure that the Fortran Csompiler is also installed.