Install Doris 4.0 on Mac OS X

This is a quick guide on how to install Doris 4.0.6-beta2 on Mac OS X 10.6 or later

Updated on Tue, March 25, 2014:
Updated on Fri, March 14, 2014:
  • Added note about WARNING errors when using gcc++ 4.8 or Xcode 5.1 clang++ compiler
  • Modified the ‘Makefile’ to take into account gcc++ 4.7 from Macports
  • Modified Makefile to take into account OS X built-in VecLib library

Getting started

This post will show how to install Doris 4.0.6-beta2 compiled with LAPACK and FFTW3 libraries on Mac OS X.

Doris 4 is a standalone program that can perform most common steps of the interferometric radar processing in a modular setup.

Installation instructions

At a glance

  • Install Xcode from Apple’s Developer Website or from Mac App Store (free)
  • After Xcode has been installed, and launched we need to install Xcode’s Command Line Tools Package
  • Install Macports.
  • With macports and Xcode’s Command Line Tools installed, we need to install gcc++ 4.7 compiler. Do not install gcc++4.8 since ‘doris 4.06-beta2’ will give you a lot of WARNING errors, like: WARNING : Unknown keyword: “OMMENT” and stops processing files. This will likely be fixed in future revisions of doris.
  • Download doris v4.06-beta2 and edit or replace the ‘Makefile’ to allow compiling with macport’s version of gcc++4.7 and use LAPACK library support
  • Compile and install doris

Detailed installation instructions

Install Xcode and its Command Line Dev Tools

To be able to install and use Macports you first need Apple developer tools, named Xcode. For OS X 10.6 the last version is Xcode 4.6 and for OS X 10.7 and later, it’s Xcode 5.x. You can download it from Apple’s Developer site (free registration required) or if you have OS X version >= 10.7 directly from the Mac App Store.

After that you need to install also Xcode’s Command Line Tools package to allow compilation within your Terminal.app, This will be used mainly to allow proper building gcc++4.7 ports of Macports.

On OS X 10.9: The Command Line Developer Tools package can be installed on demand using command in Terminal.app:


#xcode-select --install

and the installed tools will be automatically updated using Software Update.

For earlier OS X versions, continue to use the in-app download in Xcode.

Install Macports

Macports will install the ‘port’ command for Terminal.app.

Usually all Macports binaries will be installed in /opt/local/bin/ so your .bashrc file will be updated when installation finished to have /opt/local/bin in your path.

Install gcc4.7 from Macports

To compile doris 4.06-beta2 we need to install gcc4.7, since Apple’s Xcode 5.1 or gcc4.8 will give you a lot of WARNING errors

First, it’s good practice to update Macports database, so invoke the command ‘port selfupdate’


#sudo port selfupdate

Then install gcc47:

#sudo port gcc47

Install the Fast Fourier Transform fftw-3-single library from Macports

To succesfully compile Doris 4 we need the single precision fftw-3-single port or else it will fail.

Doris 4.06-beta2 uses fftw-3 float mode which refers to fftw-3-single on Macports.

If you check the Portfile here and look at the line ‘configure.args’, you’ll see:–enable-float

Type the following command on Terminal.app:


#sudo port install fftw-3-single

Download Doris 4.06-beta2

Doris 4.0.6-beta2 can be downloaded here

Decompress the .tar.gz archive and go in the Doris ‘src/’ directory.

Here I’m using Doris 4.0.6-beta2:

#cd ~/Downloads/doris_v4.06-beta2/src

In the src directory is a ./configure script. This script is by default for Linux and other Unixes but it doesn’t allow to enter and edit Mac OS X ‘Accelerate framework’.

So just execute the ./configure script anyway (it will fail to compile, but read on):

The ‘./configure’ script will create the Makefile for you and we need to manually edit it:

After edit the Makefile and change the following lines:

Use of Macports gcc++ 4.7 compiler, so it should read:

CC = /opt/local/bin/g++-mp-4.7

Find and edit the line with ‘DEFS’, it should read:

DEFS = $(DEF4) $(DEF5) -D__USE_FFTW_LIBRARY__ -D__USE_LAPACK_LIBRARY__ -D__X86PROCESSOR__ -I/opt/local/include

