From XastirWiki
Jump to: navigation, search

This guide gives step-by-step instructions for installing Xastir from source on OS X 10.5.6 with GraphicsMagick, pcre/dbfawk, rtree, internet maps (libcurl), libproj and GeoTiff (USGS Topos & Aerial Photos).

Edits I made on Feb 16, 2010 include changes needed for OS X 10.6.2 and adding Oracle Berkeley DB. Dick R - KC8OBZ.

Install XASTIR and Dependencies

Install Build Tools

You will need Xcode Developer Tools to compile Xastir. This can be downloaded from Apple, or installed via the Leopard DVD that came with your Mac. I chose to download the newest package, but it's about 1GB, so I recommend using your DVD.

The Snow Leopard DVD also contained a copy of Xcode Developer Tools, but running Apple Software Update updated it almost immediatly, so it may be easier to simply install the latest from Apple as described below.

Also, Apple recommends doing a Software Update after any major upgrade.

Downloading Xcode 3.1.2 Developer Tools (newest as of 4/15/2009)

  • Go to http://connect.apple.com
  • Log in with your Apple Developer Connection account
  • Click Downloads, then Developer Tools
  • Scroll to "Xcode 3.1.2 Developer Tools" and download the disk image

Install X11

Leopard (and Snow Leopard) includes X11 by default, so you don't have to worry about this anymore. If you're using an older version of OS X, X11 should be available on your OS X installation media.

Install Fink

Some people have reported problems with Fink. I haven't encountered any yet so I still use it. Fink is a package manager that will keep you from having to build all the Xastir dependencies from source.

I also continue to use fink. I have had problems with FinkCommander (the GUI interface for Fink) but the core utilities continue to work fine. Dick.

Install OpenMotif

or use Fink.

 fink install openmotif4

Install pcre

I'm lazy, so I installed pcre with fink:

  • In Terminal:
 sudo apt-get install pcre

OR

 fink install pcre

Alternatively, you can install this from source.

Install GraphicsMagick

I installed this one from source.

 tar zvxf GraphicsMagick-1.3.5.tar.gz
 cd GraphicsMagik-1.3.5
 ./configure --without-perl
 make
 sudo make install

I used fink successfully.

 fink install graphicsmagick graphicsmagick-dev

Install libGeoTiff (Optional, provides support for USGS DRGs)

libGeoTiff depends on libtiff and proj. I installed these with fink:

  • In Terminal
 sudo apt-get install libtiff proj

To install libGeoTiff:

 tar zvxf libgeotiff-1.2.5.tar.gz
 cd libgeotiff-1.2.5
 ./configure --with-libtiff=/sw --with-proj=/sw
 make
 sudo make install

Install Oracle Berkeley DB (Optional, provides map caching from internet sources)

  • In Terminal
 fink install db48

Get Xastir from CVS

  • Prepare your .cvsrc if you don't have one
 ls -l ~/.cvsrc
 # DO NOT DO THE STEPS BELOW IF THE COMMAND ABOVE SHOWS THAT YOU ALREADY HAVE ONE
 cat > ~/.cvsrc
 cvs -z3
 update -P -d
 status -v
 diff -u
 type control-D to finish creating the file
  • Get the source code per README.CVS or Notes:CVS:

You can make different choices here for where you want to store your code. I'm putting it in a tree under my home directory:

  mkdir src
  mkdir src/XASTIR
  cd src/XASTIR
  cvs -d:pserver:anonymous@xastir.cvs.sourceforge.net:/cvsroot/xastir login
  cvs -d:pserver:anonymous@xastir.cvs.sourceforge.net:/cvsroot/xastir co xastir

The "login" line will result in a prompt for a password. Simply hit "Enter" here, as there is no password.

The last command could take a while to finish if you're on a slow link, as there are a lot of files to download.

Build Xastir

