This file gives step-by-step instructions for reproducing a full-featured xastir build on Ubuntu 8.04 or 8.10. This section is a modified version of the very excellent step-by-step for Ubuntu 6.10 and 7.04. As mentioned in HowTo:Ubuntu 6.06, there is a binary package, but due to the difference in where it installs maps and how it creates the .xastir/config/xastir.cnf file, I chose not to try it.
- 1 If you already installed the binary version
- 2 Preparing the system
- 3 Start installing packages
- 4 Get XASTIR source code
- 5 Build your first version of xastir
- 6 Build the fully-enabled xastir
- 7 Additional points
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 8.10 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.
I used Synaptic to install packages. Although using sudo apt-get install should also work, I am not documenting that method here simply because I did not actually do it. The last time I tried Kubuntu, the package manager was Adept, and that should work fine here - there's not much difference between Adept and Synaptic.
First launch the Synaptic package manager and click the Reload button to ensure you are in sync with the latest content in the repositories. In all cases when you search and mark packages for installation as instructed below, accept any prompts to install additional packages as dependencies.
Start installing packages
- Get the basic set of build tools:
Search for the build-essential package above, mark it for installation, and click Apply to install. This will install compilers, libraries, and headers necessary to get anything else done.
- Get the libraries essential for building xastir:
cvs autoconf automake xorg-dev libmotif-dev imagemagick gv libxp-dev
Search for each package listed above, mark it for installation, and click Apply to install. Note: automake should install as a dependency when you install autoconf. 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:
gpsman gpsmanshp proj libpcre3-dev libmagick9-dev libdb4.7-dev python-dev libax25-dev shapelib libshp-dev festival festival-dev Attention: Use libdb4.6-dev instead of libdb4.7-dev if you are using Hardy/8.04 - libdb4.7-dev applies to Intrepid/8.10 only.
Search for each package listed above, mark it for installation, and click Apply to install. You can skip this step if all you want is the minimal version of xastir, as none of these packages are necessary for a bare-minimum build. Do this step if you are going to want nice maps, though, as the minimal build is pretty crippled. Python is not necessary for xastir, but will be required if you decide to build gdal later. Don't install the gdal binary package from the repository at this point. We'll do that from sources later if you want gdal support.
Get XASTIR source code
From a development snapshot or stable release
If you're not into living dangerously, your easiest way to get the Xastir source code is from one of the "tarballs" available for download at the Xastir sourceforge site (see the top level of the xastir web site for a link to it). Once you download the file, extract it with "tar xzf filename.tar.gz" (with the obvious replacement of "filename" with whatever your file is called) and follow the remaining instructions here.
From the "bleeding edge" CVS repository
If you really want the latest developments of xastir immediately upon their being made, CVS is the approach for you. 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.
In the steps below, you might have to change the "cd" and "mkdir" commands to suit your taste. I like to keep my projects separated rather rigidly into directories, and the steps below reflect my personal style. This does tend to make rather deep directory trees, but makes clean-up easy because everything's separate. Your mileage may vary.
- 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:email@example.com:/cvsroot/xastir login cvs -d:pserver:firstname.lastname@example.org:/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.
- Run bootstrap to generate Makefile.am and configure:
cd xastir ./bootstrap.sh
Build your first version of xastir
If you're impatient and want results right now, you can build Xastir with limited features. If you did the third of the "apt-get install" lines above then you'll get the additional capability of on-line maps and GPSMan/GPSManShp capability. If you skipped that step you'll only have built-in map types, which include (among others) APRSDos maps, PocketAPRS maps, and shapefile maps. This is a fairly crippled version, and you can skip this step unless you really want to see something work Right Now.
I always build the code in a separate directory from the source code so I keep the source code tree clean at all times:
cd ~/src/XASTIR mkdir build-initial cd build-initial ../xastir/configure make && sudo make install
This will give you your first functioning version of xastir and you can play around with it until you're tired of having limited map support. I use --with-rtree because this feature, while still listed as "experimental" has a fairly big impact on shapefile rendering performance and should pretty much always be on if you're working with shapefiles.
The version you install here will render shapefiles in a very ugly fashion unless they are from a very specific set. To get better rendering, you want "dbfawk", which you'll get in the next step.
Build the fully-enabled xastir
To finish the job and get a fully-functional version of xastir, you need to get a few more libraries from source code instead of from apt-get. Fortunately, there's a script packaged in with xastir that helps ease the process.
Edit the get-maptools.sh script
In this section, we install several very useful mapping libraries from source code. In recent releases of Ubuntu (8.04, for example), shapelib and libgeotiff are both available through the Synaptic Package Manager. Unfortunately, the Synaptic package for libgeotiff installs the headers in a non-standard place (/usr/include/geotiff/ instead of /usr/include) where Xastir is not looking by default. If you choose to install libgeotiff via Synaptic instead of through source code, you will need additional configure options to build Xastir against libgeotiff.
Back to the show
- Copy the get-maptools.sh script somewhere so you can edit it:
cp ~/src/XASTIR/xastir/scripts/get-maptools.sh ~ cd ~ vi get-maptools.sh (or emacs, or gedit, or whatever you like to use)
- Change the XASDIR definition to point at your XASTIR source code directory. This involves changing the line that says
instead (or whatever the path to your xastir code directory is).
- Change the list of files to install from:
ALL=" http://internap.dl.sourceforge.net/sourceforge/pcre/pcre-6.3.tar.gz http://dl.maptools.org/dl/shapelib/shapelib-1.2.10.tar.gz\ http://dl.maptools.org/dl/proj/proj-4.4.9.tar.gz\ http://dl.maptools.org/dl/geotiff/libgeotiff/libgeotiff-1.2.3.tar.gz\ http://dl.maptools.org/dl/gdal/gdal-1.3.2.tar.gz"
ALL=" http://dl.maptools.org/dl/geotiff/libgeotiff/libgeotiff-1.2.3.tar.gz\ http://dl.maptools.org/dl/gdal/gdal-1.3.2.tar.gz"
This means you have to remove the lines referencing "proj-4.4.9", "pcre-6.3" and "shapelib-1.2.10"(because we installed them via Synaptic already).
Work around a bug in libgeotiff's configure script
It has been observed by more than one person that running the get-maptools script at this point will result in geotiff failing to build properly, giving an error message that looks like this:
/usr/bin/ld: makegeo: hidden symbol `__stack_chk_fail_local' in /usr/lib/libc_nonshared.a(stack_chk_fail_local.oS) is referenced by DSO /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: ld returned 1 exit status
I am posting to this page in this way because it took me a while of googling to find the answer to the issue, and I hope that this page will help someone else when they encounter the same problem in another project.
The problem is that geotiff's configure script will tell the Makefile to run "ld -shared" to build a shared library, and that's not correct with GCC versions 4 and up. This results in a shared library that does not properly include all the references to other shared libraries it's supposed to have. The correct way to build a shared library using gcc 4.x is to use "gcc -shared" instead.
The following ugly hack on get-maptools.sh will fix the problem. This hack was NOT necessary when I build libgeotiff on a system that had been upgraded from 5.10->6.06->6.10, but that seems to be the anomaly, not the rule.
Look for the following block of comments in get-maptools.sh:
#WARNING WARNING WARNING # On any system that uses GCC 4.x as its compiler, it is probably necessary # to uncomment the stuff between here and the next "else". If you see # an error message of the form # /usr/bin/ld: makegeo: hidden symbol `__stack_chk_fail_local' in /usr/lib/libc_nonshared.a(stack_chk_fail_local.oS) is referenced by DSO # /usr/bin/ld: final link failed: Nonrepresentable section on output # collect2: ld returned 1 exit status # when libgeotiff's makefile gets to linking "makegeo", this is your # problem. Uncomment these lines and rerun the script. #----uncomment below-------- # elif [ $XA_LIB = 'libgeotiff-1.2.3' ] # then # #The libgeotiff tar ball has last modification time of the configure # # script and the configure.in from which it's generated such that # # as soon as we type "make", the Makefile tries to regenerate # # configure and then run it with no arguments, interfering with # # our intentions here. So we "touch" configure so it's newer # # than configure.in, and make leaves them alone. The right # # fix would be to change that makefile, but this is easier # touch configure # # # libgeotiff tries to use ld -shared for linking shared library, # # which is wrong on linux with GCC 4.x # ./configure --with-ld-shared="gcc -shared" # make
Uncomment the stuff below the dashed line to enable the fix; to uncomment a line, you remove the "#" character from the beginning of the line. Once you make this change, libgeotiff will build correctly with the stock GCC compiler that comes with Ubuntu.
Run the get-maptools.sh script
Run the script:
If you're on a slow dial-up line, this is a good time to catch up on your email, coffee-drinking, or the news. Stay nearby, though, because you'll be prompted for a password every time the script hits an "sudo", which it will do once for each package when it tries to install.
Once get-maptools is done, you should be ready for the final phase.
Build the final code
Above, in the section about editing get-maptools.sh, we pointed out that recent releases of Ubuntu have libgeotiff available in the package repository. If you chose to install this version instead of the source-built version we walked you through, you've got some additional work to do here. You need to add a command line option when you run configure. In this case, where below we say to run "../xastir/configure" you will have to run instead
which instructs configure to add a compiler flag that forces the compiler to look for geotiff's header files where they were installed. If you built and installed libgeotiff from source code as we instructed above, this is unnecessary.
back to the show
You've now got all the libraries in place and can build the fully enabled code. Again, I like to do things in directories separate from the source code to keep the source code directory clean. So:
- Make a new build directory:
cd ~/src/XASTIR mkdir build-full cd build-full
- Configure the code:
You should be rewarded with a list of features that all say "yes" after them. If you followed all the steps in "Start Installing Packages" and did the get-maptools.sh ran with no errors, that should look like this:
xastir 1.9.5 has been configured to use the following options and external libraries: MINIMUM OPTIONS: ShapeLib (Vector maps) ................. : yes RECOMMENDED OPTIONS: 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) FOR THE ADVENTUROUS: 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) .......... : no GPSMan/gpsmanshp (GPS downloads) ....... : yes
Note that on my system, I still got a "no" on GDAL even though it was installed via get-maptools.sh. This is an outstanding issue for Ubuntu 8.10 (not 100% sure about 8.04)
- Build the code:
make && sudo make install
- Enjoy! You now have a fully functional xastir with all features enabled.
You have to start the festival server by hand in a shell window before starting xastir.
festival --server &
Festival is also automatically started if you enable some of the "Assistive Technologies" in the Gnome desktop. I usually don't, so the command above is necessary.
Clicking File->Configure->Speech in xastir, I could get it to talk just by clicking the "Test" button in the dialog.
GDAL support in xastir is very embryonic, so this doesn't really matter, but the instructions above will build gdal with only a small fraction of its capability. There are lots more features of gdal you can enable by adding more packages (e.g. sqlite3, postgis, netcdf, etc.), but none of these get you more features in xastir. If you use gdal for something more intensive like GRASS GIS or QGIS, you'll want to rebuild gdal after getting more of its optional dependencies installed.
If you plan to use gpsman's graphical user interface you can add the Img library. If you plan on doing much building of open source codes, you probably will need libtool. You do NOT need it for xastir, but it's a fast download and you might as well make sure it's there for later.
sudo apt-get install libtk-img libtool
I chose to do these way up there at the beginning, but since they're completely unnecessary for a basic Xastir install, I stuck them down here instead.