Help installing Octave (linux-generic)

Last modified: Wed Oct 11 20:43:15 EDT 2017


Overview

These instructions were last validated on 2017-10-10 with gcc 7.2.0 for the versions of software indicated below on 64-bit Slackware Linux 14.2.

You will need the Fortran compiler that is an optional install with GCC.

Changed from ATLAS to OpenBLAS

Until 2017, I used ATLAS with full LAPACK included to satisfy the dependencies of Octave.  This was always complicated, and now it has become too difficult to get ATLAS to build.

Now, I use OpenBLAS.  According to the Octave docs as of 2017-10-11, LAPACK is still a required external package, but Octave appears to be satisfied with the LAPACK included within OpenBLAS.

Environment

The following variables are referred to in the builds below:

RELSRC=${HOME}/builds/relsrc    # Where the source tarballs are
PFXDIR=/usr/local/stats         # Where to install everything
BUILDDIR=/tmp                   # Where to build everything
CPUN=8                          # Number of CPU cores
LIBMAGIC=lib64                  # For Slackware64 paths

The following variables go in ~/.bash_profile to capture all of the relevant stuff in the target directory:

export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${PFXDIR}
export INFOPATH=${INFOPATH}${PFXDIR}/share/info:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PFXDIR}/lib
export MANPATH=${MANPATH}:${PFXDIR}/share/man
export PATH=${PATH}:${PFXDIR}/bin
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${PFXDIR}/lib/pgkconfig
export XDG_DATA_DIRS=${XDG_DATA_DIRS}:${PFXDIR}/share/

OpenBLAS 0.2.20

Source:  http://www.openblas.net/

BLAS=OpenBLAS-0.2.20
if [ ! -e ${PFXDIR}/lib/libopenblas.so ]; then
  # OpenBLAS auto-detects number of CPUs and word size, doesn't need -j.
  cd ${BUILDDIR}
  tar xf ${RELSRC}/${BLAS}.tar.gz
  cd ${BLAS}
  make
  make PREFIX=${PFXDIR} install
  cd ${BUILDDIR}
  rm -rf ${BLAS}
fi

Fltk 1.3.4-2

Source:  http://www.fltk.org/

Fltk is for optional native graphics in Octave.  It will build against Nvidia's GL libs if they are present.

FLTK=fltk-1.3.4-2
if [ ! -f ${PFXDIR}/lib/libfltk.a ]; then
  cd ${BUILDDIR}
  tar xf ${RELSRC}/${FLTK}-source.tar.gz
  cd ${FLTK}
  ./configure --prefix=${PFXDIR} CFLAGS="-fPIC" CXXFLAGS="-fPIC"
  make -j ${CPUN}
  make install
  cd ${BUILDDIR}
  rm -rf ${FLTK}
fi

Octave 4.2.1

Source:  http://www.octave.org/

Any errors output by configure can be highly misleading.  You must read the log to find out what actually happened.

The build process tries to read /usr/lib64/libstdc++.la.  If gcc is installed somewhere else a temporary symlink must be created.

OCTV=octave-4.2.1
if [ ! -e ${PFXDIR}/bin/octave ]; then
  if [ ! -e /usr/${LIBMAGIC}/libstdc++.la ]; then
    ln -f -s `find /usr/local/gcc-* -name libstdc++.la -print` /usr/${LIBMAGIC}/libstdc++.la
  fi
  cd ${BUILDDIR}
  tar xf ${RELSRC}/${OCTV}.tar.xz
  cd ${OCTV}
  ./configure --prefix=${PFXDIR}    \
    --with-blas="-lopenblas"        \
    CPPFLAGS="-I${PFXDIR}/include"  \
    LDFLAGS="-L${PFXDIR}/lib"
  make -j ${CPUN}
  make install
  cd ${BUILDDIR}
  rm -rf ${OCTV} /usr/${LIBMAGIC}/libstdc++.la
fi

Many optional dependencies were skipped, as indicated by lots of configure WARNING messages.

Extra packages can be obtained from http://octave.sourceforge.net/ and installed by doing pkg install whatever.tar.gz from the Octave prompt (as root).


KB
Home