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 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.
Terminal
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.
.github/workflows/ci.yml
- 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.
Related guides
Octave "package X is not installed" (pkg load) in CIFix Octave "error: package X is not installed" in CI - pkg load needs the package installed first with pkg in…
Octave "octave: command not found" in CIFix "octave: command not found" in CI - GNU Octave is not installed on the runner. Install it via apt or an O…
MATLAB mex "No supported compiler was found" in CIFix MATLAB mex "No supported compiler was found" in CI - building a MEX file needs a C/C++ compiler that the…