Compiling Octave 4.2 on Ubuntu 16.04

Related: Easy 10 second Octave 4 PPA install

This procedure was tested with Ubuntu 16.04, g++ 6.2, LLVM 3.8 and Java 8.

0. Prereqs

apt install g++ make gawk gfortran gnuplot texi2html icoutils libxft-dev gperf flex libbison-dev libqhull-dev libglpk-dev libcurl4-gnutls-dev libfltk1.3-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 libjasper-dev libfreeimage-dev transfig epstool librsvg2-bin libosmesa6-dev libsndfile-dev portaudio19-dev lzip libatlas-dev liblapack-dev libqt5scintilla2-dev qttools5-dev-tools

Octave 4.2 works with QT4 or QT5; here we use QT5.

1. Download Source

wget ftp://ftp.gnu.org/gnu/octave/octave-4.2.1.tar.lz 

tar -xf octave-4*.lz

2. Compile Source

sudo mkdir /opt/octave4
sudo chown $(whoami):$(whoami) /opt/octave4

cd octave-4*

# this fixes problems with conflicting libraries
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

./configure --prefix=/opt/octave4

Configuring Octave 4 resulted in the output in this Gist

3. Install Octave

This takes 30-60 minutes depending on your CPU, assuming you use multi-threaded compilation (the -jN option, where N is number of threads)

make -j4
make install

4. Point Linux to use this Octave

put into ~/.bash_aliases

alias octave="/opt/octave4/bin/octave -q"

5. (optional) Test Octave

make check

PASS 14868 FAIL 0 XFAIL 33 SKIPPED 43

GNU Octave hard to read font fix

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

Edit > Preferences > Terminal > Font > Liberation Mono

Edit > Preferences > Editor Styles > Octave > Default > Liberation Mono

Notes

libinterp/corefcn/jit-typeinfo.cc:216:1: error: ‘octave_jit_octave’ has not been declared octave_jit_octave::err_nan_to_logical_conversion (void)

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

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

this error fixed by

sudo apt-get install qttools5-dev-tools

Leave a Comment