From XastirWiki
Jump to: navigation, search

Building XASTIR on Windows under Cygwin

About this page

This Wiki page is a copy of the file README.win32 from the Xastir distribution, but is not guaranteed to be up-to-date with that document. You can get at the most recent copy of that file from the Xastir Git repository:

http://github.com/Xastir/Xastir/blob/master/README.win32

VMware

It has recently been considered that using VMware to run a Linux virtual machine can be a much, much easier way to get xastir running on a Windows computer than the Cygwin approach described here. Please see HowTo:VMware for details.

Shortcutting the process

Two companies have created simpler installs of Cygwin/Xastir than described in this document. Contact one of these folks for more info. Remember to replace the "at" below with the "@" symbol to arrive at the correct e-mail addresses. We have to do that to prevent large amounts of spam from going to addresses harvested from web pages:

   Lintronix:
     Internet install of Xastir available for free, CD-ROM available
     for a nominal fee.  Everything needed to install Cygwin/Xastir
     online (Internet install) or off-line (CD-ROM).  Walks you
     through an automated install:
       http://www.lintronix.com/winxastir/
       E-mail:  winxastir at lintronix.com


   Inuit Nunaani Wireless Inc:
     CD-ROM available for a nominal fee.  Everything needed to
     install Cygwin/Xastir off-line.  Walks you through an
     automated install.  This install is verified to work on WinXP
     and Win98 (known _not_ to work on Win95/WinME).  Contact:
       E-mail:  Tom Tessier <ttessier at trtdigital.ca>

Preparatory steps

Log In to your Windows account

Please Note: It's beneficial to actually log in to your Windows computer rather than skipping that step of the Windows login process (Don't hit escape just to get rid of the dialog!). If you log into Windows properly, Cygwin will be able to figure out where to put your home directory. If you don't do this, you'll be referred to as "unknown" and you won't have a home directory in Cygwin. This means there won't be a good place to put your Xastir startup files. Of course, log in as the same user each time in order for Cygwin to use the proper home directory for you.

Modifying existing files

CAN'T REPLACE FILES: Every once in a while Windows will refuse to allow you to delete/rename one of the files. The only way I've found to get around this problem is to reboot. Also, Windows typically won't allow you to replace a file that Windows currently has open. If you're going to be recompiling/reinstalling Xastir, or updating Cygwin, make sure that these applications are shut down before doing so. You can get VERY strange results if only some files get updated.

Username restrictions

SPACES IN USERNAMES: Cygwin specifically, and Unix boxes in general, don't much like spaces in filenames, directories, or login names. Any of these may cause you headaches while playing with Cygwin. Create a new login that doesn't have spaces and log in as that user before installing Cygwin, and whenever you intend to run Cygwin/Xastir. It's very likely that Xastir won't work for you if you use a login that has spaces embedded in it. For additional info, see this link:

   http://cygwin.com/faq/faq_2.html#SEC17

Explanation of this login box for those that don't see it: If you have the option of running networking, you'll have a login box show up when you first start up Windows. It'll ask for you user name and password, then let you in. If you escape out of that dialog, Windows may start right up but networking will be disabled.

If you don't see that box, there are two options that I know about, either you or someone else set it up to auto-login with your user/password combo, or you don't have networking installed at all.

Installing Xastir on Windows/Cygwin

The following steps direct you through installing Cygwin, Xastir, and a few optional map libraries that Xastir can use. Note that in most of the places below where the directions state to type commands, this must be done from within a Cygwin BASH shell, not a DOS window. Where you are asked to edit files, it's best to use Wordpad instead of Notepad, as Notepad doesn't do nice things to Unix-format files.

Cygwin now allows you to have Xwindows apps and Windows apps all on the screen and visible at the same time! The instructions here set it up in that manner, so you can have Xastir as just another app on your Windows desktop.

Please subscribe to the "xastir" mailing list at "http://www.xastir.org". There are lots of helpful people there that can aid you in installing/running Xastir.

Step 1) Install Cygwin, a free download.

[ ] Step 1a) Go to http://www.cygwin.com with your web browser. Look for the black and green Cygwin icon, then click on "Install now!".

This will load the Cygwin network installer program onto your computer. Remember where you decide to put this program. I put mine in "c:\<login>\cygwin\setup.exe", (for instance "c:\hacker\cygwin\setup.exe"). This program will allow you to do a network install of Cygwin. After you install Cygwin (see the steps below for details) you'll have a package directory (in my case "c:\hacker\cygwin\") and a Cygwin directory (in my case "c:\cygwin"). The un-installed packages go into the package directory as they are downloaded from the 'net.

It will be beneficial to re-run the Cygwin network installer from time to time in order to keep Cygwin up to date. Each time you run it you'll update any packages that have been changed since you last ran it.

[ ] Step 1b) Find the "setup.exe" program and execute it either by:

 a) Clicking on it with File Explorer, or
 b) Start->Run->path to executable, or
 c) Opening a DOS window and typing the name.

This will start installing Cygwin over the network. Answers to provide to the program:

   Install from Internet (*)
   "C:\cygwin"
   Install For All Users
   Default Text File Type Unix (*)
   Local Package Directory "C:\hacker\cygwin"
   Select Your Internet Connection (choose one)
   Choose A Download Site (choose one nearby if you can determine that)

