OCLint

System Requirements

OCLint can be compiled on all unix-like systems, theoretically. Latest Mac OS X, FreeBSD, and major Linux distributions are tested and recommended.

LLVM System Requirements

OCLint is based on libTooling for parsing source code and generating Abstract Syntax Tree (AST) generation. Prior to compiling OCLint, we need to compile LLVM/Clang. Check out LLVM System Requirements for requirements. These requirements are very fundamental development tools that probably you already have them.

OCLint System Requirements

Some tools are emphasized here, you may want to double check and make sure the toolkit is ready when you need it.

  1. Apache Subversion
  2. Git
  3. CMake
  4. LTP GCOV Extension (lcov)

Extra Notes

Notes for Mac OS X

Homebrew is highly recommended for Mac OS X users. When we have homebrew installed, we can simply get all the dependencies by

brew install subversion git cmake lcov

Notes for Ubuntu

All Ubuntu users should be able to get all the dependencies by apt-get, for example:

apt-get install subversion git cmake lcov

We have noticed the coverage meta data generated by clang is not compatible with the latest version of gcov, but a gcov 4.2, 4.3 and 4.4 versions should work. In order to get the code coverage report, downgrading entire gcc tool set is recommended. Ubuntu provides a handy method to keep multiple versions in the system and easy to switch among them by update-alternatives, for example:

apt-get install g++-4.4
update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.6 10
update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.4 20
update-alternatives --config gcov # and choose version 4.4
# you can also use the same method to switch your gcc and g++ compiler, but it's optional

Notes for Fedora

We should be able to get all the dependencies by yum, for example:

yum install gcc-c++ make git subversion cmake lcov

Notes for FreeBSD

The dependencies can be found in the follow ports folders:

  • /usr/ports/devel/subversion16
    • LLVM codebase is not compatible with 1.7 version yet
  • /usr/ports/devel/git
  • /usr/ports/devel/cmake
  • /usr/ports/devel/lcov

Simply go through each folder, and install them by

make install clean

Notes for Python 2.6

argparse module is required, and install it by

sudo easy_install argparse

The installation of argparse module can be checked by

python -c "import argparse; print argparse"