blob: e32031d73e6792e0cca2719a66a946352edb2080 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SAFECode Install Guide</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<div class="doc_title">
SAFECode Install Guide
</div>
<!-- ********************************************************************** -->
<!-- * Table of Contents * -->
<!-- ********************************************************************** -->
<ul>
<li><a href="#overview">Overview</a></li>
<li><a href="#requirements">Requirements</a></li>
<ul>
<li><a href="#dependencies">Software and Build Tool Dependencies</a>
<li><a href="#platforms">Supported Platforms</a>
</ul>
<li><a href="#download">Getting the Source Code</a></li>
<ul>
<li><a href="#direct">Source TAR Archive</a>
<li><a href="#svn">Subversion Repository Download</a>
</ul>
<li><a href="#configure">Configuring the Source Code</a></li>
<li><a href="#compile">Compiling SAFECode</a></li>
<li><a href="#install">Installing SAFECode</a></li>
</ul>
<!-- ********************************************************************** -->
<!-- * Authors * -->
<!-- ********************************************************************** -->
<div class="doc_author">
<p>Written by the LLVM Research Group</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="overview"><b>Overview</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>
Welcome to the SAFECode compiler! This manual provides instructions for
downloading and compiling SAFECode. It also provides information on software
that you must have in order to install SAFECode.
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="requirements"><b>Requirements</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_subsection">
<a name="dependencies"><b>Software and Build Tool Dependencies</b></a>
</div>
<div class="doc_text">
<p>
SAFECode depends upon several other pieces of software. SAFECode is built
using the <a href="http://llvm.org">LLVM Compiler Infrastructure</a>, so you
must have LLVM. SAFECode also uses libraries from the
Automatic Pool Allocation project. Directions on how to download these will be
provided with the directions on downloading SAFECode.
</p>
<p>
SAFECode comes pre-compiled for some architectures, but the best way to get it
is as as source code. If building from source, you will need the proper tools
(namely GCC and GNU make) to compile it. The necessary requirements are those
needed by LLVM and are listed
<a href="http://llvm.org/docs/GettingStarted.html#requirements">here</a>.
</p>
</div>
<div class="doc_subsection">
<a name="platforms"><b>Supported Platforms</b></a>
</div>
<div class="doc_text">
<p>
SAFECode is currently supported on Linux and Mac OS X running on x86
processors.
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="download"><b>Getting the Source Code</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>
There are two ways to get SAFECode: downloading the tar archive or downloading
it from the public Subversion repository.
</p>
</div>
<div class="doc_subsection">
<a name="direct"><b>Source TAR Archive</b></a>
</div>
<div class="doc_text">
<p>
Complete source TAR archives of SAFECode can be found
<a href="http://safecode.cs.illinois.edu/downloads.html">here</a>. These
archives include LLVM as well as the Automatic Pool Allocation and SAFECode
projects located within the <tt>llvm/projects</tt> directory. You will need
GNU Zip (<tt>gunzip</tt>) and the tar utility (<tt>tar</tt>) to unpack the
archive (these are available on practically all Unix systems today).
</p>
</div>
<div class="doc_subsection">
<a name="svn"><b>Subversion Repository Download</b></a>
</div>
<div class="doc_text">
<p>
SAFECode, the Automatic Pool Allocation project, and LLVM are all stored in
the public Subversion repository at llvm.org. You can retrieve the source code
for these projects using a standard Subversion client as described below.
</p>
<p>
By default, you should put Automatic Pool Allocation and SAFECode into the
projects subdirectory of the LLVM source distribution. The following commands
should download all of the source code into the appropriate places:
</p>
<ul>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li>
<li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
<li><tt>cd llvm/projects</tt></li>
<li><tt>
svn co http://llvm.org/svn/llvm-project/poolalloc/trunk poolalloc
</tt></li>
<li><tt>
svn co http://llvm.org/svn/llvm-project/safecode/trunk safecode
</tt></li>
</ul>
<p>
You may optionally want to get the LLVM Test Suite (test-suite) source code:
</p>
<ul>
<li><tt>cd llvm/projects</tt></li>
<li><tt>
svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
</tt></li>
</ul>
<p>
If you use the LLVM Test Suite, you will also need the LLVM GCC front-end, and
you will need to configure LLVM so that it knows where to find llvm-gcc and
llvm-g++. Directions for downloading and installing the front-end can be found
in the
<a href="http://llvm.org/docs/GettingStarted.html">
LLVM Getting Started Guide
</a>.
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="configure"><b>Configuring the Source Code</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>
Once you have the source code checked out, you should be able to configure
LLVM, the poolalloc project, and the SAFECode project using just the top level
LLVM configure script (the LLVM <tt>configure</tt> script configures the
poolalloc and safecode projects automatically if they're present in the
<tt>projects</tt> subdirectory). Simply configure LLVM as you normally would
(e.g., run <tt>./configure</tt> in the LLVM source tree), and SAFECode will be
configured automatically for you.
</p>
<p>
If you have any problems configuring SAFECode (or you're doing something
unconventional), you can try adding the following options to the command line
when running <tt>configure</tt>:
</p>
<ul>
<li>
<tt>--with-llvmsrc=<i>directory</i></tt>:
Specifies the location of the LLVM source directory. This option is used by
the Automatic Pool Allocation and SAFECode build systems to find the LLVM
source tree; it is ignored by the LLVM configure script but passed to the
Automatic Pool Allocation configure script. This option is not needed if
building in the source tree (i.e., SRCDIR == OBJDIR) and the project
(poolalloc or safecode) is in the LLVM projects subdirectory.
</li>
<li>
<tt>--with-llvmobj=<i>directory</i></tt>:
Specifies the location of the LLVM object directory. This option is used by
the Automatic Pool Allocation and SAFECode build systems to find the LLVM
object tree; it is ignored by the LLVM configure script but passed to the
Automatic Pool Allocation configure script. This option is not needed if
building in the source tree (i.e., SRCDIR == OBJDIR) and the project
(poolalloc or safecode) is in the LLVM projects subdirectory.
</li>
</ul>
<p>
Additional options for the SAFECode configure script include:
</p>
<ul>
<li><tt>--with-poolalloc-srcdir</tt>:
Specifies the location of the source code for Automatic Pool Allocation.
This should only be necessary if the either the poolalloc source tree or
safecode source tree is not within <tt>llvm/projects</tt>.
</li>
<li><tt>--with-poolalloc-objdir</tt>:
Specifies the location of the object code for Automatic Pool Allocation.
This should only be necessary if the either the poolalloc object tree or
safecode object tree is not within the <tt>projects</tt> subdirectory of the
LLVM object tree.
</li>
</ul>
The overall process will look like the following if you are building Automatic
Pool Allocation and SAFECode in the the projects subdirectory of the LLVM
object tree:
<ul>
<li><tt>cd <i>LLVM-object-directory</i></tt></li>
<li><tt><i>LLVM-source-directory</i>/configure [options]</tt></li>
</ul>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="compile"><b>Compiling SAFECode</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>
To build SAFECode, first compile the LLVM tools and then SAFECode itself:
</p>
<ul>
<li><tt>cd <i>LLVM-object-directory</i></tt></li>
<li><tt>make tools-only</tt></li>
<li><tt>cd projects/poolalloc</tt></li>
<li><tt>make</tt></li>
<li><tt>cd ../safecode</tt></li>
<li><tt>make</tt></li>
</ul>
SAFECode will, by default, perform the same type of build that LLVM does. For
example, if LLVM is configured to do a Release build by default, SAFECode will
do a Release build by default as well.
There are three types of builds:
<ul>
<li>
Debug:
The SAFECode libraries and tools are placed in <tt>Debug/lib</tt> and
<tt>Debug/bin</tt> in the SAFECode object tree. The libraries and programs
are compiled with debug symbols enabled. The tools may operate more slowly
due to the extra debug information.
</li>
<li>
Release:
The SAFECode libraries and tools are placed in <tt>Release/lib</tt> and
<tt>Release/bin</tt> in the SAFECode object tree. The libraries and programs
are compiled at a higher optimization level and debug symbols are stripped
from executables, making the SAFECode tools faster.
</li>
<li>
Profile:
The SAFECode libraries and tools are placed in <tt>Profile/lib</tt> and
<tt>Profile/bin</tt> in the SAFECode object tree. The libraries and programs
are compiled to generate profiling information which can be used to find
performance bottlenecks.
</li>
</ul>
<p>
If you only want to use SAFECode, use a Release build. If you are doing
development work on SAFECode, use the Debug or Profile builds as appropriate.
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="install"><b>Installing SAFECode</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>
Once SAFECode has been built, you can install it using the following commands:
</p>
<ul>
<li><tt>cd <i>LLVM-object-directory</i></tt></li>
<li><tt>make install</tt></li>
<li><tt>cd projects/poolalloc</tt></li>
<li><tt>make install</tt></li>
<li><tt>cd ../safecode</tt></li>
<li><tt>make install</tt></li>
</ul>
Like LLVM, installing SAFECode is not necessary for using it; however,
performing the installation may place the SAFECode binaries and libraries into
directories that are more convenient. By default, clang and clang++ are
installed into <tt>/usr/local/bin</tt>, and the libraries are installed in
<tt>/usr/local/lib</tt>; however, these locations can be changed by using the
<tt>--prefix</tt> option to the LLVM configure script.
</div>