Thursday, December 29, 2011

Building QtSpim

I use QtSpim, a MIPS simulator for the Computer Organization and Architecture class I teach. Jim Larus at Microsoft Research originally devloped SPIM at the University of Wisconsin and graciously maintains it, and has recently ported it to use Qt. The 64-bit debian package uses a newer version of Qt than I have installed in my labs (Ubuntu 10.04, which is the most recent LTS as of this writing). Rebuilding QtSpim in QtCreator and distributing the Qt shared libraries along with the executable fixes things.
  1. Get yourself a copy of Qt Creator and SDK from Nokia.
  2. Download the SPIM source code. Probably the easiest thing is to install subversion and check the code out:
    svn co https://spimsimulator.svn.sourceforge.net/svnroot/spimsimulator spimsimulator
    
    This creates a directory named spimsimulator. You can also download the tarball at that site and unpack it.
  3. In QtCreator open the project by opening the file spimsimulator/QtSpim/QtSpim.pro
  4. Build a release version of the project in Qt Creator (self explanatory)
  5. The executable is sitting in QtSpim-build-desktop/QtSpim.
  6. QtSpim uses two shared libraries from the Qt SDK. These are libQtGui.so.4 and libQtCore.so.4. Be careful, both of these are probably just links to the real shared objects sitting in the same directory.
  7. In my case I needed to distribute the executable and the two shared libraries to a lab so I copied them to a global place (in my case /usr/local on each machine). I also wrote a simple script to set LD_LIBRARY_PATH to pick up the correct Qt libraries and execute the QtSpim executable. The other option is have users manually set LD_LIBRARY_PATH in their .bashrc.

No comments: