Installing Octave with UMFPACK from Source

if you are not using Ubuntu and need to compile the UMFPACK manually, download the SuiteSparse package at this page. I didn’t use METIS, so I need to disable it first. Follow the instruction at the README.txt on how to disable it. This is the step btw:

  1. from the SuiteSparse directory, go to UFconfig directory and edit UFconfig.mk, and uncomment this option

    # If you use CHOLMOD_CONFIG = -DNPARTITION then you must use the following
    # options:
    METIS_PATH =
    METIS =

    and add add this line

    CHOLMOD_CONFIG = -DNPARTITION
  2. Since I’m compiling for linux, I choose this compiler alternative option.

    CFLAGS = -O3 -fexceptions -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -L/usr/li
    b/gcc/x86_64-redhat-linux/4.1.1/

    Somehow I got error that it couldn’t fine libgfortran, so I need to specify the location with the -L option.
  3. Go back to SuiteSparse directory and type “make”. It will compile and run the test
  4. run this script SuiteSparse direcotry to install headers and libraries to your local directory.

    #!/bin/bash
    INSTALL_DIR=$HOME/usr/local
    # Make sure the install directories exist
    if !(test -d $INSTALL_DIR/include);
    then
    echo $INSTALL_DIR/include did not exist, creating $INSTALL_DIR/include
    mkdir $INSTALL_DIR/include
    fi;
    if !(test -d $INSTALL_DIR/include/suitesparse);
    then
    echo $INSTALL_DIR/include/suitesparse did not exist, creating $INSTALL_DIR/include/suitesparse
    mkdir $INSTALL_DIR/include/suitesparse
    fi;
    if !(test -d $INSTALL_DIR/lib);
    then
    echo $INSTALL_DIR/lib did not exist, creating $INSTALL_DIR/lib
    mkdir $INSTALL_DIR/lib
    fi;
    # Copy all the files to the new directories
    echo Copying UMFPACK files into $INSTALL_DIR...
    cp UFconfig/UFconfig.h $INSTALL_DIR/include/suitesparse
    cp UMFPACK/Include/*.h $INSTALL_DIR/include/suitesparse
    cp UMFPACK/Lib/libumfpack.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libumfpack.a
    echo Copying AMD files into $INSTALL_DIR/...
    cp AMD/Include/*.h $INSTALL_DIR/include/suitesparse
    cp AMD/Lib/libamd.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libamd.a
    echo Copying CAMD files into $INSTALL_DIR/...
    cp CAMD/Include/*.h $INSTALL_DIR/include/suitesparse
    cp CAMD/Lib/libcamd.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libcamd.a
    echo Copying COLAMD files into $INSTALL_DIR/...
    cp COLAMD/Include/*.h $INSTALL_DIR/include/suitesparse
    cp COLAMD/Lib/libcolamd.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libcolamd.a
    echo Copying CCOLAMD files into $INSTALL_DIR/...
    cp CCOLAMD/Include/*.h $INSTALL_DIR/include/suitesparse
    cp CCOLAMD/Lib/libccolamd.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libccolamd.a
    echo Copying CXSPARSE files into $INSTALL_DIR/...
    cp CHOLMOD/Include/*.h $INSTALL_DIR/include/suitesparse
    cp CHOLMOD/Lib/libcholmod.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libcholmod.a
    echo Copying CHOLMOD files into $INSTALL_DIR/...
    cp CXSparse/Include/*h $INSTALL_DIR/include/suitesparse
    cp CXSparse/Lib/libcxsparse.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libcxsparse.a
    echo Copying METIS files into $INSTALL_DIR/...
    cp metis-4.0/Lib/*.h $INSTALL_DIR/include/suitesparse
    cp metis-4.0/libmetis.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libmetis.a
  5. Go to octave-3.0.0 source directory. and type

    ./configure CPPFLAGS=-I$HOME/usr/local/include/suitesparse LDFLAGS=-L$HOME/usr/local/lib/ --prefix=$HOME/programs/Octave3.0

    where I decide to install it into my $HOME/programs/Octave3.0 directory.
Advertisements

5 Responses

  1. […] Posted on June 30, 2008 by kurniawano I need to install Octave using SuiteSparse. I have written a post last time on how to build Suitesparse. But this time the server that I am installing doesn’t […]

  2. I reinstalled my octave in one of my server. And I tried to use GotoBlas. It’s pretty easy to install. This is the step:
    1. download GotoBlas

    2. read the installation instruction in the 02QuickInstall.txt. Since my server is 64 bit, I simply run the ./quickbuild.64bit and copy the compiled libraries *.a and *.so into my local directory, which I created under $HOME/local

    3. Then I install Metis and Suitesparse. I need to modify the UFconfig/UFconfig.mk file to use Metis and to use the GotoBlas libraries. The compilation runs perfectly well. And then I used the script above to copy to $HOME/local.

    4. then I also installed fftw library. This is pretty standard to install, just do ./configure –prefix=$HOME/local and then type make and make install.

    5. Then I run configure again for octave with this command:
    ./configure CPPFLAGS=-I$HOME/local/include LDFLAGS=-L$HOME/local/lib/ –prefix=$HOME/local

  3. During build, I encountered this error:
    /usr/bin/ld: /scratch/octave/lib/libcholmod.a(cholmod_common.o): relocation R_X86_64_32S against `malloc’ can not be used when making a shared object; recompile with -fPIC
    /scratch/octave/lib/libcholmod.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make[2]: *** [liboctave.so] Error 1
    make[2]: Leaving directory `/HOME01/WORK/work01/octave/octave-3.0.0/liboctave’

    according to the Octave forum:
    http://www.nabble.com/Cholmod.a-error-td16628174.html

    The solution is to recompile SuiteSparse using -fPIC. We can do this by adding -fPIC into the CFLAGS in the Makefile. If there are certain libraries from SuiteSparse still gives this error, go to the Lib folder and edit the Makefile for that library, add -fPIC. Do a make clean and make, and then copy the library.a into the local/lib folder where you keep all the libraries.

    Besides that I also encountered this error:
    ../liboctave/liboctave.so: undefined reference to `METIS_NodeComputeSeparator’
    ../liboctave/liboctave.so: undefined reference to `METIS_NodeND’
    collect2: ld returned 1 exit status
    make[2]: *** [octave] Error 1
    make[2]: Leaving directory `/home/perry/abs/local/octave/src/octave-3.0.0/src’
    make[1]: *** [src] Error 2
    make[1]: Leaving directory `/home/perry/abs/local/octave/src/octave-3.0.0′
    make: *** [all] Error 2

    The solution according to this forum:
    http://bbs.archlinux.org/viewtopic.php?id=47516

    is to add -lmetis into the LDFLAGS of octave ./configure. So the command that should be run is:
    ./configure CPPFLAGS=-I$HOME/local/include LDFLAGS=”-L$HOME/local/lib/” LIBS=-lmetis –prefix=$HOME/local

  4. When I run octave after installation, it gave me this error as I tried to use the fermi_dirac_half functin from GSL octave forge package.

    error libfftw3.so.3: cannot open shared object file: No such file or directory

    to solve this, we need to reinstall the package from octave:
    octave:\> pkg install gsl-1.0.4.tar.gz

    This solves my problem.

  5. put -fPIC in CFLAGS in UFconfig.mk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: