We provide a source release of Infer packaged with pre-build binaries for clang and facebook-clang-plugins for Linux and MacOS. We encourage you to use this release as compiling clang is time-consuming. Install the dependencies as explained in the next section, then follow the instructions in our Getting Started page to compile and install Infer.
Here are the prerequisites to be able to compile Infer on MacOSX. This is required to be able to use the release (faster), or to compile everything from source (see the end of this document).
- opam 1.2.2 (instructions here)
- Python 2.7
- pkg-config
- Java (only needed for the Java analysis)
- cmake (only needed for the C/Objective-C analysis)
- clang in Xcode command line tools. You can install them with the command
xcode-select --install
(only needed for the C/Objective-C analysis) - Xcode >= 6.1 (only needed for the C/Objective-C analysis)
- autoconf >= 2.63 and automake >= 1.11.1 (if building from git)
You can install some of these dependencies using Homebrew:
brew install autoconf automake cmake opam pkg-config
brew install caskroom/cask/brew-cask
brew cask install java
Here are the prerequisites to be able to compile Infer on Linux. This is required to be able to use the release (faster), or to compile everything from source (see the end of this document).
- opam 1.2.2
- Python 2.7
- pkg-config
- Java (only needed for the Java analysis)
- gcc >= 4.7.2 or clang >= 3.1 (only needed for the C/Objective-C analysis)
- autoconf >= 2.63 and automake >= 1.11.1 (if building from git)
See also the distro-specific instructions for Ubuntu and Debian below.
Run the following commands to get Infer up and running:
# Checkout Infer
git clone https://github.com/facebook/infer.git
cd infer
# Compile Infer
./build-infer.sh java
# Install Infer into your PATH
export PATH=`pwd`/infer/bin:$PATH
Replace ./build-infer.sh java
with ./build-infer.sh clang
to build
the C and Objective-C analyzer from source. Beware that this command
may take a really long time because it will compile a custom version
of clang. This custom version is used by Infer to parse C and
Objective-C source code. We encourage you to use a
release instead, which
ship with clang already compiled.
See ./build-infer.sh --help
for more options, eg ./build-infer.sh
on its own will build the analyzers for both Java and C/ObjC.
If for some reason you prefer to install Infer's OCaml dependencies by some means other than opam, you can still compile Infer by running:
./autogen.sh
./configure # Disable Java or C/C++/ObjC analyzers with --disable-java-analyzers or --disable-c-analyzers
make
# Install Infer into your PATH...
export PATH=`pwd`/infer/bin:$PATH
# ...or, alternatively, install Infer system-wide
sudo make install
Here are instructions on how to install the dependencies needed to compile Infer on a few Linux distributions.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y \
autoconf \
automake \
build-essential \
git \
libgmp-dev \
libmpc-dev \
libmpfr-dev \
m4 \
openjdk-7-jdk \
pkg-config \
python-software-properties \
unzip \
zlib1g-dev
sudo apt install -y \
autoconf \
automake \
build-essential \
git \
libgmp-dev \
libmpc-dev \
libmpfr-dev \
m4 \
openjdk-7-jdk \
unzip \
zlib1g-dev \
opam \
rsync \
pkg-config \
libncurses-dev \
python \
aspcud
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y \
autoconf \
automake \
build-essential \
g++-4.8 \
gcc-4.8 \
git \
libgmp-dev \
libmpc-dev \
libmpfr-dev \
m4 \
openjdk-7-jdk \
pkg-config \
python-software-properties \
unzip \
zlib1g-dev
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.8
Unfortunately, the version of opam that ships with some Linux distributions is broken, so you'll have to get it from the web.
The OCaml dependencies needed by Infer are automatically handled by
opam when running ./build-infer.sh
.