Note: Responses above listed with a "(*)" are required. Others are up to the individual user to answer as they wish. You'll get to a "Progress" page where "setup.bz2" is downloaded from the 'net. If it hangs at this step, you may wish to "Cancel" and try another server until you obtain this file and are presented with a list of packages to install.

[ ] Step 1c) Select Packages: Leave the packages selected that were selected by default, plus select the additional packages listed below. Note that enabling some of these packages causes others to be selected as well, that's OK and necessary.

[ ] Press the "View" button until it says "Full" next to it. All packages are now in alphanumeric sorted order.

Selecting a package involves clicking on the little circle symbol until the option you want is displayed. You can choose older versions of a package, choose to keep the package you have installed already, or choose to remove or install a package in this manner. If you're running Cygwin install again and see "Keep" as an option, that means you've already installed that package. We're only concerned with the "bin" packages here (stands for "binary") and not the "src" packages (source code).

It's suggested that you keep whatever was selected by default, and just add the below packages to the selection. As you select packages, other packages may be selected for you that are also required:

[ ] autoconf
[ ] automake
[ ] binutils
[ ] bzip2
[ ] curl
[ ] curl-devel
[ ] cvs
[ ] db4.2
[ ] diffutils
[ ] gcc
[ ] git
[ ] gv
[ ] gzip
[ ] ImageMagick
[ ] lcms
[ ] less
[ ] lesstif
[ ] libdb4.2
[ ] libdb4.2-devel
[ ] libgeotiff
[ ] libgeotiff-devel
[ ] libgeotiff1
[ ] libMagick-devel
[ ] libMagick6
[ ] libproj-devel
[ ] libproj0
[ ] libtool
[ ] libxml2-devel
[ ] m4
[ ] make
[ ] nano (a windows-style text editor, optional)
[ ] patch
[ ] pcre
[ ] pcre-devel
[ ] perl
[ ] proj
[ ] python
[ ] rcs
[ ] tcltk
[ ] tiff (install sources for this one too? TBD)
[ ] unzip
[ ] vim (a Unix-style text editor, optional)
[ ] wget (Optional: Can use libcurl instead)
[ ] X-start-menu-icons
[ ] X-startup-scripts
[ ] xfree86-lib-compat
[ ] xorg-x11-bin
[ ] xorg-x11-devel: Headers
[ ] xorg-x11-f100: 100 dpi fonts
[ ] zip


Please note that there are problems with the current Cygwin install of ImageMagick as of this writing on 6 November 2006. See below under "Adding ImageMagick" for work-arounds.

Clicking on the small circle with the two arrows will run you through the various select/de-select options for each package.

Note regarding Perl: On some Windows systems, Perl 5.8 can cause page faults when compiling Xastir. If this happens to you, start up the Cygwin install program again and install Perl 5.6.1 instead. Retry the compile. If this works for you, every time you update Cygwin you'll have to check the Perl version to make sure that it doesn't update you to 5.8.

Note regarding KDE: One user reported that the KDE package on Cygwin messes up XmStrings in Lesstif. It caused a bunch of headaches. You've been warned. Note that KDE is not one of the packages listed above (I didn't load it).

[ ] Step 1d) Click Next and the packages will get downloaded and installed. Repeat the above if you have network difficulties, until the install succeeds completely.

Some servers fail to download some files and require the user to press enter between downloads when it fails on these files. If this happens, back up and select another server.

[ ] Step 1e) At the end of the install it'll ask you if you wish to create desktop icons and menu entries. Definitely select these! It doesn't mean that Cygwin will start automatically each time you reboot your computer or login (it doesn't start automatically). It _does_ mean that you'll have an icon to click on manually to get things going.

This will create a Black/Green Cygwin icon on the desktop and a menu entry so that you can start Cygwin through the menu system as well.

[ ] Step 1f) Click "Finish". Cygwin is now installed. One more pop-up informs you Cygwin has been installed. Sometimes this last dialog gets hidden behind other windows, and it does seem to need OK clicked to complete the installation. Click the OK button on that last dialog to _really_ complete the installation.

The Black/Green Cygwin icon will start up a BASH window, without starting up Xwindows. Think of it as being similar to a DOS window, but with a lot more power. It understands Unix commands though, not DOS commands.

[ ] Note: I've had the Cygwin network install fail before during the downloading stage without informing me in any recognizable manner. You might which to re-do step 1 to make sure nothing further gets downloaded/installed. Once you get to that point, Step 1 is complete.

Step 2: Create shortcut for starting X

Create a shortcut to C:\cygwin\usr\X11r6\bin\startxwin.bat from your desktop. This shortcut is the method you'll use to start up Xwindows. The usual method is to use File Explorer to find the file, the right click and drag it to your desktop, at which point you let go of the right mouse button and you'll be presented with a small menu. Select "Create Shortcut(s) Here". You can then rename the shortcut if you wish. I named mine "Xwindows".

Change the properties on the shortcut so that it runs it from your home directory on Cygwin, something like "c:\cygwin\home\<user>\". Right-click on the new shortcut, then go to the Properties menu to change this. You may need to create the home and the user directory before you can change the properties on the shortcut.

Step 3: Test Cygwin and create startup shortcuts

Note: With Win2000, I had to do a reboot before I could proceed further.

