Building gmt-mex for Octave¶
The GMT/MATLAB toolbox also works in Octave (4.0.x) but seems less stable than the MATLAB version. First make sure you have installed Octave and the mkoctfile executable (usually distributed via a liboctave-dev package, such as under Ubuntu). The steps to build gmt-mex against Octave should ideally be similar under any UNIX/Linux system, including OS X):
- Install the GMT 5.3.1 from apt-get or build from source via the main GMT Download page.
- Obtain the gmt-mex source code: cd into a suitable directory for development (e.g., GMTdev) and run
svn co svn://gmtserver.soest.hawaii.edu/gmt-mex/trunk gmt-mex
- Make sure GMT 5.3.1 is in your path; Use gmtswitch to select your active GMT version if you have more than one installed (see the gmtswitch documentation if you have never used this facility before).
- In the gmt-mex directory, run
autoconf ./configure --enable-octave
- Then cd into src and run
make all make installThis should build the gmtmex.mex application, which is needed by the gmt.m script you will be using, and install them with the rest of the GMT executables.
- Add the GMT path to your Octave path, or alternatively copy these two files to a place where Octave can find them.
- If your GMT libraries are not in the standard directories you need to run
export LD_LIBRARY_PATH=<path-to-libgmt.so-dir>to include the path to libgmt.so.
- Start Octave and type "gmt"