Swarm and Ubuntu 14.04: Package uploads

A couple of very pleasant students have been writing to ask for help on running some Swarm apps and yesterday I decided to rebuild some packages to try to smooth out the process. Here are the things I can remember. This process is getting more and more like a stitched together set of my guesses because I have never been comfortable with automake and autoconf languages.

First, some system changes.

1. the dash shell is default, but it doesn't work. It is necessary to replace that with bash. That will be needed for various other research software, so just do it.

Look in /bin, see that sh is a symlink to dash? Replace it

sudo ln -sf /bin/bash /bin/sh

2. It is VITAL that gcc-4.6 and gobjc-4.6 be available. Install those packages, then make the system use them. I did this

sudo ln -sf /usr/bin/gcc-4.6 /usr/bin/gcc

That's not the least intrusive method, you could set the environment.

# export CC=gcc-4.6

I think should suffice. You have to remember to do this all the time.

3. The debian packages for blt and swarm are required.

https://pj.freefaculty.org/Ubuntu/14.04/i386

https://pj.freefaculty.org/Ubuntu/13.10/amd64

Today I did a new Ubuntu 32 bit set. I was mistakenly thinking that was a user's priority need, but after I figured out how to make that work, I knew how to fix the 64 bit things as well.

These are minimally required

https://pj.freefaculty.org/Ubuntu/14.04/i386/blt/blt-dev_2.4z-8pj8.5_i386.deb
https://pj.freefaculty.org/Ubuntu/14.04/i386/blt/blt_2.4z-8pj8.5_i386.deb

https://pj.freefaculty.org/Ubuntu/14.04/i386/swarm/libswarm-dev_2.4.1-5_i386.deb
https://pj.freefaculty.org/Ubuntu/14.04/i386/swarm/libswarm0_2.4.1-5_i386.deb