Double-click on the shortcut you just made. You should get a shell window that looks very much like a DOS window. It's a BASH shell window and understands Unix commands instead of DOS commands.

When running this shortcut for the first time from WinXP, several errors may occur. Repeat as necessary until the BASH window appears without incident.

Type "exit" and then press <Enter> to make the BASH window disappear.

You should still see an 'X' in your system tray. That's the X-server running. You can right-click on that and then select the menu entry to cause it to exit.

Once you've gotten to this stage, you now have Cygwin and Xwindows installed and operational. Next we go after Xastir itself.

[ ] Edit or create your .profile file in your home directory.

NOTE: Your "home" directory would be at "C:\cygwin\<user>\" if you installed Cygwin in the default location. From inside a BASH shell you can get to your home directory just by typing "cd" and then pressing <Enter>. When you see things like "~/.profile" it is really referring to the file ".profile" in your home directory (~). This is a different file than the ".bash_profile" file.

It appears that Cygwin uses the PATH variable to look for both binaries and libraries. Add this line to the file (create the "~/.profile" file if the file doesn't exist):

export PATH=$PATH:/lib:/usr/lib:/usr/X11R6/lib:/usr/local/lib:/bin:/usr/local/bin:.

If the line already exists in your .profile, add any missing pieces to it from the line above. Directories should be separated by a ':' character. Edit it with "nano" or "vim" (again, the more user-friendly editor is "nano").

Once you have saved the file, execute the following commands to copy file to where it will be automatically executed when you open a shell and then read it for this session so you don't have to close and then reopen the shell.

    cp .profile .bashrc
    source .bashrc

Step 4: Download Xastir sources.

Start up Xwindows using your shortcut. Type the six lines below into the shell exactly as shown. Hit <ENTER> when asked for a password after typing line four (the "login" command):

 cd ~
 mkdir src
 cd src
 git clone http://github.com/Xastir/Xastir

The end result when it succeeds will be a new directory "C:\cygwin\home\<user>\src\Xastir\" which contains all of the Xastir source code. You can type "ls Xastir" (that's lower-case LS) to see the file listing.

Side Note: Here's the coolest thing about Git: Once you've done this initial source-code download, you'll never have to do the whole Xastir download again. You'll just go into the "src/Xastir" directory and type "git pull", which will snag just the _changes_ to the files since you last updated, and is very fast. Compile and install at that point and you'll be running the latest developer's version in just a few minutes! It's very easy to keep up with the developers this way.

Step 5: Configure/compile/install Xastir

Type these commands into the BASH shell, waiting until each one completes before typing the next command:

   cd ~/src/Xastir
   ./bootstrap.sh
   mkdir -p build
   cd build
   ../configure
   make
   sudo make install
   sudo chmod 755 /usr/local/bin/xastir

NOTE: You'll probably want to run the configure step from an xterm window with the X11 server running of course. If you do this from a non-X11 window then the configure test for "gv" will fail, as "gv" requires an X11 server even when asking it for it's version number. Without "gv" support you won't be able to print from Xastir.

NOTE: The "make" step can be extremely memory hungry. If you don't have much free memory, that step might take a long time to run. One Win2k machine with only 20MB of free RAM (128MB total RAM) couldn't complete this step, but adding another 128MB of RAM to that machine caused it to succeed. Another machine running Win2k with 64MB free (128MB total RAM) took six hours (but keep reading!). Free up memory if you're having trouble completing that step. This behavior is only seen on Windows/Cygwin, not on the Unix-based systems. On a typical Linux box that step takes under two seconds. Hopefully Cygwin linking will improve over time to alleviate this issue. We've added a new link-stage parameter to reduce the memory usage for that step, but it doesn't totally resolve the problem. The machine that took six hours originally now takes 60 seconds to complete that step.

Ignore the "PACKAGE_* redefined" warnings. They won't break anything and are just an annoyance.

Once you get through the above commands, Xastir is compiled and installed on your system, with minimal map support. Later sections of this document detail adding additional map libraries in order to give you access to the full mapping capability of Xastir.

Step 6: Create a link to the Xastir executable.

 Type the following commands into the BASH shell:
   cd ~
   ln -s /usr/local/bin/xastir xastir

That will create a symbolic link from your home directory to the Xastir executable, to make it easier to run Xastir without typing the long path each time.


Step 7: Actually run the darn thing:

Let's start from scratch to make sure it all works. Close any Cygwin/BASH windows you may have.

Click on the shortcut you created to start Xwindows.

From the resulting BASH window, type "xastir &". Xastir should start up shortly.

Note: Xastir has support for PocketAPRS, DosAPRS, WinAPRS, MacAPRS and GNIS maps by default. For additional types of maps, you'll need to install some libraries, then recompile Xastir so that it knows to use them. See the instructions below.

The HowTo:MAPS file has instructions for where to get maps and where to put them under the Xastir hierarchy.

If you have any WinAPRS, DosAPRS, or PocketAPRS maps, now is a good time to place them in the /cygwin/usr/local/share/xastir/maps folder (or a subdirectory of it). You can also use "*.geo" files and the associated image files with Xastir. You may place them in this directory (or a subdirectory of it) as well, though most of the .geo files won't work for you until you install the ImageMagick library.

What Xastir paths look like from within Windows (in case you're moving maps around with Explorer): Just prefix them all with "cygwin/". For instance, maps go into /cygwin/usr/local/share/xastir/maps instead of /usr/local/share/xastir/maps. Xastir will continue to see them as "/usr/local/share/xastir/maps" though from inside Cygwin. It kind of looks like a miniature Unix box from inside Cygwin.

Run Windows in 15-bit color or better (32768 colors or more) or you'll get lots of warnings about Xastir not being able to allocate colors when it starts up, and the display will be rather stark looking.

To set a new language or change the language current choice, use this command line instead from inside an Xterm:

    xastir -l <language>

Current choices are:

   Dutch English French German Italian Portuguese Spanish

This option will be stored in the users config file for the next time Xastir is run. On new installs Xastir will default to English until you use this command line option once.

Another difference with Cygwin as opposed to Unix-like operating systems: You can't do the make install portion if Xastir is up and running. You have to kill Xastir first before you do "make install" or "make install-strip". Otherwise the newly compiled Xastir won't replace the old one.

Note that one user running Cygwin on XP had it crash every time his screen-saver kicked in. Disabling the screen-server fixed that problem.

Another interesting "feature" of Cygwin/Xwindows is that some of the modifier keys like ScrollLock/CapsLock/NumLock must be pressed while that X-window is the active foreground window. If not, the event can be missed, and Xwindows can get out of sync with the actual state of the key. This doesn't appear to be an Xastir-specific problem, but a Cygwin/Xwindow problem. With just a BASH shell under Cygwin (not involving Xwindows), the problem doesn't appear to happen. Just inside Xwindows on Cygwin.

Some users have experienced problems with their Windows box running the NTFS "convert.exe" program instead of the ImageMagick "convert.exe" program, usually when enabling snapshots in Xastir. If you experience this, check your path settings and make sure that ImageMagick's path is first.

To make the "Fetch NWS Alerts" button work for weather objects and to be able to double-click on a weather alert in the View->Weather Alerts window, type this into a Cygwin command window:

   ln -s `which finger` /usr/bin/finger

(the ` is a backquote, left of number 1 on keyboard. NOT single quote). Without this, the NWS alert window appears with blank and the console will display:

   "sh: /usr/bin/finger: No such file or directory".

When specifying serial ports to use with Xastir, "COM1" is called "/dev/ttyS0" in Cygwin (and Linux) "COM2" is called "/dev/ttyS1" in Cygwin (and Linux). Note the capital 'S'.

Step 8: Document & Back Up the Configuration

One user had a problem where after Cygwin/Xastir was installed, he installed another program, in this case Java, and it wiped out some of the environment variables that Cygwin set. $HOME was one variable that got changed.

To guard against such changes, go to My Computer and right-click on properties. Write down the Advanced System Variables and keep the note in a safe place.

Optional

To shorten the Xastir sequence or to automate the startup process of Xastir in Windows environment, the following may prove useful.

 1. Locate startwin.bat, it will be located at: Cygwin install drive, eg; C:\cygwin\usr\X11r6\bin\ Please make a backup copy
    in case something goes wrong!  Save it as a new name such as startwin.bak or startwin.orig.
 2. Open startwin.bat with notepad or another ASCII text editor.
 3. Find the line:
    run xterm -sl 1000 -sb -rightbar -ms red -fg yellow -bg black -e /usr/bin/bash
 4. Copy and paste the line into the startwin.bat file directly under the line you just copied.
 5. Cut /usr/bin/bash -l from the end of the line then enter /usr/local/bin/xastir where you just cut. You will end up with entries such as this:
    run xterm -sl 1000 -sb -rightbar -ms red -fg yellow -bg black -e /usr/bin/bash -l
    run xterm -sl 1000 -sb -rightbar -ms red -fg yellow -bg black -e /usr/local/bin/xastir
 6. Save startwin.bat

Now when you click the XWindow shortcut, Xastir will start without the need to wait for the BASH shell and typing Xastir &. In addition, a BASH shell window will open to allow you to monitor any error messages or other information generated by Xastir put out to STDERR and shown in the shell.

In addition, you can add a shortcut to the startup directory to automatically start Xastir when you start Windows..

Please see the [1] file and the Help menu in Xastir itself for additional information not mentioned in this document.

Additional info can be found on the cygwin web-site:

   http://www.cygwin.com

or the Cygwin/XFree86 web-site:

   http://cygwin.com/xfree/

Step 9: Keeping up-to-date:

Once a week or once a month, run the Cygwin network installer program (step 1b above). After it finishes, open a Cygwin window and type these commands to update the Xastir source code:

   cd ~/src/Xastir
   git pull

Every once in a while Windows will refuse to allow you to delete/rename one of the files. The only way I've found to get around this problem is to reboot. I sometimes see this when trying to do a "git pull", and Windows won't allow one or more files to get updated.

Repeat step 6) above to recompile/reinstall the latest Xastir.

A very good option is to read the SUDO instructions in the README.sudo file, setting up the /etc/sudoers file and creating an update-xastir script as shown. Then you can type "./update-xastir" at any time to snag down the latest Xastir changes, compile, and install it. We've just included an update-xastir script with Xastir, so you don't have to create it anymore. You may however need to remove the "sudo" keyword from each line for it to work properly on Cygwin.


Notes from Henk de Groot:

1) On Windows ME I had to configure the shortcut to start Xwindows, it ran out of environment memory. Selecting an "Initial Environment" of 4096 bytes in tab "Memory" (I hope that is correct, I have a Dutch language version...) fixed it.

2) My keyboard layout was a mess in the xterm, I had to add "setxkbmap us" to c:\cygwin\usr\X11R6\bin\startxwin.bat (just below "run XWin....").

Optional Steps

Additing Optional Map Libraries

These additional Xastir libraries have been tested on Cygwin:

   ImageMagick
   Shapelib
   libtiff
   libproj
   libgeotiff
   Festival
   GDAL/OGR

Anyone testing additional libraries is encouraged to share their findings on the Xastir mailing lists. The libraries which have _not_ been made to work yet on Cygwin are:

   AX25
   GPSMan/gpsmanshp

The AX25 libraries will probably never work, as they are for Linux only. GPSMan/gpsmanshp may work on Cygwin at some point if enough work is done to figure out and document the process.

Shapelib

Note: As of 10 November 2006, xastir's source tree contains a copy of shapelib 1.2.10, and automatically builds shapelib if you don't have it installed. At this point, the only reason to follow the "Adding Shapelib" instructions below is if you need the shapelib shared libraries to work in other cygwin software. So unless you do, just skip this section and xastir's build process will automatically build and use its own "internal" shapelib support. Since the instructions below contain some "gotchas" that you have to work around, just using internal support is far easier if you don't need shapelib for other projects.

Building shapelib as an external library

Allows using many sources of online polygon, polyline, and point maps, including ones from NOAA. This is the only format used for weather alert maps.

[ ] From a BASH shell, type:

   cd ~/src
   mkdir shapelib
   

[ ] Fetch "shapelib-1.2.10.tar.gz" from one of these sites:

   http://shapelib.maptools.org/

or http://wetnet.net/~we7u/xastir/shapelib/

[ ] Put it in the C:\cygwin\home\<user>\src\shapelib directory.

[ ] Untar it from the BASH shell:

   cd ~/src/shapelib
   tar xzvf shapelib-1.2.10.tar.gz

[ ] Essential: Edit Shapelib's Makefile to remove the space after the "-h" on the line that looks like this:

   /usr/bin/ld -G -h libshp.so.1 -o .libs/libshp.so.$(LIBSHP_VERSION) shpopen.lo shptree.lo dbfopen.lo -lc

Change it to this (one space missing and 'c' changed to "cygwin"):

   /usr/bin/ld -G -hlibshp.so.1 -o .libs/libshp.so.$(LIBSHP_VERSION) shpopen.lo shptree.lo dbfopen.lo -lcygwin

I've had another report that says having the space is OK now. The "-lcygwin" is important to bypass the "__getreent" bug below.

Here are the commands to bring up an editor on the file:

   cd ~/src/shapelib/shapelib-1.2.10
   nano Makefile

[ ] Save the edited file, then type:

   make lib

[ ] You may get the "undefined reference impure_ptr" messages. If so, edit the file /usr/include/sys/reent.h to remove the word "extern" from this line:

   extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__;

then try "make lib" again.

[ ] Type:

   make lib_install

If you get "cp: cannot stat `.libs/libshp.la': No such file or directory", then you forgot to edit the Makefile. BZZZT! Please start again at step 1) above. Thank you for playing!

If you get something like: "Makefile:121: *** Missing separator. Stop.", then it's likely that while editing the Makefile you ended up with line-wrap on a line (one line broken into two or more lines because the editor thought it was too long). Combine the line into one line again and retry. Make sure not to delete any spaces that are there between items on the line, else you'll get different errors.

[ ] Now you should be ready to configure and compile Xastir with Shapelib support. Type these commands:

   cd ~/src/Xastir
   mkdir -p build
   cd build
   ../configure
   make
   make install

The installed copy of Xastir should now have Shapelib support. You can download NOAA weather alert maps and many other sorts of maps, and Xastir will recognize and use them. Note that weather alert shapefiles must go into the /usr/local/share/xastir/Counties directory. All other shapefiles must go into the /cygwin/user/local/share/xastir/maps directory (and subdirectories below that of your choosing).

See the HowTo:MAPS file for where to get the maps, and a script to automate the download/install for you.


Note from Gale Wilkinson, kc4pl:
> >
> > How do you get shapelib to "make" properly under cygwin?  I
> > have installed the latest cygwin (packages per the win32
> > install notes) and then downloaded and unpacked the latest
> > shapelib source package for compiling.  But when trying to do
> > the "make lib" it errors out part way through the process.
> > The error seems to be:
> >
> >  dbfopen.lo: In function 'DBFReadAttribute':
> > /home/gwilkinson/src/shapelib-1.2.10/dbfopen.c:724:undefined
> > reference to '__getreent'
> > /home/gwilkinson/src/shapelib-1.2.10/dbfopen.c:716:undefined
> > reference to '__getreent'
> > make: *** [lib] Error 1 
Dan Brown, n8ysz, responded:
>
> I wrote this to get/make shapelib:
>
> http://brauhaus.org/xastir/get_shapelib.sh
> or
> http://brauhaus.org/xastir/get_shapelib.sh.txt

This script is now also in the Xastir sources as "xastir/scripts/get_shapelib.sh".

ImageMagick

Note: Recent Cygwin installations include ImageMagick 6.0.4. Unfortunately, this install is linked against some X11 DLLs that no longer get installed by the most recent X11 package. See

  http://comments.gmane.org/gmane.os.cygwin.xfree/16493

for a work-around. Note: It appears this problem may have been fixed in the latest-latest (as of 13 November 2006) ImageMagick/Cygwin package.

The ideal solution to the problem mentioned above is to rebuild ImageMagick from source code instead of using the (now-unmaintained) Cygwin ImageMagick package. The instructions below walk you through a build of a much older version of ImageMagick, and should still be fairly accurate for a more recent vintage (as of this writing, ImageMagick versions are up over 6.2, meaning that both the version in Cygwin and the version mentione below are very old).

Allows using more than 68 different graphics format files as maps, by creating an associated .geo file for each with tie-points. This support also allows use of online Tiger and Terraserver maps with Xastir, and NOAA weather radar images. Other people are working on integrating even more online mapping sources. This will also allow you to use any GIF/JPG/XPM/BMP/... image as an Xastir map.

Note: The much older Cygwin binary for ImageMagick-5.5.5 has a problem in it's Magick-config script which makes it impossible to use for our purposes. Don't try to use that version. Some people reported a similar problem with 5.5.7.

Note that Xastir's "./configure" stage may fail trying to compile in ImageMagick support. If this happens, make sure you have the ImageMagick development package installed if using RPM packages, or have installed the ImageMagick header files. If it still fails, check the "config.log" file _very_ carefully. Often ImageMagick tests fail due to some other library that ImageMagick depends upon being absent, such as liblcms, libbz2, or others.

Until the RPM packagers for ImageMagick include all of the dependent libraries in their RPM dependency list, the best way to assure that ImageMagick is installed properly is to install it from sources.

ImageMagick:

       http://www.imagemagick.org/
   cd ~/src
   mkdir imagemagick

[ ] Download the ImageMagick cygwin binary from www.imagemagick.org or one of it's mirrors. If you can't find the version you need, try here:

   http://wetnet.net/~we7u/xastir/ImageMagick/cygwin/

[ ] Put it in the ~/src/imagemagick directory.

[ ] Extract the files:

   cd ~/src/imagemagick
   tar xzvf filename

[ ] Copy the files/directories into the /usr tree:

   cd ImageMagick-5.5.3
   cp -R * /usr

[ ] Reconfigure Xastir to use this library:

   cd ~/src/xastir/build
   ../configure

[ ] If "configure" did not find ImageMagick properly, edit the resulting config.h file and change this line:

   /* #undef HAVE_IMAGEMAGICK */

to this:

   #define HAVE_IMAGEMAGICK 1


[ ] Finish the Xastir build and install:

   make
   make install

[ ] Add this to your ~/.profile file (note this is a different file than the .bash_profile file):

   export MAGICK_HOME=/usr

Now on-line Tigermaps should work for you. Unfortunately it looks like the ".profile" file doesn't automatically get run if you start up the X-server from a windows shortcut. If you don't set the MAGICK_HOME variable in your shell that you start Xastir from, then ImageMagick will fail to display images and you'll get messages like "No decode delegate for this image format" in the xterm you started Xastir from. If that happens, you can close Xastir, type

   .  ./.profile

and then type "xastir &" again to make it work. Another option is to start X from within a standard Cygwin window. After starting X you can close the original Cygwin window. Yet another option is to create a script for starting Xastir so that you can set the MAGICK_HOME variable just before you start it. It could look something like this:

   #!/bin/sh
   export MAGICK_HOME=/usr
   xastir &

Perhaps name it "aprs". Issue this command to turn it into an executable file:

   chmod 755 aprs


Start it by typing "./aprs".


Note from Kirk Mefford, KC2ELO:

Also one more way to work around the "MAGICK_HOME" issues with running from the startxwin.bat file is to add "SET MAGICK_HOME=/usr" to the bat file before it gets to loading things. [remember DOS? ;)


I have Xastir loading directly from "startxwin.bat" with "run /usr/local/bin/xastir" and ImageMagick works fine with "SET MAGICK_HOME=/usr" at the top of the bat file.



HIGHLY RECOMMENDED: If you create a file called "terraserver.geo" in the /usr/local/share/xastir/maps directory, containing the single line "TERRASERVER-SATELLITE", and select it with the Map Chooser, you should see satellite images on the map screen. This is assuming that you have an Internet connection up and running of course. It fetches the images from the Microsoft Terraserver.

Also create a "terraserver-topo.geo" file in the same area somewhere. Inside that file put the keyword "TERRASERVER-TOPO". Selecting this map will fetch topo maps from the Microsoft Terraserver. More interesting keywords that can be used in other files are "TERRASERVER-REFLECTIVITY" and "TERRASERVER-URBAN". There should be files for all four Terraserver options installed in your /usr/local/share/xastir/maps/Online directory once you install Xastir.

This means if you're online, you can have access to street maps (Tigermap server), satellite images (Terraserver), and topo maps (again Terraserver)!

GeoTIFF

Note: Recent Cygwin installations include geoTIFF support, and if you installed everything in the list in step 1, you already have it. You only need to manually install libgeotiff if you did not have the 3 libgeotiff choices, the 2 libproj choices, and the proj choice available when installing cygwin, or if Xastir doesn't find libgeotiff.

Allows using USGS DRG topo maps or other types of geoTIFF maps/images and has the ability to tile smaller maps into a larger contiguous map of an area:

[NOTE: when checked on 30 Oct 2004, it is now possible to install libproj and libgeotiff directly from cygwin setup. Since at least one user has had considerable trouble installing xastir with geotiff using the instructions below, it is recommended that these libraries be installed through cygwin setup instead. Be sure to install the "-devel" versions that will include headers and libraries needed to compile xastir.]

For geoTIFF support (such as USGS DRG topo maps) you need one each of libproj, proj-nad27, and libgeotiff:


   libproj (tested with proj-4.4.7):
   ---------------------------------
       http://www.remotesensing.org/proj/

or http://wetnet.net/~we7u/xastir/libproj/


   Datum translations (tested with proj-nad27-1.1):
   ------------------------------------------------
       ftp://ftp.remotesensing.org/pub/proj/

or http://wetnet.net/~we7u/xastir/libproj/


   libgeotiff (tested with libgeotiff-1.2.0):
   ------------------------------------------
       http://www.remotesensing.org/geotiff/geotiff.html

or ftp://ftp.remotesensing.org/pub/geotiff/libgeotiff/ or http://wetnet.net/~we7u/xastir/libgeotiff/


Please note that the order of installation for these libraries is critical. If not installing from cygwin setup, please be sure to follow the instructions below carefully.


Adding libproj to Cygwin (tested with proj-4.4.7):


Again, if you installed everything suggested in step 1, you already have this and building libproj from source is unnecessary.

NOTE: You must install libproj BEFORE compiling libgeotiff, because libgeotiff uses libproj to do the datum translations. If you install libgeotiff first, datum translations won't work.

[ ] Type:

   cd ~/src
   mkdir libproj

[ ] Download the libproj and proj-nad27 files and place them in the ~/src/libproj directory.

The proj-nad27-1.1.tar.gz must be decompressed in the and subdirectory of the proj distribution directory before you run configure.

[ ] Type:

   cd ~/src/libproj    
   tar xzvf proj-4.4.7.tar.gz
   cd proj-4.4.7/nad
   tar xzvf ../../proj-nad27-1.1.tar.gz
   cd ..
   ./configure
   make
   make install


[ ] These next few commands are required for now, but once libgeotiff is fixed so that it finds libproj properly on Cygwin, they'll be removed from the libproj instructions:

   cd /usr/lib
   ln -s /usr/local/lib/libproj.a
   ln -s /usr/local/lib/libproj.la


Adding libgeotiff (tested with libgeotiff-1.2.0):


[ ] Type:

   cd ~/src
   mkdir libgeotiff

[ ] Download libgeotiff-1.2.0 and place it in the libgeotiff subdirectory.

   cd ~/src/libgeotiff
   tar xzvf libgeotiff-1.2.0.tar.gz
   cd libgeotiff-1.2.0
   ./configure
   make
   make install

If you must re-run "configure" for any of these libraries, remember to delete "config.status" and "config.cache" files first.

[ ] You may get the "undefined reference impure_ptr" messages (just like with Shapelib above). If so, edit the file /usr/include/sys/reent.h to remove the word "extern" from this line:

   extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__;

then try "make" and "make install" again.

I've had it compile all the way through, but I've also had it bomb out when it gets to the "ld -shared" step. At that point it writes a lot of "undefined reference" messages. The line at which the compile might fail:


   ld -shared xtiff.o geo_free.o geo_get.o geo_names.o geo_new.o
   geo_print.o geo_set.o geo_tiffp.o geo_write.o geo_trans.o
   geo_normalize.o geotiff_proj4.o geo_extra.o cpl_serv.o cpl_csv.o -lproj
   -ltiff -ljpeg -lz -lm -L/usr/local/lib -o libgeotiff.so.1.1.5


To fix this, edit the Makefile to add "-lc" to the end of the LIBS line and run "make" again, then "make install".


[ ] TEMPORARY: It looks like we need to switch to a newer version of the libtiff DLL in order to work with libgeotiff. Some Cygwin installations end up with this "cygtiff3.dll.new" file installed in /bin, some do not. If the images appear to load but always come up black, you need to get a different cygtiff3.dll file that works on your system. Below are the instructions for fixing this problem if that file is already present:

   cd /bin
   mv cygtiff3.dll cygtiff3.dll.old
   cp cygtiff3.dll.new cygtiff3.dll


[ ] Set up Xastir to use the new geotiff libraries:

   cd ~/src/xastir/build
   ../configure
   make
   make install

It should find libtiff/libproj/libgeotiff at the configure stage and compile in support for geotiff maps. You should now be able to use USGS geoTIFF topo maps, and see them tiled together in the map window into a continuous map.

Festival

Allows using a synthesized voice from within Xastir for alerts, reading messages to you, and other cool things. Tom Russo did the initial work on this, Henk de Groot optimized it:

1) Start BASH shell in Cygwin

2) Make ~/festival download directory and /usr/local/festival installation directory

3) Download festival components from festvox.org into ~/festival, in the Windows environment the corresponding path is:

    C:\Cygwin\home\%USERNAME%\festival
   get the following files:
    speech_tools-1.2.95-beta.tar.gz
    festival-1.95-beta.tar.gz
    festlex-CMU.tar.gz
    festlex-POSLEX.tar.gz
    festvox-kallpc16k.tar.gz

