Objective-C SWARM
at Ubuntu 8.04

Jakson Aquino

 


Note: These instructions are outdated. People are reporting being unable to run their models in recent versions of Ubuntu.

 

I used the Objective-C version of swarm in my doctorate thesis because it was free software and was not an interpreted language, like java. The model that I was developing was quite complex and I thought that running it through an interpreted language would be slower than running a compiled binary. I thought Swarm was a good choice. However, after finishing my doctorate, I translated my model into C++ and it became about 2-3 times faster than the one written in Objective-C with swarm. Thus, now I plan to continue the development of my virtual anthropoids in C++, without any agent based model toolkit. I still have to compare C++ with java, since java has many performance optimizations that might make the model run faster than when written in C++. Anyway, I still keep here the quick guide to build Objective-C Swarm and the packages for Debian and Ubuntu.

 

Building swarm: a quick guide

The steps below were tested in Ubuntu 8.04. New versions might require slightly different procedures.
  1. Enable the “universe” repository if it isn't enabled yet.

  2. Then, update your list of available software. That is, open a terminal and type (or copy and paste):
       sudo apt-get update
    
  3. Install the software necessary to download and compile swarm:
       sudo apt-get install gobjc gperf libxpm-dev libpng12-dev \
    	automake emacs21-nox libhdf5-serial-dev blt-dev \
            autoconf libtool make xfonts-75dpi xfonts-100dpi
    
  4. Now, you can download the swarm source code from Paul Johnson's web site:

       wget http://pj.freefaculty.org/Swarm/swarm-2.2.4.tar.gz
       tar -xzf swarm-2.2.4.tar.gz
       cd swarm-2.2.4
    
  5. Then, you can compile swarm:
       ./autogen.sh
       ./configure --with-pic --enable-onelib --with-gnu-ld \
          --disable-jar --with-tcl=/usr/lib/tcl8.4/ \
          --without-jdkdir --with-tk=/usr/lib/tk8.4/
       make
       sudo make install
    
    Note: If you are using a version of Ubuntu older than 8.04 you will have to pass different parameters to the configure script.

  6. Swarm is already installed. You should now put this line at the end of your ~/.bashrc, because, by default, the Makefiles that come with swarm applications are configured to look for swarm at /usr, but since we installed it at /usr/local, we need to inform the Makefiles about this:
    export SWARMHOME=/usr/local
    
    In addition to putting the above line in your ~/.bashrc, copy and paste it in your terminal too. When you logoff and login again the .bashrc will be re-read and the SWARMHOME environment variable automatically will be active.

  7. Finally, you can download, compile and run some examples:
       wget http://ftp.swarm.org/pub/swarm/apps/objc/sdg/swarmapps-objc-2.2-3.tar.gz
       tar -xvzf swarmapps-objc-2.2-3.tar.gz
       cd swarmapps-objc-2.2-3/heatbugs/
       make
       ./heatbugs
    

 

 

Debian package

To build and install a Debian package of swarm using Ubuntu, install all build dependencies (see the Quick Guide above) and, then, do the following commands in a terminal:
   sudo apt-get install build-essential dpkg-dev debhelper fakeroot
   wget http://pj.freefaculty.org/Swarm/swarm-2.2.4.tar.gz -O swarm_2.2.4.orig.tar.gz
   wget http://jalvesaq.googlepages.com/swarm_2.2.4-1.diff.gz
   wget http://jalvesaq.googlepages.com/swarm_2.2.4-1.dsc
   dpkg-source -x swarm_2.2.4-1.dsc
   cd swarm-2.2.4
   dpkg-buildpackage -rfakeroot -uc -us
   cd ..
   sudo dpkg -i libswarm_2.2.4-1*.deb libswarm-dev_2.2.4-1*.deb
NOTE: Debian/Ubuntu and Red Hat/Fedora use different file system hierarchies. If you are using the Debian package, you'll have to change one line of the Makefiles of your swarm applications from:
include $(SWARMHOME)/etc/swarm/Makefile.appl
to
include /usr/share/libswarm/etc/Makefile.appl
If you just want to run a precompiled model, you don't need neither libswarm-dev nor libswarm-dbg, and if you don't want to build swarm yourself, you can use the binaries I've built for:

Ubuntu 8.04 (Hardy Heron) i386:md5sum
libswarm_2.2.4-1_Hardy_i386.deb26fa93a5393c463c8924458bc8f3da30
libswarm-dev_2.2.4-1_Hardy_i386.deb67a9bf87dcd8bf013839e703fa5bdf11
libswarm-dbg_2.2.4-1_Hardy_i386.deb4a84cf4ae5ff654c40bee2665aa52151
  
Ubuntu 8.04 (Hardy Heron) amd64:md5sum
libswarm_2.2.4-1_Hardy_amd64.deb5284702387314276e13b15cf08dd309e
libswarm-dev_2.2.4-1_Hardy_amd64.deb42c9f0d16c4dc70c1e50fefb653d9fc3
libswarm-dbg_2.2.4-1_Hardy_amd64.debd4a087f42429cae666c5baac60872a0e
  
Debian Etch (4.0)md5sum
libswarm_2.2.3-1_Etch_i386.deb22001507e06d8880df53379e7d5e9e61
libswarm-dev_2.2.3-1_Etch_i386.deb33958c3f836cc4b3854e66f617df4341
libswarm-dbg_2.2.3-1_Etch_i386.deb9349bc381b5e6a51643439614d238d3c

June, 2009