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.
fatal error: octave/oct.h: No such file or directory
compilation terminated.
mkoctfile: building exited with failure statusCommon 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
- Install a C++ compiler and the Octave development package.
- Confirm
mkoctfile --versionworks. - Build the oct-file.
sudo apt-get update
sudo apt-get install -y build-essential liboctave-dev
mkoctfile myfunc.ccCache built oct-files
Persist compiled .oct artifacts between runs so the build only happens when sources change.
- uses: actions/cache@v4
with:
path: '**/*.oct'
key: oct-${{ hashFiles('**/*.cc') }}How to prevent it
- Install
build-essentialandliboctave-devbefore any mkoctfile build. - Cache compiled oct-files keyed on the source hash.
- Bake the toolchain into a custom image for self-hosted runners.