4) Build festival and company:

   cd /usr/local/festival
   tar xzf ~/festival/speech_tools-1.2.95-beta.tar.gz
   tar xzf ~/festival/festival-1.95-beta.tar.gz
   tar xzf ~/festival/festlex_CMU.tar.gz
   tar xzf ~/festival/festlex_POSLEX.tar.gz
   tar xzf ~/festival/festvox_kallpc16k.tar.gz
   cd speech_tools
   ./configure && make
   cd ../festival
   ./configure && make
  These packages are build and used where they are compiled.

5) Test festival:

   cd /usr/local/festival/festival/examples
   sh saytime
  Festival should say the time if everything went fine

6) Add /festival/festival/bin to PATH in .profile and .bashrc. For me both files look like this:

   .profile and .bashrc:
   -------------------
   export PATH=$PATH:/lib:/usr/lib:/usr/X11R6/lib:/usr/local/lib:/usr/local/bin:/usr/local/festival/festival/bin:~/bin:.
   -------------------

7) Configure and build xastir. Configure should report that festival is found.

8) Start the festival server:

   festival --server &
  To do this automatically I added the following lines to my .bash_profile:
   -------------------
   if  [ `ps -ef | grep festival | wc -l` -eq 0 ]
   then
     festival --server &
     sleep 1
   fi
   -------------------

