Compiling on OpenBSD

From Octave
Revision as of 03:39, 12 August 2013 by Mtmiller (talk | contribs) (→‎Configuring and Compiling Octave: Add note about memory resource limitations)
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

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 \
     --disable-docs

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:

 LD_LIBRARY_PATH=/opt; export LD_LIBRARY_PATH
 ./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 \
     --disable-docs

If building from a mercurial clone, the source tree must be bootstrapped before running configure. This 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.

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
 gmake check

to compile Octave and run the test suite.