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