9) Run xastir, do File->Configure->Speech, add things to say, and listen.


How to make Sound Alerts work under Cygwin


(from Kirk Mefford, kc2elo) "I figured I'd share exactly what I did to make the sound alerts work in xastir under Cygwin. Sound support seems to be just one of the many quirks of trying to use *nix native software under Microsoft OS's. Hope this helps someone else.

FYI: This was tested under Win2000

Sound alert support under Cygwin using Network Audio Server (NAS)

I downloaded http://nas.intra-links.net/files/nas-1.6-win-binary.zip and decompressed the archive with winzip (any zip utility should work fine) into a temporary folder.

I deleted the "cygwin1.dll" and "README.txt" files that came in the package since they aren't needed and the extra cygwin1.dll can cause problems.


 Note from James Cour, K1ZC:
 ---------------------------
 "The procedure he (Kirk) outlines there works fine EXCEPT that
 there is a valuable piece of information in that Readme.txt file...
 The user must have a folder named /DEV under the Cygwin folder in
 order for NASD to work.  NASD will not create it automatically, and
 NASD will not run without it.  The default set-up instructions for
 Xastir and Cygwin do not create this folder, so the user needs to
 manually create the folder from Windows."


 Note from Tim Baggett, AA5DF:
 -----------------------------
 "I recommend running the script (create_devices.sh) found attached
 to the email located at the URL below to create the /dev directory,
 and all supported devices under Cygwin."
 "http://cygwin.com/ml/cygwin-xfree/2004-01/msg00353.html"


