Octave for Debian systems

Revision as of 20:13, 4 January 2016 by Crobar (talk | contribs) (→‎HDF5: added information about non-standard hdf5 locations on Debian)

For Debian, and Debian based distributions such as Ubuntu, specific solutions.

Pre-compiled binaries

Binary packages for Octave and many Octave-Forge packages are provided by all versions of Debian and Ubuntu. These are the most well-tested binaries available and should work best for most users.

sudo apt-get install octave

Aside the octave package that installs GNU Octave, other pieces of it are split over multiple packages. These are octave-doc, octave-info, and octave-htmldoc for the documentation; liboctave-dev for the octave development header files and mkoctfile (required to install Octave Forge packages); and octave-dbg for the debugging symbols.

For Debian stable users, there may also be newer packages available in backports, so don't forget to check there.

Octave packages

Many Octave packages are also distributed by your Linux distribution. These are tested to work the best with your Octave version. For example:

sudo apt-get install octave-control octave-image octave-io octave-optim octave-signal octave-statistics

Octave's Personal Package Archive (PPA) for Ubuntu

For some Ubuntu releases the octave packages are too old (Ubuntu 12.04 only has Octave version 3.2). The GNU Octave Team on Launchpad maintains a PPA providing more up to date packages of Octave for all versions of Ubuntu. These are backported from Debian unstable (the Ubuntu Octave Team needs help testing and preparing the packages so if you can help with this, contact Mike Miller). To set up your system to install these packages:

sudo apt-add-repository ppa:octave/stable
sudo apt-get update
sudo apt-get install octave

Compiling from source

The only tricky part is to install the dependencies. Once that is solved, installing from source should be as easy as ./configure && make && make install. See the manual for configure options.

Install dependencies

Note that different Debian and Ubuntu versions may have slightly different package names but their differences should be pretty small, mostly limited to version numbers.

The easy way (but likely incorrect)

This approach is only suitable if you are building from source the same version that your Linux distribution already has packaged.

The easy way to install most of the necessary dependencies is to sudo apt-get build-dep octave. This will install all packages necessary to build and prepare a Debian package for the octave version available on your system repositories. However:

  • will install unnecessary packages related to the building of a Debian package;
  • may miss some new dependencies;
  • may install packages that are no longer octave dependencies.

The even easier way (but experimental)

The MXE-octave package provides a way to compile Octave for different platforms. Dependencies and certain flags are handled automatically.

The right way

The right way is to select and install all the dependencies as listed in the INSTALL.OCTAVE file. The following are their package names in Debian repositories (they will have their own dependencies which your package manager will solve automatically). If you are building development versions, you'll require some more packages as listed on etc/HACKING and INSTALL. Many of them will already be installed on your system. Install the dependencies by typing

sudo apt-get install

followed by the package names of the table below.

Dependency Debian 8 Jessie (stable) Ubuntu 14.04 Trusty Tahr (LTS)
Required build tools
C compiler gcc gcc
C++ compiler g++ g++
Fortran compiler gfortran gfortran
GNU make make make
Required external packages
BLAS libblas-dev libblas-dev
LAPACK liblapack-dev liblapack-dev
PCRE libpcre3-dev libpcre3-dev
Strongly recommended. Check the Octave manual for more information.
ARPACK libarpack2-dev libarpack2-dev
cURL libcurl4-gnutls-dev libcurl4-gnutls-dev
epstool epstool epstool
FFTW3 libfftw3-dev libfftw3-dev
fig2dev transfig transfig
FLTK libfltk1.3-dev libfltk1.3-dev
fontconfig libfontconfig1-dev libfontconfig1-dev
FreeType libfreetype6-dev libfreetype6-dev
gl2ps libgl2ps-dev libgl2ps-dev
GLPK libglpk-dev libglpk-dev
GNU Readline libreadline-dev libreadline-dev
gnuplot gnuplot gnuplot-x11
GraphicsMagick++ libgraphicsmagick++1-dev libgraphicsmagick++1-dev
HDF5 libhdf5-serial-dev libhdf5-serial-dev
Java JDK openjdk-7-jdk openjdk-7-jdk
libsndfile libsndfile1-dev libsndfile1-dev
LLVM llvm-dev llvm-dev
lpr lpr lpr
makeinfo texinfo texinfo
OpenGL libgl1-mesa-dev libgl1-mesa-dev
OSMesa libosmesa6-dev libosmesa6-dev
pstoedit pstoedit pstoedit
PortAudio portaudio19-dev portaudio19-dev
Qhull libqhull-dev libqhull-dev
QRUPDATE libqrupdate-dev libqrupdate-dev
QScintilla libqscintilla2-dev libqscintilla2-dev
Qt

libqt4-dev libqtcore4 libqtwebkit4 libqt4-network libqtgui4 libqt4-opengl-dev

libqt4-dev libqtcore4 libqtwebkit4 libqt4-network libqtgui4

SuiteSparse libsuitesparse-dev libsuitesparse-dev
Texlive texlive texlive
Xft libxft-dev libxft-dev
zlib zlib1g-dev zlib1g-dev
Required to build from development sources
Autoconf autoconf autoconf
Automake automake automake
Bison bison bison
Flex flex flex
gperf gperf gperf
gzip gzip gzip
icoutils icoutils icoutils
rsvg-convert librsvg2-bin librsvg2-bin
libtool libtool libtool
perl perl perl
rsync rsync rsync
tar tar tar
  • The Debian repositoriy has several libraries for dealing with HDF data files. The recommended is libhdf5-serial-dev. However, the msh package requires gmsh which is incompatible with it.
  • The GraphicsMagick++ library (libgraphicsmagick++1-dev) on the Debian repositories was compiled with quantum 8 which limits reading images to 8 bit. The solution is to recompile GraphicsMagick with quantum 16 or 32 before building Octave.

Configuration

As mentioned above, Octave can be compiled with the default settings using ./configure && make && make install. You can also tweak the setup using configure options. Some examples are given below for a Linux system.

64 bit

To get 64-bit requires all linked libraries to support 64-bit variables. You can omit most of these except BLAS which gives a fatal error. This is remedied by compiling OpenBLAS with edits to its Makefile.rule so that BINARY=64 INTERFACE64=1.

./configure LD_LIBRARY_PATH=/opt/OpenBLAS/lib CPPFLAGS=-I/opt/OpenBLAS/include LDFLAGS=-L/opt/OpenBLAS/lib --enable-64

Java JIT

To get the just-in-time compiler, you should specify the location of the java compiler since the autodetection script often fails.

./configure JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64" --enable-jit

HDF5

With current Debian versions you may get the following when building from source:

HDF5 library not found.  Octave will not be able to save or load HDF5 data files.

The problem is that there are multiple versions of the hdf5 package. Octave was written with the serial version in mind but it is likely to work with the others (OpenMPI and Mpich). Due to the naming scheme done in Debian, it is required to specify the location of the libraries. See bug #38928 for details but basically, use the following when running configure:

./configure CPPFLAGS=-I/usr/include/hdf5/serial LDFLAGS=-L/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/hdf5/serial

Another issue you may have on Debian systems, even when using the correct hdf5 libraries, is that they are installed in a non-standard location which is not found by configure. This will result in the following warning after running configure:

 WARNING: HDF5 library not found. Octave will not be able to save or load HDF5 data files.

To avoid this you can manually specify the hdf5 locations in the following way:

 ./configure --with-hdf5-includedir=/usr/include/hdf5/serial --with-hdf5-libdir=/usr/lib/x86_64-linux-gnu/hdf5/serial

Further information can be found in this bug discussion starting with comment #19.