You can even optimize Doris by using CFLAGSOPT with -O3 (and it doesn’t crash 😉

CFLAGSOPT = -O3 $(DEFS)

then find the line with ‘LFLAGS’:

LFLAGS = -L/opt/local/lib -lfftw3f -lm -framework Accelerate

and finally find the line ‘EXECUTABLES’:
We need to reorder the compilation link by setting $(LFLAGS) at the end -o $@ $(LFLAGS), or else we get compilation errors.


$(EXECUTABLE): $(SWOBJS) tmp_strptime.cc slcimage.cc productinfo.cc orbitbk.cc
$(CC) $(CFLAGS) -c -o triangle.o -DTRILIBRARY -DANSI_DECLARATORS triangle.c
$(CC) $(CFLAGS)\
tmp_strptime.cc $(SWOBJS) triangle.o\
slcimage.cc productinfo.cc orbitbk.cc\
-o $@ $(LFLAGS)
@echo " "
@echo "*******************************"
@echo "* ...Compilation finished... *"
@echo "*******************************"
@echo " "

Full Makefile for Doris 4.06-beta2 for Mac OS X

Copy / paste the following code to replace ‘Makefile’ in Doris 4 ‘src’ directory

Edit the current ‘Makefile’ with any good text editor (like BareBones free TextWrangler) and replace the old Makefile contents with the following code:


#########################################################################
# Makefile for the Doris software. #
# Created by: configure #
# 04-Dec-1998 #
# #
# Delft University of Technology #
# Delft Institute of Earth Observation and Space Systems #
# http://doris.tudelft.nl #
# See also the user manual, annex installation. #
# #
### Usage ### #
# The command: "make" creates and optimized version of doris. #
# The command: "make install" installs it andcleans up. #
# If this does not work, try a more controlled approach by: #
# #
# 0. inspect set up of this Makefile #
# 1. set CC DEFS LIBS etc., first set these to debug values #
# (read NOTE there if problems) #
# 2. compile software sources to *.o: "make swobjs" #
# 3. link object together to executable: "make doris" #
# 4. install executable: "make install" #
# 5. remove object files: "make clean" #
# #
# BTW. "make" does "swobjs doris" by default. #
# #
### #
# Successfully tested for compilers/platforms: #
# GNU g++ version 2.7.2.2 on HP-UX B.10.20 A 9000/785 #
# GNU g++ version 2.95.2 on HP-UX B.10.20 A 9000/785 #
# HP aCC version A.01.07 on HP-UX B.10.20 A 9000/785 #
# GNU g++ version ? on Linux X86 #
# SGI ? #
# Sun Studion 9,10,11 on Solaris Sparc and X86/AMD64 #
# GNU g++ versions v3.4, v4.0, v4.1, v4.2, v4.3 on Linux X86 and AMD64 #
# Sun Sudion v11 on Linux AMD64 #
# Intel Compilers v9, v10, v11 on Linux AMD64 #
#########################################################################
###################################################################
###################################################################
# Please change if required: DEF[1-6], CC, CFLAGS, LIBDIR, ###
###################################################################
### The shell used by this makefile ###
SHELL = /bin/sh

### Specify compiler/installation directory ###
INSTALLDIR = /usr/local/bin

# Gilles - Use macports gcc4.7 compiler (instead of Xcode 5.1 clang compiler) to avoid doris read errors
# like WARNING : Unknown keyword: "OMMENT" at line: 8.
CC = /opt/local/bin/g++-mp-4.7
SCRIPTSDIR = ../bin

### Define statements controlling compilation ###
# Comment out DEF[1-8] statements when appropriate.
DEF1 = -D__DEBUGMAT1 # -1- range checking in matrix class
DEF2 = -D__DEBUGMAT2 # -2- info matrix class (debug only)
DEF3 = -D__DEBUG # -3- debug for other files
DEF4 = -Wno-deprecated # -4- do not display warnings due to depricated entries
DEF5 = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE # -5- support for large files
DEF6 = -DNO_FASTTRIG # -6- extra functional switches

#DEF9 = -D__NO_IOS_BINARY__ # -9- comment out if you ios::binary (most will)
#
### Do not change following 2, simply comment DEF1-8 above
DEFSDEBUG = $(DEF1) $(DEF2) $(DEF3)
#DEFS = $(DEF4) $(DEF5) $(DEF6) -D__USE_FFTW_LIBRARY__ -D__X86PROCESSOR__ -I/opt/local/include

# Gilles - 2014.03.25: Don't use VECLIB, since this crashes Doris v4.06-beta2 on OS X
# However using Optimization -O3 with FFTW lib and LAPACK lib seems fine
DEFS = $(DEF4) $(DEF5) -D__USE_FFTW_LIBRARY__ -D__USE_LAPACK_LIBRARY__ -D__X86PROCESSOR__ -I/opt/local/include

### NOTE ###
# If you get warnings like the following (I got them with g++, not with aCC)
# then use define __GNUC__ to define these functions
#%// BK 15-Aug-2000
#In file included from matrixbk.h:38,
# from processor.cc:23:
#constants.h: In method `real8 cn::dist(cn) const':
#constants.h:106: implicit declaration of function `int sqr(...)'
### END NOTE ###

# LOCAL dir
LOCAL_INSTALLDIR = ../bin

### CFLAGS ###
# Compiler options flag ###
# Specify compiler flags (I selected these for g++)
CFLAGSDEBUG = -g -O $(DEFS) $(DEFSDEBUG)
#CFLAGSOPT = -O $(DEFS)
#CFLAGSOPT = -O2 $(DEFS) # this crashed doris! (?)
CFLAGSOPT = -O3 $(DEFS) # this crashed doris! (?)

### CCNOTE ###
### Change here ###
### set CFLAGS depending on if you compile debug version or working version ###
#CFLAGS = $(CFLAGSDEBUG)
CFLAGS = $(CFLAGSOPT)
### END CCNOTE ###

### Library locations flag ###
### -lcl : used for veclib (don't use -lcl on Mac OS X)
### -framework Accelerate: for Mac OS X LAPACK lib
### -lm : used for fftw
LFLAGS = -L/opt/local/lib -lfftw3f -lm -framework Accelerate

#####################################################
### No need to change anything below here... ####
#####################################################
EXECUTABLE = doris

SWSRCS = processor.cc \
utilities.cc \
ioroutines.cc \
readinput.cc \
readdata.cc \
coregistration.cc \
filtering.cc \
referencephase.cc \
products.cc \
geocode.cc \
unwrap.cc \
matrixspecs.cc \
exceptions.cc \
estorbit.cc
SWOBJS = $(SWSRCS:.cc=.o)

### scripts of doris.tar in SCRIPTSDIR, used at make install
SCRIPTS = helpdoris \
baseline.doris.sh \
baseline.doris.csh \
construct_dem.sh \
coregpm.doris \
doris* \
heightamb \
phasefilt.doris \
plotcpm* \
plotoffsets* \
run \
viewanddel \
cpx2ps \
lonlathei2ascii \
ascii2ascii_UTM \
ascii2ps* \
tsx* \
rs2* \
csk* \
gammaReadfiles.csh \
hhmmss2sec.py \
sec2hhmmss.py

#####################################################
### And no need to change anything below here... ####
#####################################################
### what to do if make w/o arguments ###
# first make all object files, then link them together
default: $(EXECUTABLE)

### how to compile object code .o from C++ source files .cc (general rule) ###
# space between -o and filename for SUN make (BK 7 july 2000)
.cc.o:
$(CC) $(CFLAGS) -c -o $(@) $< ##################################################### ### Make object code from source ### swobjs: $(SWOBJS) ### Load objects to executable ### ### The added .cc files contain class definitions ### matrixclass is explicitly included ### in the source code since we had some problems finding out how to do that ### here, since compilers treat the template class differently than normal classes. ### BK 07-Feb-2002 #$(EXECUTABLE): $(SWOBJS) tmp_strptime.cc slcimage.cc productinfo.cc orbitbk.cc # $(CC) $(CFLAGS) -c -o triangle.o -DTRILIBRARY -DANSI_DECLARATORS triangle.c # $(CC) $(CFLAGS)\ # tmp_strptime.cc $(SWOBJS) triangle.o\ # slcimage.cc productinfo.cc orbitbk.cc\ # $(LFLAGS) -o $@ # @echo " " # @echo "*******************************" # @echo "* ...Compilation finished... *" # @echo "*******************************" # @echo " " $(EXECUTABLE): $(SWOBJS) tmp_strptime.cc slcimage.cc productinfo.cc orbitbk.cc $(CC) $(CFLAGS) -c -o triangle.o -DTRILIBRARY -DANSI_DECLARATORS triangle.c $(CC) $(CFLAGS)\ tmp_strptime.cc $(SWOBJS) triangle.o\ slcimage.cc productinfo.cc orbitbk.cc\ -o $@ $(LFLAGS) @echo " " @echo "*******************************" @echo "* ...Compilation finished... *" @echo "*******************************" @echo " " ### Install executable in installdir ### install: $(EXECUTABLE) @echo "* Installing $(EXECUTABLE) in: $(INSTALLDIR)" @cp -f $(EXECUTABLE) $(INSTALLDIR)/. ( cd $(SCRIPTSDIR); cp -f $(SCRIPTS) $(INSTALLDIR)/. ) $(MAKE) cleaner -f $(MAKEFILE_LIST) @echo " " @echo "*******************************" @echo "* ...Installation finished... *" @echo "*******************************" @echo " " @echo "* Check that $(INSTALLDIR) is in your path search: echo \$$PATH ." @echo " " installcb: $(EXECUTABLE) @echo "* Installing $(EXECUTABLE) in: $(LOCAL_INSTALLDIR)" @cp -f $(EXECUTABLE) $(LOCAL_INSTALLDIR)/. $(MAKE) cleaner -f $(MAKEFILE_LIST) @echo " " @echo "*******************************" @echo "* ...Installation finished... *" @echo "*******************************" @echo " " @echo "* Check that $(LOCAL_INSTALLDIR) is in your path search: echo \$$PATH ." @echo " " ##################################################### ### Testers ### test: testdoris testdoris: $(EXECUTABLE) @echo " " @echo "* Executing command: $(EXECUTABLE) -v" $(EXECUTABLE) -v @echo " " ### Orbit test program for debugging ### test-orbit: ioroutines.o matrixspecs.o utilities.o exceptions.cc slcimage.cc orbitbk.cc matrixbk.cc bk_messages.hh $(CC) $(CFLAGS) -D__TESTMAIN__ \ ioroutines.o matrixspecs.o utilities.o exceptions.cc slcimage.cc orbitbk.cc \ $(LFLAGS) \ -o $@ ### Matrix test program for debugging ### ### fast_sin defined in utilities.cc, which requires ioroutines, which, etc. test-matrix: matrix_test.cc matrixspecs.o utilities.o utilities.o ioroutines.o matrixbk.cc $(CC) $(CFLAGS) matrix_test.cc matrixspecs.o \ utilities.o ioroutines.o exceptions.cc orbitbk.cc \ $(LFLAGS) \ -o $@ @echo " " ##################################################### ### Cleaners ### clean: cleanswobjs cleaner: clean cleanprog cleanest: clean cleanprog uninstall cleanprog: @rm -f $(EXECUTABLE) $(EXECUTABLE.debug) \ matrixbk_test testorbit @echo "* Removed executables in current dir." cleanswobjs: @rm -f $(SWOBJS) matrixbk_test.o orbitbk.o slcimage.o triangle.o @echo "* Removed object files." uninstall: @rm -f $(INSTALLDIR)/$(EXECUTABLE) @echo "* Removed executables in install dir: $(INSTALLDIR)." ### BK 12-Dec-2000 ###

Compile DORIS

If you've copy / pasted the above code to the Makefile in doris 'src' directory we just need to compile.

The above code will link to the following libraries: VECLIB, LAPACK 3.2.1 and FFTW3.
VECLIB and LAPACK 3.2.1 are by part of the Accelerate framework on Mac OS X.

Just do:

#cd src
#make
#sudo make install

Doris will be installed in /usr/local/bin

Install ENVISAT_TOOLS

To install the ENVISAT_TOOLS, it’s easy:


#cd ENVISAT_TOOLS
#make
#sudo make install

The ENVISAT_TOOLS (envisat_dump_data etc.) will be installed in /usr/local/bin

Install SAR_TOOLS

To install the SAR_TOOLS, it’s easy:


#cd SAR_TOOLS
#make
#sudo make install

The SAR_TOOLS (cpxfiddle) will be installed in /usr/local/bin

Enjoy!

Comments are closed.