From XastirWiki
Jump to: navigation, search

This howto was inspired by the howto HowTo:Ubuntu_8.10. Special thanks to the contributors to that howto, and to the Xastir developers. You will notice that this howto is similar to the previously mentioned howto, but I decided to create a new one rather than try to modify the existing one to fit Ubuntu 9.04 or 9.10 (even though there are only a few differences in the way Xastir is installed).

This howto gives instructions for building Xastir from CVS on Ubuntu 9.04 with all supported libraries enabled. It assumes the user already has a working installation of Ubuntu 9.04, either on a physical machine or a virtual machine. Installation of Ubuntu itself is not covered in this howto. Internet connectivity is also assumed. It is also applicable to Ubuntu 9.10 with very few modifications.

If you already installed the binary version

Note: the description below on what to do if you already installed the binary version is verbatim from the HowTo for Ubuntu 6.10 and 7.04. Although I expect it still applies, I have not tried installing the binary version in 9.04 and then removing it using this procedure.

If you installed a binary version of xastir using the "apt-get install xastir" option, you'll have a somewhat outdated version, and it will have installed into /usr instead of /usr/local. The source install described on this page will install into /usr/local, so you'll want to remove your binary install first before following these directions.

If you did a lot of map configuration with the binary install, all of your maps will be in /usr/share/xastir/maps. You'll need to copy those to a safe place before removing the binary install:

    mkdir /tmp/maps
    cp -r /usr/share/xastir/maps/* /tmp/maps

Then remove the binary package:

    sudo apt-get remove xastir

You can then follow the instructions below to re-install xastir to /usr/local from sources. Once you're done, copy your maps back to the new installation directory:

    sudo cp -r /tmp/maps/* /usr/local/share/xastir/maps

Then you need to edit your ~/.xastir/config/xastir.cnf file to change all occurances of "/usr/share" to "/usr/local/share"

You'll be back in business with a more easily updated xastir.

Preparing the system

I didn't have to do anything to the repository settings as the newer versions of Ubuntu already have the universe and multiverse repositories configured.

First, make sure you have a working Ubuntu 9.04 installation. Also check that you can access the Internet. As always, you should also make a complete backup of your system, just in case something goes horribly wrong.

I recommend updating your installed packages to the latest versions first. This can be done using APT:

    sudo apt-get update
    sudo apt-get upgrade

If there was a kernel upgrade or something you may want to reboot your system before proceeding.

Start installing packages

  • Get the basic set of build tools:
    sudo apt-get install build-essential
  • Get the libraries essential for building xastir:
    sudo apt-get install cvs autoconf automake xorg-dev libmotif-dev imagemagick gv libxp-dev

These packages are required for the most basic minimum build of xastir. gv is not strictly required, but if you don't install it you will be unable to print. Note that this imagemagick package is not the one that gives you on-line map support, it's the one that provides the "convert" utility needed to create the postscript that gv will use to print. This package and gv are both required to be able to print from xastir even with minimal map support.

  • Get additional libraries that will help for extra features:
    sudo apt-get install gpsman gpsmanshp libpcre3-dev libdb4.7-dev python-dev libax25-dev shapelib libshp-dev festival festival-dev libmagickcore-dev

If you prefer GraphicsMagick to ImageMagick (many do), you can modify the two installation lines above:

    sudo apt-get install cvs autoconf automake xorg-dev libmotif-dev graphicsmagick gv libxp-dev
    sudo apt-get install gpsman gpsmanshp libpcre3-dev libdb4.7-dev python-dev libax25-dev shapelib libshp-dev festival festival-dev libgraphicsmagick1-dev

This is an acceptable modification as long as you're not using other software that absolutely requires ImageMagick --- the two dev packages conflict unnecessarily, and therefore GraphicsMagick is not an option if you are using software other than Xastir that mandates ImageMagick.

Get XASTIR source code From the "bleeding edge" CVS repository

In this method, you get your source code directly from the "repository" that the developers use to work on the software. See Notes:CVS for details. Here's the step-by-step method for getting it this way.

  • Prepare your .cvsrc if you don't have one
    ls -l ~/.cvsrc

If the ls command shows that you already have a .cvsrc file in your home directory, skip this next step.

Create a .cvsrc file in a text editor:

    nano ~/.cvsrc

Enter these commands in the text file:

    cvs -z3
    update -P -d
    status -v
    diff -u

Save and exit your text editor.

  • 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 src directory under my home directory:

    mkdir ~/src
    cd ~/src
    cvs login
    cvs 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.

  • Run bootstrap to generate and configure:
    cd xastir

Build the fully-enabled xastir

To get a fully-functional version of xastir, you need to install a few more libraries. These are the proj.4 library and the geotiff library. The Ubuntu repositories have them, but the version of proj.4 they have is broken --- it is improperly compiled without datum grid support. Because libgeotiff depends on proj, installing them both from the official repository is a problem. There are two solutions: use the "UbuntuGIS" unofficial PPA (Personal Package Archive) to get properly compiled versions, or build from source.

Using the UbuntuGIS PPA

This is by far the easiest and fastest method to get the geotiff and proj libraries, if you trust the unofficial packages. They have been shown to work Just Fine, and are the recommended approach. Using these repositories will keep your installed packages managed by apt. Building from source instead will require you to maintain your proj and libgeotiff installs yourself.

To install the two required libraries from the alternate PPA, you need to add to your apt.sources file, install a key, and then install the packages.

   sudo -i
   echo "deb jaunty main" >> /etc/apt/sources.list
   echo "deb-src jaunty main" >> /etc/apt/sources.list
   apt-key adv --keyserver --recv-keys 089EBE08314DF160
   apt-get update
   apt-get install libproj-dev libgeotiff-dev

If you are building for a later version of Ubuntu than 9.04 (Jaunty), change the two "deb" lines to point at the appropriate version. On 9.10 that means you should issue

   echo "deb karmic main" >> /etc/apt/sources.list
   echo "deb-src karmic main" >> /etc/apt/sources.list


Installing from source

Only build these two packages from source if you really don't trust the unofficial UbuntuGIS PPA (there is no reason not to, as it is a set of GIS packages maintained by GIS users who keep on top of the problems, unlike the main repositories).

Install proj.4

The Ubuntu reposistories have a version of proj.4, but this version was not built correctly with the NAD27/NAD83 datum conversion grids. These grids are not needed for Xastir, but if you use proj.4 for any other GIS tools (including GDAL), you need to build proj.4 (and everything that depends on it) from source instead.

  • Download the proj.4 source

As of this writing, the latest proj.4 source can be downloaded like this:

    cd ~/src
  • Unpack proj.4
    tar zxvf proj-4.7.0.tar.gz
    cd proj-4.7.0/nad
    tar xzf ../../proj-datumgrid-1.4.tar.gz
    cd ..
  • Build and install proj.4
    sudo make install
    sudo ldconfig

Install libgeotiff

  • Download the libgeotiff source

As of this writing, the latest libgeotiff source can be downloaded like this:

    cd ~/src
  • Unpack libgeotiff
    tar zxvf libgeotiff-1.2.5.tar.gz
    cd libgeotiff-1.2.5/
  • Build and install libgeotiff
    ./configure --with-ld-shared="gcc -shared"
    sudo make install
    sudo ldconfig

Install GDAL

This is an entirely optional install, and is pretty much unnecessary. Very few users will ever have need of it, as Xastir's use of GDAL is limited to only a small handful of unusual map types. It is recommended that the casual user skip this step.

  • Download the GDAL source

As of this writing, the latest GDAL source can be downloaded like this:

    cd ~/src
  • Unpack GDAL
    tar zxvf gdal-1.6.2.tar.gz
    cd gdal-1.6.2
  • Build and install GDAL:
    sudo make install
    sudo ldconfig

Note: the GDAL 'make' step seems to take a while to complete

Install Xastir

You've now got all the libraries in place and can build the fully enabled code.

  • Configure the code:
    cd ~/src/xastir
    mkdir build
    cd build

If you installed the libgeotiff and libproj packages from the UbuntuGIS PPA, then you will need to add a command line argument to configure:

    ../configure CPPFLAGS="-I/usr/include/geotiff"

You should be rewarded with a list of features that all say "yes" after them. If you followed all the steps above, that should look like this:

xastir 1.9.7 has been configured to use the following options and external libraries:


 ShapeLib (Vector maps) ................. : yes


 GraphicsMagick/ImageMagick (Raster maps) : yes (ImageMagick)
 pcre (Shapefile customization) ......... : yes
 dbfawk (Shapefile customization) ....... : yes
 rtree indexing (Shapefile speedups) .... : yes
 map caching (Raster map speedups) ...... : yes
 internet map retrieval ................. : yes (wget)


 AX25 (Linux Kernel I/O Drivers) ........ : yes
 libproj (USGS Topos & Aerial Photos) ... : yes
 GeoTiff (USGS Topos & Aerial Photos) ... : yes
 Festival (Text-to-speech) .............. : yes
 GDAL/OGR (Obtuse map formats) .......... : yes
 GPSMan/gpsmanshp (GPS downloads) ....... : yes

  • Build the code:
    sudo make install

If you intend to use Kernel AX.25 networking, you should also set the installed Xastir binary to be SUID root:

    sudo chmod u+s /usr/local/bin/xastir

  • Enjoy! You now have a fully functional xastir with all features enabled. You can launch it like this:

The first time Xastir is run it'll pop up a dialog box asking you to set some station parameters.

Additional points

Updating Xastir

The developers are always adding new features to Xastir and fixing bugs. You'll likely want to update your Xastir semi-regularly. Fortunately for you, you don't have to repeat all of the above steps each time. Updating is actually very simple:

    cd ~/src/xastir
    cvs update
    cd build
    sudo make install && sudo chmod u+s /usr/local/bin/xastir

Or there is a script that will run the commands for you:

    cd ~/src/xastir


You have to start the festival server by hand in a shell window before starting xastir.

    festival --server &

Clicking File->Configure->Speech in xastir, I could get it to talk just by clicking the "Test" button in the dialog.