16 FreeBSD
Tom Russo edited this page 2026-02-12 11:13:02 -07:00

Installing Xastir on FreeBSD

There is an Xastir port in the Xastir ports system

The port in the ports system is currently at 2.2.2, which is the last release we made. The port maintainer is aware that we are ready to release a new one soon, and will get the port updated promptly after we do.

To install it, simply do the following:

Install a binary package
sudo pkg install comms/xastir

which will install all of the dependent libraries and headers Xastir needs from binary packages, then install Xastir from a binary package.

OR:

Use the ports collection to install from source

Alternatively, you can use the ports system if you keep your ports tree up to date (see https://docs.freebsd.org/en/books/handbook/ports/#ports-using). As root (su or sudo -i):

cd /usr/ports/comms/xastir
make install clean

This will cause all libraries and headers needed by Xastir to be installed first (from source code), then will download the source code for an Xastir release and build it (just as you would have). Note that you'll get the latest release that the ports maintainer has set up for the port, not the latest code from github.

The port will install all required dependent libraries for a full build of Xastir (with GPSMan available as a non-default option you can select at the time you install the port).

Should you decide to build from source after already installing the port

Unlike Linux, FreeBSD installs all of its ports/packages into /usr/local just as you would if you had built it yourself. Thus, installing the FreeBSD port does NOT cause problems if you later decide to switch to a source build --- all of the paths in your config files will already be correct. You can simply remove the port-installed version with:

pkg delete comms/xastir

This will remove all the files installed by the port, but if you have added maps and other information to /usr/local/share/xastir, none of those files will be deleted --- the delete operation only deletes files it knows it installed and only removes directories that are empty when it finishes. Thus this is safe to do even if you have added to the maps directory.

After removing the port-installed code you can then just install directly from source. Your initial install of the port will have installed all the dependent libraries already, so you can skip those steps.

Installing from source

Even though FreeBSD has a reasonably maintained Xastir port, it is always going to be a release version. To stay on top of Xastir development and always get the latest code, even before a release, you are still better off building it yourself from source.

Installing dependent libraries

Use the "pkg install" command to install packages that Xastir needs.

This command will install everything needed for a full build.

sudo pkg install -y devel/autoconf devel/automake devel/shapelib graphics/tiff  devel/pcre2 graphics/GraphicsMagick graphics/libgeotiff ftp/curl databases/db18 lang/gcc13 x11-toolkits/open-motif audio/festival devel/libcjson devel/git

Configure needs some extra help

You must use gcc to compile Xastir with GraphicsMagick, as you cannot link GraphicsMagick using the default Clang compiler. You must specify this by adding a CC setting to configure. At the time I'm writing this the latest version of gcc is version 13, so I'm using gcc13.

You must tell Xastir's configure to look in /usr/local/lib and /usr/local/include/db18 for Berkeley libraries and headers. Use the "--with-bdb-incdir" and "--with-bdb-libdir" flags.

This configure line should do the trick:

/path/to/Xastir/configure --with-bdb-incdir=/usr/local/include/db18 --with-bdb-libdir=/usr/local/lib CFLAGS="-O2 -g" CC=gcc13

where "/path/to" is the path to wherever you actually unpacked the Xastir source code.

Everything else is per the general building guidance

The remaining steps of building Xastir are exactly as provided in Installing Xastir.

Differences from Linux package management

FreeBSD usually doesn't break packages up into "lib" and "dev" and "bin" bits --- if you install a package, you get all of that stuff in one package.

A few additional tools you might want to install

The list above will get you an Xastir that is fully functional with all the optional features that actually work on FreeBSD. However, if you are doing a lot of advanced mapping manipulation you might want a few extra packages

  • graphics/gdal: This installs the GDAL package that includes a number of useful tools for manipulating map data.
  • graphics/py-gdal: This is an exception of FreeBSD breaking up a single package into multiple bits. gdal source code comes with a number of python tools, and those are NOT installed by the "gdal" package. This package installs those.
  • graphics/qgis: For really advanced map manipulation, this tool provides a full-featured graphical GIS (especially when coupled with the databases/grass8 package). Be prepared for a steep learning curve if you actually need this package.

How were these instructions tested?

The Xastir team has an automated testing setup on Github that checks the Xastir build on several different systems. FreeBSD is one of them. This process launches a vanilla FreeBSD virtual machine, executes the pkg install command above, then configures and builds Xastir from source.

This process is run every time any change is made to the Xastir code.

We also check it regularly by hand

One of the Xastir developers does all of his work on a FreeBSD machine and the installed packages required are those he had to install on his own machine.