Fixing missing library problems on the simulated target

  1. Run ldd on your binary on chianti:
    chianti(3)% ldd bin/cTree
    libpthread.so.1 => /lib/libpthread.so.1
    libstdc++.so.6 => /usr/sfw/lib/libstdc++.so.6
    libm.so.2 => /lib/libm.so.2
    libgcc_s.so.1 => /usr/sfw/lib/libgcc_s.so.1
    libc.so.1 => /lib/libc.so.1
    /platform/SUNW,Sun-Fire-T200/lib/libc_psr.so.1

  2. Copy each library to your AFS space, I used a directory called ~/libs -- you'll want the files alone in the directory.
    chianti(4)% scp /lib/libpthread.so.1 gibson@mustardseed:libs/
    chianti(5)% scp /usr/sfw/lib/libstdc++.so.6 gibson@mustardseed:libs/
    chianti(6)% scp /lib/libm.so.2 gibson@mustardseed:libs/
    chianti(7)% scp /usr/sfw/lib/libgcc_s.so.1 gibson@mustardseed:libs/
    chianti(8)% scp /lib/libc.so.1 gibson@mustardseed:libs/
    chianti(9)% scp /platform/SUNW,Sun-Fire-T200/lib/libc_psr.so.1 gibson@mustardseed:libs/

  3. In your $GEMS/microbenchmarks/transactional/ctree directory, open ctree.simics. Find the command_lines variable, at about line 36 or so. It looks like this (though the default shell is bash, I've changed mine to tcsh):
    @command_lines = [
          "tcsh\n",
          "mount /host\n",
          "cp " + hostpath + "cTree_%s cTree\n" % lock_type,
          "umount /host\n",
          "./cTree \n"
          ]

  4. Add a line to command_lines, right after "bash\n", to cd to "/space", like this:
    @command_lines = [
          "tcsh\n",
          "cd /space\n",
          "mount /host\n",
          "cp " + hostpath + "cTree_%s cTree\n" % lock_type,
          "umount /host\n",
          "./cTree \n"
    ]

  5. Add a line to cp each of the libraries above to the target's /space drive, like this:
    @command_lines = [
          "tcsh\n",
          "cd /space\n",
          "mount /host\n",
          "cp " + hostpath + "cTree_%s cTree\n" % lock_type,
          "cp /u/g/i/gibson/libs/* .\n",
          "umount /host\n",
          "./cTree \n"
    ]

  6. Set a magic environment variable that will make the world again sane. Note that the syntax varies from shell to shell (I used TCSH, default is bash):
    @command_lines = [
          "tcsh\n",
          "cd /space\n",
          "mount /host\n",
          "cp " + hostpath + "cTree_%s cTree\n" % lock_type,
          "cp /u/g/i/gibson/libs/* .\n",
          "umount /host\n",
          "setenv LD_LIBRARY_PATH /space\n",
          "./cTree \n"
    ]