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):

  1. Install the GMT 5.3.2 from apt-get or build from source via the main GMT Download page.
  2. Obtain the gmt-mex source code: cd into a suitable directory for development (e.g., GMTdev) and run
    svn co svn:// gmt-mex
  3. 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).
  4. In the gmt-mex directory, run
    ./configure --enable-matlab
  5. Then cd into src and run
    make all
    make install
    This 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.
  6. Add the GMT path to your MATLAB path, or alternatively copy these two files to a place where MATLAB can find them.
  7. If your GMT libraries are not in the standard directories you need to run
    export LD_LIBRARY_PATH=<>
    to include the path to
  8. 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/ undefined symbol:

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.