Archive

Archive for the ‘Mac OS X Development’ Category

Compiling GAMIT & GLOBK 10.35 for Mac OS X 10.5-10.6

November 17th, 2009 Comments off

A post dedicated to help compiling GAMIT and GLOBK for Mac OS X 10.5 Leopard (PowerPC and INTEL) and 10.6 Snow Leopard (INTEL only).

GAMIT, GLOBK, and TRACK form a comprehensive suite of programs for analyzing GPS measurements primarily to study crustal deformation. The software has been developed by MIT, Scripps Institution of Oceanography, and Harvard University with support from the National Science Foundation (USA).

Pre-requirements

  • For Mac OS X 10.6.x: install Apple XCode Dev Tools 3.2.1 with X11 SDK
  • For Mac OS X 10.5.x: install Apple XCode Dev Tools 3.1.4 with X11 SDK
  • gfortran binaries

Download gfortran

Install the appropriate (INTEL or PowerPC) gfortran disk image for Mac OS X from:
http://gcc.gnu.org/wiki/GFortranBinaries

Download GAMIT/GLOBK

Download the source code of ‘GAMIT 10.35′ from MIT’s ftp-server with incremental updates (Registration required)

Change both install scripts to be executable


#chmod u+x install_software
#chmod u+x install_updates

Launch the install script ‘install_software’

This will decompress the *tar.gz files, with command:

# sudo install_software

You will get some errors with X11 missing etc. Don’t worry we will fix this right now.

Modify ‘libraries/Makefile.config’ for Mac OS X

Edit ‘libraries/Makefile.config’ with your favorite editor
Uncomment the topic specific to Mac OS X for X11LIBPATH and X11NCPATH to read:


# Specific for MacOSX
X11LIBPATH /usr/X11/lib
X11INCPATH /usr/X11/include/X11

Since Mac OS X 10.6 compiles by default in 64bit mode we need to add the “-m32″ CFLAGS option to keep 32bit mode compatibilty in Mac OS X 10.5 and 10.6, or else we get compiler errors.

We need also to update the OS_ID Darwin number to 1000 (for Snow Leopard compatibility):


#------ for Mac OSX 5.2-8.8.0 (10.4-10.6)
OS_ID Darwin 1000 9900
# ASSIGMENTS
### GCC V4 gfortran flags ###
FTN = gfortran
FFLAGS = -O3 -Wuninitialized -fno-f2c -ffast-math -fno-automatic -fno-backslash
CC = gcc
CFLAGS = -g -m32

# EXPLICIT_RULES
ranlib THELIB

# SUFFIX_RULES
.c.a:
$(CC) -c $(CFLAGS) -I$(II) $< ar rv $@ *.o
rm -f $*.o

.f.a:
$(FTN) -c $(FFLAGS) $<
ar rv $@ *.o
rm -f $*.o

# BLOCKEND

Relaunch the install script

Relaunching the install script will compile just fine GAMIT/GLOBK, with command:


# sudo install_software

Categories: Mac OS X Development Tags:

Compile WINE for Mac OS X 10.5 INTEL

December 19th, 2008 Comments off

Note: A much easier and faster method to install Tsoft on INTEL Mac is here!

You wish to run a particular Windows application on your INTEL Mac without launching a virtual machine (VM) like Parallels Desktop, vMWare Fusion or Sun’s VirtualBox ? At full speed ? Then enter WINE (WINE Is Not an Emulator).
From the webpage:

Wine is a translation layer (a program loader) capable of running Windows applications on Linux and other POSIX compatible operating systems. Windows programs running in Wine act as native programs would, running without the performance or memory usage penalties of an emulator, with a similar look and feel to other applications on your desktop.

 

For example if you need to check or analyze tide data with the Windows application TSOFT (a software package for the analysis of Time Series and Earth Tides) without launching the VMs you should try to install WINE on your Mac!
 

Running TSoft in WINE on Mac OS X Leopard

Running TSoft in WINE on Mac OS X Leopard

There are WINE binaries for Mac OS X INTEL available (Darwine) but these aren’t up to date with the latest source code, but it should work though. Another possibility to run a Windows application is to buy the commercial derivative of WINE called “Crossover” from Codeweaver.

But if you wish and prefer to install WINE from the latest source code on OS X Intel, please follow my instructions:

Requirements

  • A Mac INTEL computer with Mac OS X Tiger (10.4.x) or Leopard (10.5.x). WINE will not work on Mac with a PowerPC processor!
  • XCode 3.1.2 Developer Tools for Leopard or 2.4.1 for Tiger and X11 SDK installed. Free download of XCode here

Build instructions

Install the source code in the following order:

  1. GNU’s libtool (To build “jpeglib6″ we need the latest ‘GNU libtool’ since ‘libtool’ from /usr/bin on Mac OS X breaks ‘jpeg’ lib build). Download from here
  2. #tar -zxvf libtool-2.2.6a.tar.gz
    #cd libtool-2.2.6
    #./configure
    #make ; sudo make install
    #make clean

  3. Fontforge libraries. Download here
  4. JPEG library “jpeg6lib”. Download from here
  5. PNG library “libpng”. Download here
  6. FreeType 2.3.8 from here
  7. And finally the latest WINE source files (I succesfuly compiled WINE development version 1.1.12)
Categories: Mac OS X Development Tags: , ,

How to compile “NLLOC 5.0″ on Mac OS X

December 1st, 2008 Comments off

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

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
    # GNU_SOURCE=-D _GNU_SOURCE
    #
    # For Mac OS X uncomment the next line or else you will get "open_memstream" errors:
    GNU_SOURCE=

  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)