If you want to try Java Swarm (which I don't use)
https://pj.freefaculty.org/Ubuntu/14.04/i386/swarm/libswarm-java_2.4.1-5_all.deb

I built these in a brand new virtual machine with Ubuntu 14.04, i386. I believe if you are on an U buntu amd64 system, you could install the i386 packages if your system is set up to allow multilib. These i386 will bring in a number of other 32 bit packages. I expect it will draw in 32bit versions of tcl, tk, gcc, blt, and, well, maye lots of others. We are stuck there in i386 land if we want to try Java Swarm. There is a fairly deep, fundamental problem in the foreign language interface that blocks us to only use gcc-4.6 and also prevents 64 bit use of Java.

On a 64 bit system, I did not yet make packges for Ubuntu-14.04, but I think these will work:

https://pj.freefaculty.org/Ubuntu/13.10/amd64/blt/blt-dev_2.4z-8pj8.5_amd64.deb
https://pj.freefaculty.org/Ubuntu/13.10/amd64/blt/blt_2.4z-8pj8.5_amd64.deb

https://pj.freefaculty.org/Ubuntu/13.10/amd64/swarm/libswarm-dev_2.4.1-4_amd64.deb
https://pj.freefaculty.org/Ubuntu/13.10/amd64/swarm/libswarm0_2.4.1-4_amd64.deb

On my own 64 bit laptop, I still have Ubuntu 13.10, and I have built packages for that as well. The BLT package is basically the same as the one I offer for 32 bit systems, except (for reasons I don't entirely understand) the -fPIC compiler flag comes into play. But it works.

The dbg packages are not required to compile and run programs, but they are needed to run them in gdb.

The blt provided with Ubuntu 13.10 or 14.04 won't work because it tries to marry together tcl tk 8.5 and 8.6 in a way that causes programs to crash. The good news is that the Debian team incorporated all the patches I put together for blt and tcl 8.5, so it was a relatively easy thing to take their packaging for blt in 14.04 and re-set it to use only tcl/tk 8.5. I was very glad to see they incorporated those blt packages, it is now a much cleaner set of patches.

Oh, I signed these with my Debian packaging signing key. Its registered on their worldwide network.
You'll find it in the network if you check for:
Paul E. Johnson (Debian Packaging)

You either need to accept that key or you tell you system to ignore keys.

4. To test the installation, work with the objective C Swarm progams. Start with heatbugs and schelling Swarm from here:

https://pj.freefaculty.org/Swarm/swarmapps-2.3.0.tar.gz

When you try to compile, it will be necessary to set SWARMHOME to "/". Not /usr as we have in most of the examples. You can do that in your environment or by editing the program's Makefile.

When you test these, please PLEASE read the README files and try the special compiler arguments to use PNG and HDF5 when available. It turned out yesterday that one person thought Swarm was installed and working because heatbugs ran, but he did not realize he was lacking PNG or HDF5 support because he was not trying any of those features.

5. Some compiles will fail because gcc's linking policy has changed. Libraries that we took for granted now must be named explicitly. This came up when I used a math symbol, the error has something about DSO blah. Here is an example from my 64 bit system:

AVLSet.m: In function ‘compare_object_ids’:
AVLSet.m:21:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
AVLSet.m:22:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
AVLSet.m: At top level:
AVLSet.m:440:1: warning: incomplete implementation of class ‘AVLSet’ [enabled by default]
AVLSet.m:440:1: warning: method definition for ‘-conformsTo:’ not found [enabled by default]
AVLSet.m:440:1: warning: class ‘AVLSet’ does not fully implement the ‘DefinedObject’ protocol [enabled by default]
gcc -c -g -O2 -fgnu-runtime -fno-strict-aliasing -Wall -Wno-import -Wno-protocol -Wno-long-long  -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -DAPPNAME=opinion -DAPPVERSION=2.1.1 -DBUGADDRESS=bug-swarm@swarm.org   -I/usr/include/swarm  SwarmInteger.m
/bin/sh /usr/bin/libtool-swarm --mode link /usr/bin/gcc-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -L/usr/lib/x86_64-linux-gnu/swarm -rpath /usr/lib/x86_64-linux-gnu/swarm    -o opinion main.o Parameters.o ModelSwarm.o ObserverSwarm.o BatchSwarm.o MultiGrid2d.o MultiGridCell.o AppSpecificCell.o MyArguments.o  Attribute.o BatchRaster.o BatchColormap.o CountHeads.o Citizen.o Axelrod.o HJCitizen.o SelectiveCitizen.o Coleman.o MikePM2.o MovingAverage.o Position.o TimeStamp.o AVLSet.o SwarmInteger.o  -lswarm
libtool-swarm: link: /usr/bin/gcc-4.6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -o opinion main.o Parameters.o ModelSwarm.o ObserverSwarm.o BatchSwarm.o MultiGrid2d.o MultiGridCell.o AppSpecificCell.o MyArguments.o Attribute.o BatchRaster.o BatchColormap.o CountHeads.o Citizen.o Axelrod.o HJCitizen.o SelectiveCitizen.o Coleman.o MikePM2.o MovingAverage.o Position.o TimeStamp.o AVLSet.o SwarmInteger.o  -L/usr/lib/x86_64-linux-gnu/swarm /usr/lib/x86_64-linux-gnu/swarm/libswarm.so -Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu/swarm -Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu/swarm
/usr/bin/ld: ModelSwarm.o: undefined reference to symbol 'pow@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: ld returned 1 exit status
make: *** [opinion] Error 1

Read the error. It is saying a function pow is not defined, meaning its library is not linked. We need it to use the math library, libm, for which the flag is "lm". I found a fix is to insert this in the app's Makefile

APPLIBS=-lm

I put that right before the line that says:
include $(SWARMHOME)/etc/swarm/Makefile.appl

While building the Deb packages, I ran into something that I was unsure about. Now, on this particular Ubuntu i386 system, the libraries are stored in /usr/lib/i386-linux-gnu, not /usr/lib as we had in the old days. In the early multilib days, the libraries were sorted into /usr/lib32 and /usr/lib64. The Swarm build today fails to find library files unless I expliciatly hack the configure statement. Where the current configure has a thing that looks for libraries in /usr/lib /usr/lib32 /usr/lib64, I just edited and replaced the middle one by /usr/lib/i386-linux-gnu. After I realized that would work, it magically solved all of the Swarm troubles I was having. Apps were all of the sudden able to find pixmaps and hdf5.

When I rebuilt the Swarm for 64 bit, I found the same kind of thing had to be done. I had to change /usr/lib64 to /usr/lib/x86_64-linux-gnu

This seems to be a pain in the ass, gratuitious renaming of things for purposes of enhanced navel-gazing. But it all works now. I've verified I have loadable PNG and HDF5 support.

About pauljohn

Paul E. Johnson is a Professor of Political Science at the University of Kansas. He is an avid Linux User, an adequate system administrator and C programmer, and humility is one of his greatest strengths.
This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply