Obtaining the Static Analyzer
This page describes how to download and install the analyzer. Once the analyzer is installed, follow the instructions on using scan-build to get started analyzing your code.
Packaged Builds (Mac OS X)
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.
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.
The latest build is: checker-277.tar.bz2 (built October 28, 2015)
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 Clang Developers' mailing list.
Using Packaged Builds
To use a package build, simply unpack it anywhere. If the build archive has the name checker-XXX.tar.bz2 then the archive will expand to a directory called checker-XXX. 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.
Most of the files in the checker-XXX 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 checker-XXX directory:
- scan-build: scan-build is the high-level command line utility for running the analyzer
- scan-view: scan-view a companion comannd line utility to scan-build, scan-view is used to view analysis results generated by scan-build. There is an option that one can pass to scan-build to cause scan-view to run as soon as it the analysis of a build completes
For specific details on using scan-build, please see scan-build's documentation.
To run scan-build, either add the checker-XXX directory to your path or specify a complete path for scan-build when running it. It is also possible to use a symbolic link to scan-build, such one located in a directory in your path. When scan-build runs it will automatically determine where to find its accompanying files.
Other Platforms (Building the Analyzer from Source)
For other platforms, you must build Clang and LLVM manually. To do so, please follow the instructions for building Clang from source code.
Once the Clang is built, you need to add the following to your path:
- The location of the clang binary.
For example, if you built a Debug+Asserts build of LLVM/Clang (the default), the resultant clang binary will be in $(OBJDIR)/Debug+Asserts/bin (where $(OBJDIR) is often the same as the root source directory). You can also do make install to install the LLVM/Clang libraries and binaries to the installation directory of your choice (specified when you run configure).
- The locations of the scan-build and scan-view
These are installed via make install into the bin directory when clang is built.