Soot Build Instructions

While trying to create a call graph of DrJava using Soot, I ran into some problems that were supposed to have been fixed in the Soot nightly builds already. Unfortunately, the nightly builds I could find were all many months old. So I built Soot from scratch from the Subversion repository, which wasn’t an easy task.

Here are some instructions for building Soot:

  1. Make sure you have Ant ant the JDK (5 or newer) installed.
  2. Check out and download all of these code bases in the same directory.
  3. Download Polyglot from http://www.sable.mcgill.ca/soot/soot_download.html:
    wget http://www.sable.mcgill.ca/software/polyglotclasses-1.3.5.jar
  4. Check out Soot from https://svn.sable.mcgill.ca/soot/soot/trunk:
    svn checkout https://svn.sable.mcgill.ca/soot/soot/trunk soot-dev
  5. Check out Jasmin from https://svn.sable.mcgill.ca/soot/jasmin/trunk:
    svn checkout https://svn.sable.mcgill.ca/soot/jasmin/trunk jasmin-dev
  6. Check out JastAddJ from http://svn.jastadd.org/projects/trunk/JastAddJ:
    svn co http://svn.jastadd.org/projects/trunk/JastAddJ
  7. Check out JastAddExtensions from http://svn.jastadd.org/projects/trunk/JastAddExtensions:
    svn co http://svn.jastadd.org/projects/trunk/JastAddExtensions
  8. You should now have the following directory structure:
    .
    |-- polyglotclasses-1.3.5.jar
    |-- JastAddExtensions
    |   |-- ...
    |   |-- SootJastAddJ
    |   `-- ...
    |-- JastAddJ
    |   `-- ...
    |-- jasmin-dev
    |   |-- ...
    |   |-- lib
    |   |   `...
    |   |-- ant.settings.template
    |   |-- build.xml
    |   `-- ...
    `-- soot-dev
        |-- ...
        |-- lib
        |   `...
        |-- ant.settings.template
        |-- build.xml
        `-- ...
  9. Copy jasmin-dev/ant.settings.template to jasmin-dev/ant.settings:
    cp jasmin-dev/ant.settings.template jasmin-dev/ant.settings
  10. Edit jasmin-dev/ant.settings so it contains the following lines:
    java_cup.jar=../polyglotclasses-1.3.5.jar
    jasmin.version=trunk
  11. Change into the jasmin-dev directory, build the jasminclasses-trunk.jar file, and change back out of the directory:
    cd jasmin-dev
    ant jasmin-jar
    cd ..
  12. The freshly built Jasmin jar file is jasmin-dev/lib/jasminclasses-trunk.jar.
  13. Change into the JastAddExtensions/SootJastAddJ directory, regenerate the JastAdd-generated files for Soot, and change back out of the directory:
    cd JastAddExtensions/SootJastAddJ
    ant gen
    cd ../..
  14. Copy soot-dev/ant.settings.template to soot-dev/ant.settings:
    cp soot-dev/ant.settings.template soot-dev/ant.settings
  15. Edit soot-dev/ant.settings so it contains the following lines:
    jastaddfrontend.loc=../JastAddExtensions/SootJastAddJ
    polyglot.jar=../polyglotclasses-1.3.5.jar
    jasmin.jar=../jasmin-dev/lib/jasminclasses-trunk.jar
  16. Change into the soot-dev directory and build the sootclasses-trunk.jar file, and change back out of the directory:
    cd soot-dev
    ant classesjar
    cd ..

    Note: I received a compiler error here. I had to insert the second cast into soot-dev/src/soot/jbco/bafTransformations/FindDuplicateSequences.java to make line 282

    1
    Unit jump = (Unit) units.getSuccOf(next.get(next.size() - 1));
  17. read

    1
    Unit jump = (Unit) units.getSuccOf((Unit)(next.get(next.size() - 1)));
  18. The freshly built Soot jar file is soot-dev/lib/sootclasses-trunk.jar.

Have fun with fresh Soot.

Here’s a bash script that does it all (except insert the cast): build-soot.sh.zip

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash

# Make sure you have Ant ant the JDK (5 or newer) installed.
# Check out and download all of these code bases in the same directory.
# Download Polyglot from http://www.sable.mcgill.ca/soot/soot_download.html:
wget http://www.sable.mcgill.ca/software/polyglotclasses-1.3.5.jar

# Check out Soot from https://svn.sable.mcgill.ca/soot/soot/trunk:
svn checkout https://svn.sable.mcgill.ca/soot/soot/trunk soot-dev

# Check out Jasmin from https://svn.sable.mcgill.ca/soot/jasmin/trunk:
svn checkout https://svn.sable.mcgill.ca/soot/jasmin/trunk jasmin-dev

# Check out JastAddJ from http://svn.jastadd.org/projects/trunk/JastAddJ:
svn co http://svn.jastadd.org/projects/trunk/JastAddJ

# Check out JastAddExtensions from
# http://svn.jastadd.org/projects/trunk/JastAddExtensions:
svn co http://svn.jastadd.org/projects/trunk/JastAddExtensions

# Copy jasmin-dev/ant.settings.template to jasmin-dev/ant.settings:
# Edit jasmin-dev/ant.settings so it contains the following lines:
# java_cup.jar=../polyglotclasses-1.3.5.jar
# jasmin.version=trunk
cat jasmin-dev/ant.settings.template | sed \
-e "s/.*\(java_cup.jar=\).*/\1..\/polyglotclasses-1.3.5.jar/" \
-e "s/.*\(jasmin.version=\).*/\1trunk/" \
> jasmin-dev/ant.settings

# Change into the jasmin-dev directory, build the
# jasminclasses-trunk.jar file, and change back out of the directory:
cd jasmin-dev
ant jasmin-jar
cd ..

# The freshly built Jasmin jar file is
# jasmin-dev/lib/jasminclasses-trunk.jar.  Change into the
# JastAddExtensions/SootJastAddJ directory, regenerate the
# JastAdd-generated files for Soot, and change back out of the
# directory:
cd JastAddExtensions/SootJastAddJ
ant gen
cd ../..

# Copy soot-dev/ant.settings.template to soot-dev/ant.settings:
# Edit soot-dev/ant.settings so it contains the following lines:
# jastaddfrontend.loc=../JastAddExtensions/SootJastAddJ
# polyglot.jar=../polyglotclasses-1.3.5.jar
# jasmin.jar=../jasmin-dev/lib/jasminclasses-trunk.jar
cat soot-dev/ant.settings.template | sed \
-e "s/.*\(jastaddfrontend.loc=\).*/\1..\/JastAddExtensions\/SootJastAddJ/" \
-e "s/.*\(polyglot.jar=\).*/\1..\/polyglotclasses-1.3.5.jar/" \
-e "s/.*\(jasmin.jar=\).*/\1..\/jasmin-dev\/lib\/jasminclasses-trunk.jar/" \
> soot-dev/ant.settings

# Change into the soot-dev directory and build the
# sootclasses-trunk.jar file, and change back out of the directory:
cd soot-dev
ant classesjar
cd ..

cp soot-dev/lib/sootclasses-trunk.jar .
Share

About Mathias

Software development engineer. Principal developer of DrJava. Recent Ph.D. graduate from the Department of Computer Science at Rice University.
This entry was posted in Concurrent Unit Testing. Bookmark the permalink.

One Response to Soot Build Instructions

  1. Pingback: Building Soot with Ant « Web Design Blog | Blenderhead Studios | Davis, CA

Leave a Reply