Compile Octave 4.4 on Ubuntu 18.04

1 minute read


Linux compile latest Octave

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. Compile GNU Octave Source
    mkdir ~/.local/octave
    # this fixes problems with conflicting libraries
    export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    # 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

  4. Install GNU Octave–takes 30-60 minutes:

    make -j2
    make install

    Note, normally you can just use make -j to “max out” the full capability of your CPU cores + threads. However, with a huge program like Octave, this can make your PC stop responding to user input for an hour or more. So limit to two jobs with make -j2.

  5. Tell Linux to use this new GNU Octave by adding to ~/.bash_aliases
    alias octave="$HOME/.local/octave/bin/octave -q"
  6. Configure ~/.octaverc to nicer defaults.
  7. (optional) Test Octave
    make check
    PASS                   14950
    FAIL                       2
    XFAIL (reported bug)      35
    SKIP (missing feature)    72
    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

Leave a Comment