I prefer to use the update-xastir script to update/configure/build/install xastir because it is only one command. For this to work, you will need to edit the ./configure line in update-xastir.

  • Open update-xastir with your favorite text editor
 mate ~/src/XASTIR/update-xastir
 nano comes installed with OS X, so I use it.  Dick.
  • Go to line 34 (or the line near it with ./configure)
  • Change ./configure to:
 ./configure --with-motif-includes=/usr/OpenMotif/include/ --with-motif-libs=/usr/OpenMotif/lib/
  • Save and close update-xastir

Here is the major difference for compiling on Snow Leopard.

Snow Leopard wants to compile everything in 64 bit and complains because fink loaded libraries are 32 bit. To force Snow Leopard to compile in 32 bit mode change the configure command to this:

 (./configure CFLAGS="-O -arch i386" CXXFLAGS="-O -arch i386" LDFLAGS="-arch i386" --disable-dependency-tracking --with-bdb-incdir=/sw/include/db4 --with-bdb-libdir=/sw/lib 2>&1) | tee -a make.log

This also tells configure to find the Oracle Berkeley DB that we added earlier. Dick.

Now we're ready to build.

 cd ~/src/XASTIR
 ./update-xastir

Just before being prompted for your sudo password, you should see this:

 xastir 1.9.5 has been configured to use the following
 options and external libraries:
 
 MINIMUM OPTIONS:
   ShapeLib (Vector maps) ................. : yes
 
 RECOMMENDED OPTIONS:
 -n   GraphicsMagick/ImageMagick (Raster maps) : 
 yes (GraphicsMagick)
   pcre (Shapefile customization) ......... : yes
   dbfawk (Shapefile customization) ....... : yes
   rtree indexing (Shapefile speedups) .... : yes
   map caching (Raster map speedups) ...... : no
   internet map retrieval ................. : yes (libcurl)
 
 FOR THE ADVENTUROUS:
   AX25 (Linux Kernel I/O Drivers) ........ : no
   libproj (USGS Topos & Aerial Photos) ... : yes
   GeoTiff (USGS Topos & Aerial Photos) ... : yes
   Festival (Text-to-speech) .............. : no
   GDAL/OGR (Obtuse map formats) .......... : no
   GPSMan/gpsmanshp (GPS downloads) ....... : no
 

Here is my Xastir summary for the options that I use. Dick.

 xastir 1.9.9 has been configured to use the following
 options and external libraries:
 
 MINIMUM OPTIONS:
   ShapeLib (Vector maps) ................. : yes (internal)
 
 RECOMMENDED OPTIONS:
   GraphicsMagick/ImageMagick (Raster maps) :
 yes (GraphicsMagick)
   pcre (Shapefile customization) ......... : yes
   dbfawk (Shapefile customization) ....... : yes
   rtree indexing (Shapefile speedups) .... : yes
   map caching (Raster map speedups) ...... : yes
   internet map retrieval ................. : yes (libcurl)
 
 FOR THE ADVENTUROUS:
   AX25 (Linux Kernel I/O Drivers) ........ : no
   libproj (USGS Topos & Aerial Photos) ... : yes
   GeoTiff (USGS Topos & Aerial Photos) ... : no
   Festival (Text-to-speech) .............. : no
   GDAL/OGR (Obtuse map formats) .......... : no
   GPSMan/gpsmanshp (GPS downloads) ....... : no


This means xastir has been configured. If there is a "yes" after all the dependencies you installed, there were no problems. Enter your sudo password and xastir will compile and install.

  • To run xastir, in Terminal, type:
 xastir

Update Xastir

When changes are made to the Xastir code (such as the recent .dbfawk file updates), run

 cd ~/src/XASTIR
 ./update-xastir

to download changes from cvs, configure, build, install the new version.

Known Issues

Can't load JPEG geo maps

GraphicsMagick doesn't find the required libjpeg include files. I'm not sure how to point GraphicsMagick to the right directory (/sw/include).

I don't have experience with this, so I can't comment whether this has been fixed or not. Dick.