Setting up Swarm on Debian Unstable
This page describes how Swarm
was installed and configured on gamera, and is intended to be helpful for
students installing Swarm on their own computers.
Other resources
Required Debian Packages
These packages from Debian Unstable are
required to run the Java and Objective-C versions of Swarm, and to compile the
example applications. Install them using "apt-get install packagename".
- jikes
- tcl8.3
- tk8.3
- tk8.3-dev
- blt
- blt-dev
- libpng2
Required Third-Party Packages
These are required packages from
elsewhere on the web.
When downloading the JDK, choose "J2SE 5.0 Beta 2" (or a newer one if
available), then follow the "SDK" download link, not the JRE. Choose the "Linux
self-extracting file" option, not the RPM. Once the file is downloaded, make it
executable ("chmod +x file.bin") and run it ("./file.bin"). It will produce a
new directory, "jdk1.5.0" - move this to /usr/local, so its new location is
/usr/local/jdk1.5.0.
Install downloaded Debian packages using "dpkg -i package.deb".
put bltGraph.tcl in /usr/lib/blt2.4/
Symbolic links
These are links required to allow the hard-coded
paths in the Swarm packages to work.
- ln -s /usr/lib/libBLT.2.4.so.8.3 /usr/lib/libBLT24.so
- ln -s /usr/lib/libtk8.3.so.1 /usr/lib/libtk8.3.so
- ln -s /usr/lib/libtk8.3.so /usr/lib/libtk.so.0
- ln -s /usr/lib/libtcl8.3.so.1 /usr/lib/libtcl8.3.so
- ln -s /usr/lib/libtcl8.3.so /usr/lib/libtcl.so.0
- ln -s /usr/local/bin/jdk1.5.0 /usr/local/j2sdk1.4.0
Environment variables
These are required for java and swarm to find
their libraries at runtime. You can specify them manually on the terminal before
running, in your user init scripts, or in the system-wide init scripts.
- export SWARMHOME="/usr"
- export CLASSPATH=".:/usr/share/swarm/swarm.jar"
- export LD_LIBRARY_PATH="/usr/lib/swarm"
Additionally, you may wish
to include the bin directory from your new JDK installation in your PATH,
specified in .bash_profile and .bashrc for single users and in /etc/profile and
/etc/bash.bashrc for system-wide. This is not necessary for Swarm.
Makefile changes
Additional changes to the Makefile required to
compile packages
- In /usr/etc/swarm/Makefile.common, change references to 'gcc3' into 'gcc'.
- Also in /usr/etc/swarm/Makefile.common, change the compiler optimisation
flag '-O2' to '-O1' (this is required to avoid a compiler warning).
Example code (and modifications required)
The example packages can be
obtained here: Objective-C
swarm apps and Java
Heatbugs. Download and unpack them in your home directory. The following
code modifications are required to compile them correctly:
Java:
- On line 298 of HeatbugModelSwarm.java, change "new FArgumentsImpl
(this, sel, true)" to "new FArgumentsImpl (this, sel)". This requirement seems
to result from an API change of some sort.
Objective-C:
- Code which looks like this:
[[[C1GraphElem setLabel: "NumInteractions"] setColor: "green"] setWidth: 1];
must
be 'unstacked' into separate statements, like this:[C1GraphElem setLabel: "NumInteractions"] ;
[C1GraphElem setColor: "green"];
[C1GraphElem setWidth: 1];
This occurrs in several places in each file - simply unstack the
statement at the line indicated wherever you receive a warning like:warning: invalid receiver type `void '
These changes have
already been made to the example packages named above at the following location
on gamera: /usr/local/share/swarm - you can simply copy this directory
to your home directory to test whether your system is working.
Compiling and running
To compile an application, run make in the application's
directory.
To run an application:
- Java: javaswarm AppName
- Objective-C: ./appname
Make sure that you have an X11
environment available when you run the applications. Failing to do this will
produce an obscure error: TkExtra. To be certain you have an X11
environment, run an application such as xeyes or xlogo and
check whether it displays on your screen.
James Ballantine, 6/7/04