How to compile GAMIT/GLOBK v10.21 on Mac OS X (PowerPC)

Note: Article to compile GAMIT/GLOBK v10.3.x on Mac PPC & Intel here. It’s much easier now to compile.

GAMIT and GLOBK are a comprehensive suite of programs for analyzing GPS measurements primarily to study crustal deformation.This page is a resource to compile and install GAMIT/GLOBK for Mac OS X.

Installation instructions for GAMIT/GLOBK 10.21 (PowerPC)

Software Requirements:

  • Apple XCode development environment (Xcode 2.4.1 for Mac OS X 10.4.x)
  • Apple X11 installed in /Applications/Utilites (from your Mac OSX Install DVD/CD)
  • A FORTRAN compiler customized GNU Fortran g77 (do not use Fink’s g77 in /sw/bin/)
  • A user with ‘Admin’ rights

We first need to install Apple’s XCode development environment, then build a customized GNU77 Fortran, edit some GAMIT/GLOBK config files to get a succesful compilation.

Apple XCode installation

  1. Download and install the latest Apple XCode development environment (free registration required) from Apple’s Developer Connection website.
  2. Open ‘Terminal’ (from /Applications/Utilities/)

Built a customized GNU77 FORTRAN compiler (for PowerPC Macs only !!!)

This process is necessary as the default version of gcc/g77 only allows a maximum unit number (MXUNIT) of 99, while GLOBK requires a MXUNIT of 9999.Create the installation directory for your FORTRAN compiler:
% mkdir /usr/local/g77
Download gcc version 3.4.6 (latest version in the 3.4 tree)

Unzip and untar the source in your download directory:
% tar -xvfz gcc-3.4.6.tar.gz

%cd gcc-3.4.6

Increase g77 MXUNIT to 10000

Modify libI77/fio.h fortran include file to allow access to 10000 unit numbers :

% vi libf2c/libI77/fio.h

Replace line:
#define MXUNIT 100

With line:

#define MXUNIT 10000

Make the build directory and run configure:
% mkdir objdir

% cd objdir

% ../configure –prefix=/usr/local/g77/

Build GCC/G77

% make

Install GCC/G77

% make install
The executables/binaries are now installed in the directory /usr/local/g77/bin/

Download and install GAMIT/GLOBK

Now that you have installed the FORTRAN compiler, download the source files, request your download form here.

Create a directory in /usr/local/gamit with:

%sudo mkdir /usr/local/gamit

%cd /usr/local/gamit

Download GAMIT sources via ftp. Ftp server address provided by the request form.Change ‘install_software’ and ‘install_updates’ as executables:

%chmod ug+rx /usr/local/gamit/install*

Launch ‘install_software’ to decompress all the *.tar files:

Just say “yes” to decompress com.10.21.tar.Z etc. and for X11 PATH.

Now that all the files are decompressed we can replace ‘com/unimake‘ and ‘libraries/Makefile.config‘ with the new ones.

Install updated ‘unimake’ & ‘Makefile.config’ for Mac OS X

    • Download unimake.gz
    • Decompress it with command:
    • #gunzip unimake.gz and move it to /usr/local/gamit/com/
    • Download Makefile.config.gz
    • Decompress it with command:
    • #gunzip Makefile.config and move it to /usr/local/gamit/libraries

    Restart ‘./install_software’ again, and it should compile and install fine.

    Stop here! If you want to get the big picture of what has been changed:

    Edit libraries/Makefile.config

    1. Change OS_ID number for Darwin

    If it stops after a few seconds with error message:

    OSID Darwin 8700 not found in Makefile.config – remove Makefile and STOP Failure in make_gamit — install_software terminated,

    then we need to edit libraries/Makefile.config and change the line 329 from:

    OS_ID Darwin 5200 8500
    OS_ID Darwin 5200 9900

    so it will compile correctly for the next MacOSX versions up to OSX 10.5.9 🙂

    Note: You get the OS_ID number with command ‘uname -a’, e.g:Mac OS X version 10.4.7 is 8.7.0

    2. Remove optimization options -O3

    Remove the optimization options -O3 or else we will get errors compiling ‘glorg’ in directory ‘kf’.

    The section of ‘OS_ID Darwin’ should look like this:

    #------ for Mac OSX 10.2 til Mac OSX 10.5.9-----
    OS_ID Darwin 5200 9900
    # ASSIGMENTS -- removed optimization "-O3 -Wuninitialized" or else problems compiling "kf/glorg"
    FFLAGS = -Wunused -Wimplicit -fno-f2c -fno-automatic -fno-backslash -Wno-globals -fno-globals
    # Fortran compiler it points to
    FTN = /usr/local/g77/bin/g77
    CFLAGS = -g
    CC = gcc
    # SUFFIX_RULES.c.a:$(CC) -c $(CFLAGS) -I$(II) $< ar rv $@ *.orm -f $*.o.f.a:$(FTN) -c $(FFLAGS) $<ar rv $@ *.orm -f $*.o# BLOCKEND

    3. Change absolute PATH of your customized g77

    Change also the line 333 of FTN to have the absolute PATH for g77 binary (in section ‘OS_ID Darwin’)

    FTN = /usr/local/g77/bin/g77

    If you restart again ‘./install_software’, after a while you will get the following error message:

    /usr/bin/ld: Undefined symbols:_printf$LDBLStub_scanf

    $LDBLStubcollect2: ld returned 1 exit statusmake: *** [makex] Error 1

    Then we need to edit the file com/unimake

    Edit com/unimake

    To compile correctly we just need to append the ‘-lSystemStubs’ library to ‘com/unimake’.

    Change lines 342 to 345 from ‘com/unimake’ (after ‘if ( $mainext == ‘f’ ) then” to:

    if ( $os[1] == 'Darwin' ) then
    #echo "Darwin"
    echo " #(FTN) #(FFLAGS) $mainfull $libnam #(SLIB) -L#(X11LIB) -lX11 -o $execs[$i]$ext -lSystemStubs" | tr '#' '$' >> Makefile
    echo " #(FTN) #(FFLAGS) $mainfull $libnam #(SLIB) -L#(X11LIB) -lX11 -o $execs[$i]$ext " | tr '#' '$' >> Makefile
    endif # Darwin
    else if ( $mainext == 'c' ) then
    echo " #(CC) #(CFLAGS) $mainfull -L#(X11LIB) -lX11 -o $execs[$i]$ext " | tr '#' '$' >> Makefile
    elseif ( $mainext == 'f' ) then
    if ( $os[1] == 'Darwin' ) then #echo "Darwin2"
    echo " #(FTN) #(FFLAGS) $mainfull $libnam #(SLIB) -o $execs[$i]$ext -lSystemStubs" | tr '#' '$' >> Makefile
    echo " #(FTN) #(FFLAGS) $mainfull $libnam #(SLIB) -o $execs[$i]$ext " | tr '#' '$' >> Makefile
    endif # Darwin

    Relaunch install_software

    Launch install_software again, and it should compile fine.

    Comments are closed.