一、安装附属项
参考资源:https://github.com/facebook/infer/blob/master/INSTALL.md#pre-compiled-versions
编写shell文件:
gedit ~/Desktop/install.sh
添加如下代码到install.sh
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 \
python-software-properties \
unzip \
zlib1g-dev
为文件添加可执行权限
sudo chmod +x ~/Desktop/install.sh
运行
~/Desktop/install.sh
二、下载最新release版Infer 0.8.1
下载链接:https://github.com/facebook/infer/releases/tag/v0.8.1
infer-linux64-v0.8.1.tar.xz
运行如下命令:
tar xf infer-linux64-v0.8.1.tar.xz
cd infer-linux64-v0.8.1/
./build-infer.sh
export PATH=`pwd`/infer/bin:$PATH
遇到如下问题:
checking for OCaml findlib package atdgen version 1.6.0... not found
configure: error: missing dependency: atdgen.
If you are using opam, please run
opam update
opam pin add --yes --no-action infer .
opam install --deps-only infer
按照提示解决即可。
三、Hello World测试
测试例子链接:http://fbinfer.com/docs/hello-world.html