How to compile “NLLOC 5.0” on Mac OS X

The NonLinLoc (Non-Linear Location) package by Anthony Lomax, is a set of programs for velocity model construction, travel-time calculation and probabilistic, non-linear, global-search earthquake location in 3D structures, and for visualisation of 3D volume data and location results. Many of the programs operate with a 3D Grid structure which defines a specific, gridded, rectangular volume (Non-GLOBAL mdoe) or spherical section (GLOBAL mode).

More info on Anthony Lomax website

Compiled an tested on INTEL-Mac with Mac OS X 10.5.5 and Apple XCode 3.1.1 developer tools This works also on Mac OS X 10.6 Snow Leopard

Download the tar-gzipped (.tgz) NonLinLoc Software file on your Mac and decompress it with:

#mkdir NLLoc-5.0-MacOSX
#mv NLL5.00_src.tgz
#cd NLLoc-5.0-MacOSX
#tar -zxvf NLL5.00_src.tar.gz

The uncompressed file should create a “src” directory inside the “NLLoc-5.0-MacOSX” directory. Now we just need to get into the “src” directory and edit some files (Makefile, nrutil.c and Time_3d.c).

#cd src

Open up “TextEdit” or download the free and great “TextWrangler” and follow these steps:

  1. In “nrutil.c” remove line or comment #include <malloc.h>
  2. In “Time_3d.c” remove line or comment #include <malloc.h>
  3. In “Makefile” change “BINDIR=” to #BINDIR=. (or else we get errors “ld: in bin/Grid2GMT, can’t link with a main executable”)
  4. In “Makefile”: to avoid “open_memstream” errors, edit section “Custom Builds”:
    The line should look like “GNU_SOURCE=”  (and not “GNU_SOURCE=-D _GNU_SOURCE”)

  5. # Custom builds
    # For GNU (LINUX) uncomment this line
    # For Mac OS X uncomment the next line or else you will get "open_memstream" errors:

  6. Then compile the whole stuff in ROOT mode:
  7. #sudo make all

  8. Copy all your files to “/usr/bin” or “/usr/local/bin” (as you whish but don’t forget to update your PATH in .bash_profile or .bashrc in your HOME directory)

Comments are closed.