Cygwin

I use cygwin quite a bit when I need to emulate Linux functionality in a windows environment. We've managed to get the OMG code bundle compiled and running in a cygwin environment also (with help from Mark Paton at IVS3D). Here's a little "how-to" to help you get up and running with cygwin.


Cygwin Installation

  1. There is a set of "must-have" packages when installing cygwin for OMG purposes, I've taken the liberty of making a small .zip file with these packages to save you the trouble of finding out which packages are necessary by trial and error. The packages are available here, download the file and unzip it somewhere handy. I usually make a c:\installs\ directory and then put all installation files in there. This directory contains the files to be installed and is distinctly different from the folder in which you'll install cygwin.
  2. Go to www.cygwin.com, download setup executable and run it (or get the latest version that I've used here).
  3. When running the setup program, it will prompt for an "internet installation" or a "local installation". Choose "local installation". If you want to do an internet installation, follow the instructions here.
  4. Once packages have been selected and downloaded (or you're installing from a local directory), select the cygwin installation directory (default is C:\cygwin). The defaults work fine at this point.
  5. If installing from a local directory, browse for the downloaded packages files directory at this next step, you'll need to point it to the folder where you unzipped the packages and NOT the "release" directory within the unzipped package folder.
  6. Select ALL packages for installation at the next step, you can do this by clicking on the word "Default" at the top of the list until it reads "Install".
  7. The installation will take a few minutes so go grab a coffee.

Internet Installation

If you decide to do an internet installation, you'll need to select several packages. If you want to run swathed/jview and other OMG command line programs, choose the following packages:


If you want to compile OMG software, you'll need the following in addition to above:
Other handy packages:

Setting up OMG working environment

Double-click the cygwin icon on the desktop (or hunt for it in the start menu). This will fire up a dos prompt in which cygwin will be started. The first time you run it, it will create a home directory for you in C:\cygwin\home\username. If you have a space in your username, you'll have a tough time getting OMG code to compile. The default installation of cygwin will run with a bash shell but most of us work in a tcsh environment in OMG. If you want to use tcsh, you'll need to do the following stuff.

  1. Open up a file browser and navigate to c:\cygwin. Open the cygwin.bat file in notepad for a bit of editing (only differences are in the last line, change bash to tcsh):
    	@echo off
    
    	C:
    	chdir C:\cygwin\bin
    
    	tcsh -l
    
  2. Close notepad, make sure to save changes.
  3. Copy over this .cshrc file into your new cygwin home directory. Depending on what type of browser you're using, the .cshrc file might have a strangely different name once downloaded. You'll need to rename it to .cshrc in order for it to work.
  4. Start cygwin from the programs menu in the start menu.

Getting an X environment working

  1. Start cygwin if it isn't started already.
  2. Copy /etc/X11/xinit/xinitrc to ~/.xinitrc by typing the following command:
    	cp /etc/X11/xinit/xinitrc ~/.xinitrc
    
  3. If you're a sucker for tcsh, then edit ~/.xinitrc, and change the last line to run an xterm with a tcsh shell instead of the default bash shell:
    	exec xterm -e /usr/bin/tcsh -l
    
  4. Now type "startx" to get an X server running. Windoze may warn you about firewalls, etc...you'll need to allow X to have access in order for it to work. You should be able to run jview, swathed, etc, in the newly opened shell.

Setting up the OMG programming environment

  1. Download the latest code bundle from our software portal. The password is only available to members and sponsors of the OMG.
  2. Copy over the code bundle into your new cygwin home directory and unpack it:
    	tar -zxvf code_20080521.tgz
    
  3. Make your way to the code directory and execute the following command:
    	compile_every_gd_thing
    
    This script will make a "local" directory in your home directory and put everything that it compiles into there. It will warn you to add the local directory to your path and setting a few environment variables, you can ignore this if you used the .cshrc file provided in the "how-to" as they are set for you already.
  4. Type "rehash" to refresh your path with all the new programs.

Cygwin scripts

  1. do_backup: this script backs up a local directory into another directory, most likely a network drive or USB disk. The script only backs up files whose size change (so that you don't copy over files that have been backed up already). You can have the script repeat the backup after waiting a specified number of seconds. This is particularly useful for backing up data during acquisition.

Uninstall of cygwin

  1. You can delete the install directory, usually C:\cygwin if you followed the defaults during the installation. This will delete your home directory as well.
  2. If you REALLY want to clean up after cygwin, you can remove a few cygwin related entries in the registry using regedit4. Look for the following registry entries and remove them.
    HKEY_LOCAL_MACHINE\Software\Cygnus Solutions
    HKEY_CURRENT_USER\Software\Cygnus Solutions
    HKEY_USERS\.DEFAULT\Software\Cygnus Solutions
    

Last updated by J. Beaudoin, May 29, 2008