Windows binary notes

From Swarm
Revision as of 17:42, 2 December 2015 by SwarmWikiSysop (Talk | contribs) (Created page with "{{SwarmFAQ}} '''This page refers to Swarm 2.2 in Cygwin; we now strongly recommend instead using Swarm in Windows via the MinGW compiler. See Swarm_and_MinGW|the MinGW rele...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Template:SwarmFAQ

This page refers to Swarm 2.2 in Cygwin; we now strongly recommend instead using Swarm in Windows via the MinGW compiler. See the MinGW release page.

Q: How do I install the Windows binary distribution of Objective-C Swarm-2.2?

A: Is in several parts, below. Note that Java Swarm 2.2 no longer requires Cygwin, only a simple download (see the stable release page).

Windows-specific differences from Swarm-2.1.1

Unlike the previous stable version of Swarm, version 2.2 runs reliably under Windows XP. Objective-C users may notice less of an execution speed penalty for running in Windows, compared to Linux, depending on the application. If you were an Objective-C user of Swarm-2.1.1, you will notice that Version 2.2 uses a new Obj-C compiler that behaves differently in minor ways. For example, it produces more output while linking (just where you would get fatal error messages in the old compiler), and it may balk (or give warning messages) at minor programming faux pas that the previous compiler ignored.

Changes in how Objective-C Swarm Windows binaries are distributed

For Windows, Objective-C Swarm works within the Unix-like environment provided by Cygwin (http://www.cygwin.com). However, the approach to installing Cygwin and Swarm has changed. Version 2.1.1 (and earlier stable Windows distributions) included Cygwin in the Swarm distribution, so installing Swarm also installed Cygwin. Then, in the development versions preceding 2.2, it was necessary to first install Cygwin, then install Swarm within Cygwin.

With Version 2.2, we are now including Swarm as a package within a special Cygwin distribution. (Swarm is *not*, and probably never will be, distributed by Cygwin as a part of their standard distributions.) You should not install Cygwin separately first; instead, just use the Swarm-specific Cygwin setup program we provide.

Note that the Cygwin distributed with Swarm-2.2 is the version of Cygwin that was current as of December, 2004. We do not plan to update our distribution to keep current with future changes in Cygwin. If you want to update your Cygwin in the future, you can do so from the Cygwin site but you will be responsible for any effects it has on Swarm.

The Cygwin setup program lets you select which packages to install. Cygwin distributes a wide variety of packages that do many different things, most of which are not used by Swarm, and the complete distribution is very large. If you follow the default selections during setup, you will get a version of Cygwin that includes everything you need to run Swarm and do other basic things, but many of the unrelated optional packages will not be installed. Using the default setup, you should end up with about 135 megabytes of installed code.

How to distribute Swarm-2.2 Windows binaries yourself

Sometimes it is desirable to put Swarm on a CD so you can distribute it yourself, for example so your clients can install and run your model. Unfortunately, we are still without a simple, reliable way to do this with Objective-C Swarm 2.2.

Among the setup program's options is the ability to download the install files from the internet to a local directory, then install from the local directory. This seems like a good way to distribute Swarm-2.2: download the install files and put them and the setup program on a CD, so others can install from the CD. HOWEVER there apparently is a bug in the Cygwin setup program that can keep this from working: you may be able to install from a local directory (CD or hard disk) but then Cygwin may not work. Only the setup program's option to install from the internet seems to be reliable.

The only option currently available is collection of packages that Pietro Terna developed to install Cygwin separately, then install Swarm within Cygwin. The files and information are at http://eco83.econ.unito.it/swarm/materiale/cd/ : look at the readme.txt file. This distribution contains also other useful things. Pietro has even very kindly been distributing CDs upon request.

Installing the Windows binaries

  1. Uninstall any previous versions of Cygwin or Swarm. For previous installations of Cygwin, just delete all its files.
  2. Execute (directly, or after first downloading it) the Swarm-specific Cygwin setup program, which is here: http://ftp.swarm.org/pub/swarm/binaries/w32/cygwin/setup.exe
  3. Select the download source as "Install from internet".
  4. When this setup program asks you which site to download from, select "ftp.swarm.org".
  5. If in doubt, just hit "Next" for all other selections. A window lets you select which components of Cygwin you want to install; it is safest to just hit "Next" and not change anything.
  6. One of the setup options is whether to use Unix or Windows file types. Unix and Windows have different line end characters in ASCII files, and this option determines which type your Swarm model will expect and produce. If you choose Unix, your Swarm code will expect input files to be in Unix format and will not be able to read files generated by Windows applications like Excel. (Cygwin includes the two utilities "dos2unix" and "unix2dos" that convert files, but be aware that these utilities will ruin your executable files if they attempt to convert them.)

Setting SWARMHOME

In Version 2.2, the environment variable SWARMHOME should be set to "/usr".

You can set it in your makefile, or you can temporarily set SWARMHOME from the Cygwin terminal window by entering:

   export SWARMHOME=/usr

Or you can permanently set SWARMHOME by (a) going to the Windows control panel and opening the System window; (b) clicking on the "Advanced" tab in the System window; (c) clicking on the "Environment variables" button; (d) in the "User variables" window, create a new environment variable called SWARMHOME with the value:

   C:\Cygwin\usr

Or you can permanently set SWARMHOME by creating a file named ".bashrc" that includes at least these two lines:

   #!/bin/bash
   export SWARMHOME=/usr

Save the file in your Cygwin home directory.

Note: Your Cygwin home directory is the directory that Cygwin starts up in. It usually is:

C:\Documents and Settings\(your user name). 

Or, sometimes:

c:\cygwin\home\(your user name).

Uninstalling Swarm and Cygwin

Cygwin does not come with an uninstaller; it must be manually uninstalled. Briefly, that means deleting all its files and then manually removing any entries related to Cygwin in the Windows registry (via the command-line program "regedit"). There are instructions in the Cygwin site's FAQ.

More information

Pietro Terna's instructions for installing the pre-release of Swarm-2.2 are not completely accurate for this stable release but they still provide useful information on topics such as using the Cygwin setup program and creating a .bashrc file. See "instructions.pdf" at http://eco83.econ.unito.it/swarm/materiale/cd/swarm_2.2_cd/

Additional information on Cygwin is at: http://www.cygwin.com/