Then copy the remaining files from the package into the /bin directory under cygwin.

All that is needed to make nas available to xastir is to load the server before running xastir.

To load NAS for xastir to use simply type "nasd -local -b" from cygwin. This command will load the NAS server in the background and will only allow local users to access it. For more command options type "nasd -help" from within cygwin. Some people have trouble with the "-local" option, so try it without that option as well ("nasd -b").

After NAS is loaded you can load xastir as you normally would.

Once xastir is running, to play sound alerts you need to change the default configuration to use "auplay"

From within xastir click on File>Configure>Audio Alarms. The "Audio Play Command" box should be changed to "auplay" Then ensure the audio files listed to play are located in "/usr/local/share/xastir/sounds" directory.

Click OK to accept the changes and be sure to save your config before exiting xastir or sound will not work the next time it is loaded.

Turn up the volume on your PC speakers and enjoy the noise xastir makes."


GDAL/OGR

One user has been successful in compiling GDAL/OGR support into Xastir. One thing he mentioned:

"Now the word of warning. If you try to compile GDAL under Cygwin and the compile blows up, you are better rm -rvf'ing the entire directory and re-untaring the source again than trying to recompile in that blown directory. Make Clean doesn't do a thing and the old settings and mistakes stick around no matter what you try."

Make sure you've got Shapelib installed on your system else Xastir won't find GDAL. Both are needed.

Download "gdal-1.2.0b.tar.gz". In a cygwin window, type the following:


   tar xzvf gdal-1.2.0b.tar.gz
   cd gdal-1.2.0b
   ./configure --with-jpeg=internal --with-libtiff=internal
   make
   make install


The GDAL/OGR library should now be installed on your system. Return to the xastir directory and start with the ./configure command. It should pick up the fact that GDAL/OGR has been installed and compile support for it into Xastir. Follow with the rest of the commands to make/install Xastir.

One user required the below GDAL configure line as otherwise it complained about not finding libproj:

   cd ~src/Xastir/build
   ../configure --with-jpeg=internal --with-libtiff=internal --with-static-proj4