1*f4a2713aSLionel Sambuc<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 2*f4a2713aSLionel Sambuc "http://www.w3.org/TR/html4/strict.dtd"> 3*f4a2713aSLionel Sambuc<html> 4*f4a2713aSLionel Sambuc<head> 5*f4a2713aSLionel Sambuc <title>Obtaining the Static Analyzer</title> 6*f4a2713aSLionel Sambuc <link type="text/css" rel="stylesheet" href="menu.css"> 7*f4a2713aSLionel Sambuc <link type="text/css" rel="stylesheet" href="content.css"> 8*f4a2713aSLionel Sambuc <script type="text/javascript" src="scripts/menu.js"></script> 9*f4a2713aSLionel Sambuc</head> 10*f4a2713aSLionel Sambuc<body> 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc<div id="page"> 13*f4a2713aSLionel Sambuc<!--#include virtual="menu.html.incl"--> 14*f4a2713aSLionel Sambuc<div id="content"> 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc<h1>Obtaining the Static Analyzer</h1> 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc<p>This page describes how to download and install the analyzer. Once 19*f4a2713aSLionel Sambucthe analyzer is installed, follow the <a 20*f4a2713aSLionel Sambuchref="/scan-build.html">instructions</a> on using <tt>scan-build</tt> to 21*f4a2713aSLionel Sambucget started analyzing your code.</p> 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc<h2>Packaged Builds (Mac OS X)</h2> 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc<p>Semi-regular pre-built binaries of the analyzer are available on Mac 26*f4a2713aSLionel SambucOS X. These are built to run on Mac OS 10.5 and later.</p> 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambuc<p>Builds are released frequently. Often the differences between build 29*f4a2713aSLionel Sambucnumbers being a few bug fixes or minor feature improvements. When using 30*f4a2713aSLionel Sambucthe analyzer, we recommend that you check back here occasionally for new 31*f4a2713aSLionel Sambucbuilds, especially if the build you are using is more than a couple 32*f4a2713aSLionel Sambucweeks old.</p> 33*f4a2713aSLionel Sambuc 34*f4a2713aSLionel Sambuc<p>The latest build is: 35*f4a2713aSLionel Sambuc <!--#include virtual="latest_checker.html.incl"--> 36*f4a2713aSLionel Sambuc</p> 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc<p>Packaged builds for other platforms may eventually be provided, but 39*f4a2713aSLionel Sambucwe need volunteers who are willing to help provide such regular builds. 40*f4a2713aSLionel SambucIf you wish to help contribute regular builds of the analyzer on other 41*f4a2713aSLionel Sambucplatforms, please email the <a 42*f4a2713aSLionel Sambuchref="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">Clang 43*f4a2713aSLionel SambucDevelopers' mailing list</a>.</p> 44*f4a2713aSLionel Sambuc 45*f4a2713aSLionel Sambuc<h3>Using Packaged Builds</h3> 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc<p>To use a package build, simply unpack it anywhere. If the build 48*f4a2713aSLionel Sambucarchive has the name <b><tt>checker-XXX.tar.bz2</tt></b> then the 49*f4a2713aSLionel Sambucarchive will expand to a directory called <b><tt>checker-XXX</tt></b>. 50*f4a2713aSLionel SambucYou do not need to place this directory or the contents of this 51*f4a2713aSLionel Sambucdirectory in any special place. Uninstalling the analyzer is as simple 52*f4a2713aSLionel Sambucas deleting this directory.</p> 53*f4a2713aSLionel Sambuc 54*f4a2713aSLionel Sambuc<p>Most of the files in the <b><tt>checker-XXX</tt></b> directory will 55*f4a2713aSLionel Sambucbe supporting files for the analyzer that you can simply ignore. Most 56*f4a2713aSLionel Sambucusers will only care about two files, which are located at the top of 57*f4a2713aSLionel Sambucthe <b><tt>checker-XXX</tt></b> directory:</p> 58*f4a2713aSLionel Sambuc 59*f4a2713aSLionel Sambuc<ul> 60*f4a2713aSLionel Sambuc<li><b>scan-build</b>: <tt>scan-build</tt> is the high-level command line utility for running the analyzer</li> 61*f4a2713aSLionel Sambuc<li><b>scan-view</b>: <tt>scan-view</tt> a companion comannd line 62*f4a2713aSLionel Sambucutility to <tt>scan-build</tt>, <tt>scan-view</tt> is used to view 63*f4a2713aSLionel Sambucanalysis results generated by <tt>scan-build</tt>. There is an option 64*f4a2713aSLionel Sambucthat one can pass to <tt>scan-build</tt> to cause <tt>scan-view</tt> to 65*f4a2713aSLionel Sambucrun as soon as it the analysis of a build completes</li> 66*f4a2713aSLionel Sambuc</ul> 67*f4a2713aSLionel Sambuc 68*f4a2713aSLionel Sambuc<h4>Running scan-build</h4> 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc<p>For specific details on using <tt>scan-build</tt>, please see 71*f4a2713aSLionel Sambuc<tt>scan-build</tt>'s <a href="/scan-build">documentation</a>.</p> 72*f4a2713aSLionel Sambuc 73*f4a2713aSLionel Sambuc<p>To run <tt>scan-build</tt>, either add the 74*f4a2713aSLionel Sambuc<b><tt>checker-XXX</tt></b> directory to your path or specify a complete 75*f4a2713aSLionel Sambucpath for <tt>scan-build</tt> when running it. It is also possible to use 76*f4a2713aSLionel Sambuca symbolic link to <tt>scan-build</tt>, such one located in a directory 77*f4a2713aSLionel Sambucin your path. When <tt>scan-build</tt> runs it will automatically 78*f4a2713aSLionel Sambucdetermine where to find its accompanying files.</p> 79*f4a2713aSLionel Sambuc 80*f4a2713aSLionel Sambuc<h2 id="OtherPlatforms">Other Platforms (Building the Analyzer from Source)</h2> 81*f4a2713aSLionel Sambuc 82*f4a2713aSLionel Sambuc<p>For other platforms, you must build Clang and LLVM manually. To do 83*f4a2713aSLionel Sambucso, please follow the instructions for <a 84*f4a2713aSLionel Sambuchref="http://clang.llvm.org/get_started.html#build">building Clang from 85*f4a2713aSLionel Sambucsource code</a>.<p> 86*f4a2713aSLionel Sambuc 87*f4a2713aSLionel Sambuc<p>Once the Clang is built, you need to add the following to your path:</p> 88*f4a2713aSLionel Sambuc 89*f4a2713aSLionel Sambuc<ul> 90*f4a2713aSLionel Sambuc 91*f4a2713aSLionel Sambuc<li>The location of the <tt>clang</tt> binary. 92*f4a2713aSLionel Sambuc 93*f4a2713aSLionel Sambuc<p>For example, if you built a <em>Debug+Asserts</em> build of LLVM/Clang (the 94*f4a2713aSLionel Sambucdefault), the resultant <tt>clang</tt> binary will be in <tt>$(OBJDIR)/Debug+Asserts/bin</tt> 95*f4a2713aSLionel Sambuc(where <tt>$(OBJDIR)</tt> is often the same as the root source directory). You 96*f4a2713aSLionel Sambuccan also do <tt>make install</tt> to install the LLVM/Clang libraries and 97*f4a2713aSLionel Sambucbinaries to the installation directory of your choice (specified when you run 98*f4a2713aSLionel Sambuc<tt>configure</tt>).</p></li> 99*f4a2713aSLionel Sambuc 100*f4a2713aSLionel Sambuc<li>The locations of the <tt>scan-build</tt> and <tt>scan-view</tt> 101*f4a2713aSLionel Sambucprograms. 102*f4a2713aSLionel Sambuc 103*f4a2713aSLionel Sambuc<p>Currently these are not installed using <tt>make install</tt>, and 104*f4a2713aSLionel Sambucare located in <tt>$(SRCDIR)/tools/clang/tools/scan-build</tt> and 105*f4a2713aSLionel Sambuc<tt>$(SRCDIR)/tools/clang/tools/scan-view</tt> respectively (where 106*f4a2713aSLionel Sambuc<tt>$(SRCDIR)</tt> is the root LLVM source directory). These locations 107*f4a2713aSLionel Sambucare subject to change.</p></li> 108*f4a2713aSLionel Sambuc 109*f4a2713aSLionel Sambuc</ul> 110*f4a2713aSLionel Sambuc</div> 111*f4a2713aSLionel Sambuc</div> 112*f4a2713aSLionel Sambuc</body> 113*f4a2713aSLionel Sambuc</html> 114*f4a2713aSLionel Sambuc 115