Skip to content
Latchkey

Octave mkoctfile compiler / .oct build error in CI

mkoctfile compiles a C/C++ oct-file against Octave headers. On a minimal runner the compiler or the Octave development headers are missing, so the build fails before producing the .oct.

What this error means

A mkoctfile myfunc.cc step fails with "g++: command not found", "mkoctfile: command not found", or a fatal error about a missing octave/oct.h header.

Octave
fatal error: octave/oct.h: No such file or directory
compilation terminated.
mkoctfile: building exited with failure status

Common causes

No C++ compiler or mkoctfile on the runner

A minimal Octave install omits mkoctfile and the compiler, so oct-file builds cannot run.

Missing Octave development headers

The octave/oct.h header comes from the Octave dev package; without it the compile fails.

How to fix it

Install the compiler and Octave dev headers

  1. Install a C++ compiler and the Octave development package.
  2. Confirm mkoctfile --version works.
  3. Build the oct-file.
Terminal
sudo apt-get update
sudo apt-get install -y build-essential liboctave-dev
mkoctfile myfunc.cc

Cache built oct-files

Persist compiled .oct artifacts between runs so the build only happens when sources change.

.github/workflows/ci.yml
- uses: actions/cache@v4
  with:
    path: '**/*.oct'
    key: oct-${{ hashFiles('**/*.cc') }}

How to prevent it

  • Install build-essential and liboctave-dev before any mkoctfile build.
  • Cache compiled oct-files keyed on the source hash.
  • Bake the toolchain into a custom image for self-hosted runners.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →