Compiler projects using llvm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>Obtaining the Static Analyzer</title>
  <link type="text/css" rel="stylesheet" href="menu.css">
  <link type="text/css" rel="stylesheet" href="content.css">
  <script type="text/javascript" src="scripts/menu.js"></script>
</head>
<body>

<div id="page">
<!--#include virtual="menu.html.incl"-->
<div id="content">

<h1>Obtaining the Static Analyzer</h1>

<p>This page describes how to download and install the analyzer.  Once
the analyzer is installed, follow the <a
href="/scan-build.html">instructions</a> on using <tt>scan-build</tt> to
get started analyzing your code.</p>

<h2>Packaged Builds (Mac OS X)</h2>

<p>Semi-regular pre-built binaries of the analyzer are available on Mac
OS X.  These are built to run on OS X 10.7 and later.</p>

<p>Builds are released frequently.  Often the differences between build
numbers being a few bug fixes or minor feature improvements.  When using
the analyzer, we recommend that you check back here occasionally for new
builds, especially if the build you are using is more than a couple
weeks old.</p>

<p>The latest build is:
  <!--#include virtual="latest_checker.html.incl"-->
</p>

<p>Packaged builds for other platforms may eventually be provided, but
we need volunteers who are willing to help provide such regular builds.
If you wish to help contribute regular builds of the analyzer on other
platforms, please email the <a
href="https://lists.llvm.org/mailman/listinfo/cfe-dev">Clang
Developers' mailing list</a>.</p>

<h3>Using Packaged Builds</h3>

<p>To use a package build, simply unpack it anywhere.  If the build
archive has the name <b><tt>checker-XXX.tar.bz2</tt></b> then the
archive will expand to a directory called <b><tt>checker-XXX</tt></b>.
You do not need to place this directory or the contents of this
directory in any special place.  Uninstalling the analyzer is as simple
as deleting this directory.</p>

<p>Most of the files in the <b><tt>checker-XXX</tt></b> directory will
be supporting files for the analyzer that you can simply ignore.  Most
users will only care about two files, which are located at the top of
the <b><tt>checker-XXX</tt></b> directory:</p>

<ul>
<li><b>scan-build</b>: <tt>scan-build</tt> is the high-level command line utility for running the analyzer</li>
<li><b>scan-view</b>: <tt>scan-view</tt> a companion comannd line
utility to <tt>scan-build</tt>, <tt>scan-view</tt> is used to view
analysis results generated by <tt>scan-build</tt>.  There is an option
that one can pass to <tt>scan-build</tt> to cause <tt>scan-view</tt> to
run as soon as it the analysis of a build completes</li>
</ul>

<h4>Running scan-build</h4>

<p>For specific details on using <tt>scan-build</tt>, please see
<tt>scan-build</tt>'s <a href="/scan-build">documentation</a>.</p>

<p>To run <tt>scan-build</tt>, either add the
<b><tt>checker-XXX</tt></b> directory to your path or specify a complete
path for <tt>scan-build</tt> when running it. It is also possible to use
a symbolic link to <tt>scan-build</tt>, such one located in a directory
in your path. When <tt>scan-build</tt> runs it will automatically
determine where to find its accompanying files.</p>

<h2 id="OtherPlatforms">Other Platforms (Building the Analyzer from Source)</h2>

<p>For other platforms, you must build Clang and LLVM manually.  To do
so, please follow the instructions for <a
href="https://clang.llvm.org/get_started.html#build">building Clang from
source code</a>.<p>

<p>Once the Clang is built, you need to add the following to your path:</p>

<ul>

<li>The location of the <tt>clang</tt> binary.

<p>For example, if you built a <em>Debug+Asserts</em> build of LLVM/Clang (the
default), the resultant <tt>clang</tt> binary will be in <tt>$(OBJDIR)/Debug+Asserts/bin</tt>
(where <tt>$(OBJDIR)</tt> is often the same as the root source directory).  You
can also do <tt>make install</tt> to install the LLVM/Clang libraries and
binaries to the installation directory of your choice (specified when you run
<tt>configure</tt>).</p></li>

<li>The locations of the <tt>scan-build</tt> and <tt>scan-view</tt>
programs.

<p>These are installed via <tt>make install</tt> into the bin directory
when clang is built.</p></li>

</ul>
</div>
</div>
</body>
</html>