Facebook Infer安装总结

119 篇文章 0 订阅
11 篇文章 0 订阅

最近想对iOS项目的代码进行静态分析,最后在几个成熟的工具中选择了Facebook的Infer工具。

然后对照github上的说明安装:https://github.com/facebook/infer/blob/master/INSTALL.md

中间踩了一些坑,记录下来方便后面自己再遇到时查阅。


1.
安装brew: 
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1


sudo brew update


2.
安装wget: 

brew install wget (不一定需要,顺便安装下)


3.

使用brew安装一些工具:
brew install autoconf automake cmake opam pkg-config
brew install caskroom/cask/brew-cask
brew cask install java




4.

opam工具更新和配置:


opam update


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


1. To configure OPAM in the current shell session, you need to run:


      eval `opam config env`


2. To correctly configure OPAM for subsequent use, add the following
   line to your profile file (for instance ~/.bash_profile):


      . /Users/Ben/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true


3. To avoid issues related to non-system installations of `ocamlfind`
   add the following lines to ~/.ocamlinit (create it if necessary):


      let () =
        try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
        with Not_found -> ()
      ;;


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


5.

安装xcpretty工具:
sudo gem install xcpretty -n/usr/local/bin


6.

从源码安装编译Infer工具:(安装过程中根据需要修改目录下面的opam配置文件中相关工具版本号)
git clone https://github.com/facebook/infer.git
cd infer
./build-infer.sh clang
export PATH=`pwd`/infer/bin:$PATH


echo "export PATH=\"\$PATH:`pwd`/infer/bin\"" \ >> ~/.bash_profile 
source ~/.bash_profile


7.

进入需要检查的项目目录下,使用命令进行静态分析,最终会在项目目录中生成infer-out文件夹,里面会有report.json、report.csv、bugs.txt三种格式的结果文件:


xcodebuild -workspace ./xxxx.xcworkspace -scheme xxxx -configuration Debug -sdk iphonesimulator clean 
infer -- xcodebuild -workspace ./xxxx.xcworkspace -scheme xxxx -configuration Debug -sdk iphonesimulator

增量分析的话接着上面执行:

infer --incremental -- xcodebuild -workspace ./xxxx.xcworkspace -scheme xxxx -configuration Debug -sdk iphonesimulator  (--incremental可以写成--i)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值