Compiling on OpenBSD

From Octave
Jump to navigation Jump to search

This page lists specific instructions and issues with compiling the current development version of Octave on OpenBSD. The goal is for the issues listed here to be resolved so that compiling Octave on OpenBSD is as easy as it is for GNU/Linux and other Unixes.

Installing Dependencies

Install the dependency libraries and tools needed to compile Octave from the OpenBSD packaging system. As root, install the following:

 pkg_add GraphicsMagick curl fftw3 fftw3-float fltk gawk gfortran glpk gmake gnuplot gsed pcre qhull

The BLAS and LAPACK libraries are missing from the above list. This is because the OpenBSD packages have been built using an old version of g77 instead of gfortran. Therefore, both BLAS and LAPACK will have to be built from source with gfortran and installed on the system as shared libraries. Once the OpenBSD packages have been updated, they can be installed rather than from source.

If building Octave from a mercurial clone instead of a source archive, some additional tools are needed as well. As root, install the following:

 pkg_add autoconf automake bison gperf libtool

Workarounds for Building from Mercurial

If building from a mercurial clone, the source tree must first be bootstrapped. This relies on the additional GNU tools listed above. This step also requires the gnulib library to exist as a subdirectory of the Octave tree, or by passing --gnulib-srcdir to the bootstrap script. Some portability issues with gnulib on OpenBSD are currently being worked on, but once that is all worked out the version of gnulib mirrored in Octave's mercurial repository should work.


There is also a problem with the OpenBSD libtool package that fails to build Octave without some tweaks. After successfully running bootstrap, the build-aux/ shell script must be replaced with one from another system, for example from the Debian GNU/Linux libtool package.

And lastly, the versions of bison and flex available on OpenBSD are too old to work with features used by Octave. Newer versions will have to be installed, or the files produced by those tools need to be copied from another system. The files produced by bison and flex are normally distributed with the source archive, so this is only a problem with attempting to build from the Mercurial repository.

Configuring and Compiling Octave

Now configure and build Octave as normal, with additional options and search paths as needed. For example:

 ./configure \
     CPPFLAGS="-Dqh_QHpointer=1 -I/usr/local/include -I/usr/X11R6/include" \
     LDFLAGS="-L/usr/local/lib -L/usr/X11R6/lib" \
     --with-qhull=-lqhull6 \

The version of Qhull on OpenBSD needs to be used with the qh_QHpointer flag as shown above. The name of the library also needs to be specified since it is not found by Octave by default. The version of GNU Texinfo on OpenBSD is too old to build the Octave manual, so that will have to be disabled until the package is updated.

If BLAS and LAPACK were installed manually as shared libraries as described above, the path to the libraries needs to be passed to the build and in the environment as well. For example, using /opt:

 ./configure \
     CPPFLAGS="-Dqh_QHpointer=1 -I/usr/local/include -I/usr/X11R6/include" \
     LDFLAGS="-L/opt -L/usr/local/lib -L/usr/X11R6/lib" \
     --with-qhull=-lqhull6 \

Before compiling, the process limit for data segment size needs to be increased to enable the compiler to handle certain files in Octave's code base. This is done with the ulimit command before starting the build. So, once configured as above, run

 ulimit -d 8388608
 gmake check

to compile Octave and run the test suite.