Building gmt-mex under LInux¶
We have not been successful building the gmt-mex under Linux. Here is an example of what we have tried under ubuntu. The steps to build gmt-mex should ideally just be these (under any UNIX/Linux system, including OS X):
- Install the GMT 5.3.2 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.2 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-matlab
- Then cd into src and run
make all make installThis should build the gmtmex.mexa64 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 MATLAB path, or alternatively copy these two files to a place where MATLAB 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 MATLAB and type "gmt"
On my system I get the friendly message
Invalid MEX-file '/home/pwessel/GMTdev/gmtmex/trunk/src/gmt.mexa64': /usr/lib/libgdal.so.1: undefined symbol: _ZN11xercesc_3_111InputSource11setEncodingEPKt
which gives the clue that there maybe a conflict between the xerces library linked to by gdal and the one loaded by MATLAB. More Linux-savvy types can possibly figure this out.