From 77ab0565c42ce357cc58b5b3ade9ec530445f48b Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 22 Oct 2015 08:41:14 -0700 Subject: [PATCH] rewrite some of the install instructions Reviewed By: cristianoc Differential Revision: D2522741 fb-gh-sync-id: 733ee48 --- INSTALL.md | 165 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 124 insertions(+), 41 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 67bd0747e..e68cd075d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,80 +1,162 @@ +# How to compile and install Infer -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. -Install the dependencies for your operating system and then follow the instructions -in [Infer's getting-started page](http://fbinfer.com/docs/getting-started.html). +## Pre-compiled versions +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 [Infer's getting-started +page](http://fbinfer.com/docs/getting-started.html) to compile and +install Infer. -# Install the dependencies +Alternatively, we also provide a docker image in the docker/ +directory. Simply go to that directory and run `./run.sh` to get +started with a working installation of Infer. -## MacOS X +## Infer dependencies for MacOSX -Here are the prerequisites to be able to compile Infer. Make sure you have -the dependencies installed and opam configured properly. After that either -[use the release](http://fbinfer.com/docs/getting-started.html) (faster), or [compile everything from source](#compile-clang-and-infer-from-source). +Here are the prerequisites to be able to compile Infer on MacOSX. This +is required to be able to [use the +release](http://fbinfer.com/docs/getting-started.html) (faster), or to +compile everything from source (see the end of this document). -### Requirements - -- Python 2.7 - opam (instructions [here](https://opam.ocaml.org/doc/Install.html#OSX)) -- Java <= 1.7 (only needed for the Java analysis) +- Python 2.7 +- Java 1.7 (only needed for the Java 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 <= 7.0, >= 6.1 (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) -### Setup Opam +You can install some of these dependencies using +[Homebrew](http://brew.sh/): -```bash +```sh +brew install opam +``` + +Once you have all the dependencies above installed, configure opam as +follows: + +```sh opam init -y --comp=4.01.0 -eval `opam config env` -opam install -y extlib.1.5.4 atdgen.1.6.0 javalib.2.3.1 sawja.1.5.1 +eval $(opam config env) +opam update +opam install -y \ + atdgen.1.6.0 \ + extlib.1.5.4 \ + javalib.2.3.1 \ + sawja.1.5.1 ``` -## Linux -Here are the prerequisites to be able to compile Infer. Make sure you have -the dependencies installed and opam configured properly. After that either -[use the release](http://fbinfer.com/docs/getting-started.html) (faster), or [compile everything from source](#compile-clang-and-infer-from-source). +## Infer dependencies for Linux -### Requirements +Here are the prerequisites to be able to compile Infer on Linux. This +is required to be able to [use the +release](http://fbinfer.com/docs/getting-started.html) (faster), or to +compile everything from source (see the end of this document). -- Python 2.7 -- opam -- Java <= 1.7 (only needed for the Java analysis) - gcc >= 4.7.2 +- opam +- Python 2.7 +- Java 1.7 (only needed for the Java analysis) -### How to install the requirements on Ubuntu 12.04.4 LTS +### How to install the dependencies on Ubuntu 12.04.4 LTS -```bash +```sh sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get upgrade -sudo apt-get install git openjdk-7-jdk m4 zlib1g-dev python-software-properties build-essential libgmp-dev libmpfr-dev libmpc-dev unzip -sudo apt-get install gcc-4.8 g++-4.8 -sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 +sudo apt-get install -y \ + build-essential \ + g++-4.8 \ + gcc-4.8 \ + git \ + libgmp-dev \ + libmpc-dev \ + libmpfr-dev \ + m4 \ + openjdk-7-jdk \ + 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 ``` -### How to install the requirements on Debian 7 / Ubuntu 14.04 +### How to install the dependencies on Debian 7 / Ubuntu 14.04 -```bash +```sh sudo apt-get update sudo apt-get upgrade -sudo apt-get install git openjdk-7-jdk m4 zlib1g-dev python-software-properties build-essential libgmp-dev libmpfr-dev libmpc-dev unzip +sudo apt-get install -y \ + build-essential \ + git \ + libgmp-dev \ + libmpc-dev \ + libmpfr-dev \ + m4 \ + openjdk-7-jdk \ + python-software-properties \ + unzip \ + zlib1g-dev ``` -### Setup Opam +### Setting up Opam -```bash -wget https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux -O opam +Unfortunately, the version of opam that ships with some Linux +distributions is broken, so you'll have to get it from the web: + +```sh +wget -O opam https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux chmod +x opam +``` + +Alternatively, follow the instructions [from the opam +webpage](https://opam.ocaml.org/doc/Install.html). + +Once opam is installed, run the following commands: + +```sh ./opam init -y --comp=4.01.0 -eval `./opam config env` -./opam install -y extlib.1.5.4 atdgen.1.6.0 javalib.2.3.1 sawja.1.5.1 +eval $(./opam config env) +./opam update +./opam install -y \ + atdgen.1.6.0 \ + extlib.1.5.4 \ + javalib.2.3.1 \ + sawja.1.5.1 ``` -# Compile clang and Infer from source -Infer uses a special version of clang along with a clang plugin. Follow these instructions to compile them from source. Alternatively, you can skip these instructions and use the [release](http://fbinfer.com/docs/getting-started.html). +## Compile Infer from source for the Java analysis + +If you use Infer to analyze Java programs only, you can simple use +these steps to get Infer up and running: + +```sh +# Checkout Infer +git clone https://github.com/facebook/infer.git +cd infer +# Compile Infer +make -C infer java +# Install Infer into your PATH +export PATH=`pwd`/infer/bin:$PATH +``` + + +## Compile Infer from source with clang enabled + +You do not need to follow the instructions below if you are using a +[release of Infer](http://fbinfer.com/docs/getting-started.html) or if +you only need to run Infer on Java programs. +Infer uses a special version of clang along with a clang +plugin. Follow these steps to compile them from source and install +Infer. -```bash +```sh # Checkout Infer git clone https://github.com/facebook/infer.git cd infer @@ -85,5 +167,6 @@ facebook-clang-plugins/clang/setup.sh # go have a coffee :) ./compile-fcp.sh # Compile Infer make -C infer +# Install Infer into your PATH export PATH=`pwd`/infer/bin:$PATH ```