Compile Octave 4.4 on Ubuntu 18.04

Related: 10 second Octave 4 PPA install

One might choose to compile GNU Octave if the Octave PPA is too old or not available for your Linux system. This procedure was tested with Ubuntu 18.04, g++ 7.3, LLVM 6.0 and Java/OpenJDK 10.

  1. core prereqs
    apt install g++ make gawk gfortran gnuplot texi2html icoutils libxft-dev gperf flex libbison-dev libqhull-dev libglpk-dev libcurl4-gnutls-dev librsvg2-dev libqrupdate-dev libgl2ps-dev libarpack2-dev libreadline-dev libncurses-dev libhdf5-dev llvm-dev default-jdk texinfo libfftw3-dev libgraphicsmagick++1-dev libfreeimage-dev transfig epstool librsvg2-bin libosmesa6-dev libsndfile-dev lzip libatlas-base-dev liblapack-dev libsundials-dev

    graphical prereqs–if you only want the command line Octave + GNUplot-based plotting, you can OMIT these prereqs:

    qtbase5-dev qttools5-dev libqscintilla2-qt5-dev

    Octave development prioritizes Qt over the other two GUI methods (FLTK, GNUplot).

  2. Download GNU Octave source octave-*.tar.lz and extract
    tar -xf octave-4*.lz
  3. Configure GNU Octave build
    mkdir ~/.local/octave

    in the directory where you extracted Octave source:

    ./configure --prefix=$HOME/.local/octave

    configure takes a minute or two, perhaps several minutes on slower systems. Usually it will tell you if a prerequisite library is missing.

    Configure Octave 4.4 results

    If you get errors with conflicting libraries, try before the ./configure command:

    export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  4. Install GNU Octave–takes 30-60 minutes:

    make -j -l2 CFLAGS=-O CXXFLAGS=-O LDFLAGS=
    make install

    limit make resource usage with make -j -l2.

  5. Tell Linux to use this new GNU Octave by adding to ~/.bashrc
    export PATH="$HOME/.local/octave/bin/:$PATH"
  6. Configure ~/.octaverc to nicer defaults.

(optional) test Octave build

make check

results in:

PASS                            14981
FAIL                                0
XFAIL (reported bug)               35
SKIP (missing feature)             71
SKIP (run-time condition)          12


GNU Octave hard to read font fix

If fonts look terrible in GNU Octave Terminal or Editor, fix by changing to a better font:

  1. Edit → Preferences → Terminal → Font → Liberation Mono
  2. Edit → Preferences → Editor Styles → Octave → Default → Liberation Mono

Other fixes

libinterp/corefcn/ error: ‘octave_jit_octave’ has not been declared octave_jit_octave::err_nan_to_logical_conversion (void)

This error (for Octave 4.2) comes from the non-functioning JIT; please do not use --enable-jit at ./configure with Octave 4.2.

lrelease: could not exec ‘/usr/lib/x86_64-linux-gnu/qt5/bin/lrelease’: No such file or directory

this error fixed by

apt install qttools5-dev-tools



Written by Michael Hirsch, Ph.D. //