利用docker技术在ubuntu14.04下尝试了一下linux环境安装infer

下载源码


root@4c4ab5d66584:/home# git clone https://github.com/facebook/infer.git
Cloning into 'infer'...
remote: Counting objects: 2443, done.
remote: Compressing objects: 100% (259/259), done.
remote: Total 2443 (delta 124), reused 0 (delta 0), pack-reused 2177
Receiving objects: 100% (2443/2443), 35.01 MiB | 200 KiB/s, done.
Resolving deltas: 100% (959/959), done.

更新升级apt-get工具

更新


root@4c4ab5d66584:/home# apt-get update
Hit http://archive.ubuntu.com precise Release.gpg
Get:1 http://archive.ubuntu.com precise-updates Release.gpg [198 B]
Get:2 http://archive.ubuntu.com precise-security Release.gpg [198 B]
Hit http://archive.ubuntu.com precise Release
Get:3 http://archive.ubuntu.com precise-updates Release [196 kB]
Get:4 http://archive.ubuntu.com precise-security Release [54.3 kB]
Hit http://archive.ubuntu.com precise/main Sources         
Hit http://archive.ubuntu.com precise/restricted Sources
Hit http://archive.ubuntu.com precise/universe Sources
Hit http://archive.ubuntu.com precise/main amd64 Packages
Hit http://archive.ubuntu.com precise/restricted amd64 Packages  
Hit http://archive.ubuntu.com precise/universe amd64 Packages
Hit http://archive.ubuntu.com precise/main i386 Packages
Hit http://archive.ubuntu.com precise/restricted i386 Packages
Hit http://archive.ubuntu.com precise/universe i386 Packages
Get:5 http://archive.ubuntu.com precise-updates/main Sources [601 kB]
Get:6 http://archive.ubuntu.com precise-updates/restricted Sources [8152 B]    
Get:7 http://archive.ubuntu.com precise-updates/universe Sources [149 kB]      
Get:8 http://archive.ubuntu.com precise-updates/main amd64 Packages [1182 kB]  
Get:9 http://archive.ubuntu.com precise-updates/restricted amd64 Packages [20.8 kB]
Get:10 http://archive.ubuntu.com precise-updates/universe amd64 Packages [344 kB]
Get:11 http://archive.ubuntu.com precise-updates/main i386 Packages [1244 kB]  
Get:12 http://archive.ubuntu.com precise-updates/restricted i386 Packages [20.7 kB]
Get:13 http://archive.ubuntu.com precise-updates/universe i386 Packages [355 kB]
Get:14 http://archive.ubuntu.com precise-security/main Sources [165 kB]        
Get:15 http://archive.ubuntu.com precise-security/restricted Sources [3565 B]  
Get:16 http://archive.ubuntu.com precise-security/universe Sources [49.9 kB]   
Get:17 http://archive.ubuntu.com precise-security/main amd64 Packages [671 kB] 
Get:18 http://archive.ubuntu.com precise-security/restricted amd64 Packages [14.9 kB]
Get:19 http://archive.ubuntu.com precise-security/universe amd64 Packages [157 kB]
Get:20 http://archive.ubuntu.com precise-security/main i386 Packages [731 kB]  
Get:21 http://archive.ubuntu.com precise-security/restricted i386 Packages [14.9 kB]
Get:22 http://archive.ubuntu.com precise-security/universe i386 Packages [166 kB]
Fetched 6148 kB in 58s (105 kB/s)                                              
Reading package lists... Done

升级

root@4c4ab5d66584:/home# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  patch python2.7 python2.7-minimal
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 4498 kB of archives.
After this operation, 13.3 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ precise-updates/main python2.7 amd64 2.7.3-0ubuntu3.8 [2676 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ precise-updates/main python2.7-minimal amd64 2.7.3-0ubuntu3.8 [1743 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ precise-updates/main patch amd64 2.6.1-3ubuntu0.1 [80.0 kB]
Fetched 4498 kB in 39s (113 kB/s)                                              
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 15984 files and directories currently installed.)
Preparing to replace python2.7 2.7.3-0ubuntu3.6 (using .../python2.7_2.7.3-0ubuntu3.8_amd64.deb) ...
Unpacking replacement python2.7 ...
Preparing to replace python2.7-minimal 2.7.3-0ubuntu3.6 (using .../python2.7-minimal_2.7.3-0ubuntu3.8_amd64.deb) ...
Unpacking replacement python2.7-minimal ...
Setting up python2.7-minimal (2.7.3-0ubuntu3.8) ...
(Reading database ... 15984 files and directories currently installed.)
Preparing to replace patch 2.6.1-3 (using .../patch_2.6.1-3ubuntu0.1_amd64.deb) ...
Unpacking replacement patch ...
Setting up python2.7 (2.7.3-0ubuntu3.8) ...
Setting up patch (2.6.1-3ubuntu0.1) ...

安装依赖库

root@4c4ab5d66584:/home# apt-get install m4 zlib1g-dev python-software-properties build-essential libgmp-dev libmpfr-dev libmpc-dev unzip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apt-utils binutils bzip2 dpkg-dev fakeroot g++ g++-4.6 gcc gcc-4.6 iso-codes
  libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
  libapt-inst1.4 libc-dev-bin libc6-dev libdpkg-perl libgmpxx4ldbl libgomp1
  libquadmath0 libstdc++6-4.6-dev libtimedate-perl linux-libc-dev lsb-release
  make manpages manpages-dev python-apt python-apt-common
  python-gnupginterface python-pycurl unattended-upgrades xz-lzma
Suggested packages:
  binutils-doc bzip2-doc debian-keyring g++-multilib g++-4.6-multilib
  gcc-4.6-doc libstdc++6-4.6-dbg gcc-multilib autoconf automake1.9 libtool
  flex bison gdb gcc-doc gcc-4.6-multilib libmudflap0-4.6-dev gcc-4.6-locales
  libgcc1-dbg libgomp1-dbg libquadmath0-dbg libmudflap0-dbg binutils-gold
  isoquery glibc-doc libgmp10-doc libmpfr-doc libstdc++6-4.6-doc lsb make-doc
  man-browser python-apt-dbg python-gtk2 python-vte python-apt-doc
  libcurl4-gnutls-dev python-pycurl-dbg bsd-mailx zip
Recommended packages:
  libstdc++-dev
The following NEW packages will be installed:
  apt-utils binutils build-essential bzip2 dpkg-dev fakeroot g++ g++-4.6 gcc
  gcc-4.6 iso-codes libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libapt-inst1.4 libc-dev-bin libc6-dev libdpkg-perl
  libgmp-dev libgmpxx4ldbl libgomp1 libmpc-dev libmpfr-dev libquadmath0
  libstdc++6-4.6-dev libtimedate-perl linux-libc-dev lsb-release m4 make
  manpages manpages-dev python-apt python-apt-common python-gnupginterface
  python-pycurl python-software-properties unattended-upgrades unzip xz-lzma
  zlib1g-dev
0 upgraded, 41 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.6 MB of archives.
After this operation, 93.7 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ precise-updates/main libapt-inst1.4 amd64 0.8.16~exp12ubuntu10.24 [99.8 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ precise/main libgmpxx4ldbl amd64 2:5.0.2+dfsg-2ubuntu1 [8720 B]
Get:3 http://archive.ubuntu.com/ubuntu/ precise/main libgomp1 amd64 4.6.3-1ubuntu5 [25.5 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ precise/main libquadmath0 amd64 4.6.3-1ubuntu5 [126 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ precise-updates/main apt-utils amd64 0.8.16~exp12ubuntu10.24 [190 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ precise/main bzip2 amd64 1.0.6-1 [37.8 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ precise-updates/main lsb-release all 4.0-0ubuntu20.3 [11.0 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ precise/main iso-codes all 3.31-1 [3547 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ precise/main manpages all 3.35-0.1ubuntu1 [584 kB]
Get:10 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-apt-common all 0.8.3ubuntu7.3 [21.4 kB]
Get:11 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-apt amd64 0.8.3ubuntu7.3 [187 kB]
Get:12 http://archive.ubuntu.com/ubuntu/ precise/main python-gnupginterface all 0.3.2-9.1ubuntu3 [19.2 kB]
Get:13 http://archive.ubuntu.com/ubuntu/ precise/main xz-lzma all 5.1.1alpha+20110809-3 [12.4 kB]
Get:14 http://archive.ubuntu.com/ubuntu/ precise-updates/main binutils amd64 2.22-6ubuntu1.3 [2657 kB]
Get:15 http://archive.ubuntu.com/ubuntu/ precise-updates/main libc-dev-bin amd64 2.15-0ubuntu10.12 [83.1 kB]
Get:16 http://archive.ubuntu.com/ubuntu/ precise-updates/main linux-libc-dev amd64 3.2.0-86.124 [856 kB]
Get:17 http://archive.ubuntu.com/ubuntu/ precise-updates/main libc6-dev amd64 2.15-0ubuntu10.12 [2942 kB]
Get:18 http://archive.ubuntu.com/ubuntu/ precise/main gcc-4.6 amd64 4.6.3-1ubuntu5 [7572 kB]
Get:19 http://archive.ubuntu.com/ubuntu/ precise/main gcc amd64 4:4.6.3-1ubuntu5 [5114 B]
Get:20 http://archive.ubuntu.com/ubuntu/ precise/main libstdc++6-4.6-dev amd64 4.6.3-1ubuntu5 [1660 kB]
Get:21 http://archive.ubuntu.com/ubuntu/ precise/main g++-4.6 amd64 4.6.3-1ubuntu5 [6954 kB]
Get:22 http://archive.ubuntu.com/ubuntu/ precise/main g++ amd64 4:4.6.3-1ubuntu5 [1442 B]
Get:23 http://archive.ubuntu.com/ubuntu/ precise-updates/main make amd64 3.81-8.1ubuntu1.1 [119 kB]
Get:24 http://archive.ubuntu.com/ubuntu/ precise/main libtimedate-perl all 1.2000-1 [41.6 kB]
Get:25 http://archive.ubuntu.com/ubuntu/ precise-updates/main libdpkg-perl all 1.16.1.2ubuntu7.6 [181 kB]
Get:26 http://archive.ubuntu.com/ubuntu/ precise-updates/main dpkg-dev all 1.16.1.2ubuntu7.6 [468 kB]
Get:27 http://archive.ubuntu.com/ubuntu/ precise-updates/main build-essential amd64 11.5ubuntu2.1 [5816 B]
Get:28 http://archive.ubuntu.com/ubuntu/ precise/main fakeroot amd64 1.18.2-1 [87.2 kB]
Get:29 http://archive.ubuntu.com/ubuntu/ precise/main libalgorithm-diff-perl all 1.19.02-2 [50.7 kB]
Get:30 http://archive.ubuntu.com/ubuntu/ precise/main libalgorithm-diff-xs-perl amd64 0.04-2build2 [12.4 kB]
Get:31 http://archive.ubuntu.com/ubuntu/ precise/main libalgorithm-merge-perl all 0.08-2 [12.7 kB]
Get:32 http://archive.ubuntu.com/ubuntu/ precise/main libgmp-dev amd64 2:5.0.2+dfsg-2ubuntu1 [351 kB]
Get:33 http://archive.ubuntu.com/ubuntu/ precise/main libmpfr-dev amd64 3.1.0-3ubuntu2 [248 kB]
Get:34 http://archive.ubuntu.com/ubuntu/ precise/main m4 amd64 1.4.16-2ubuntu1 [200 kB]
Get:35 http://archive.ubuntu.com/ubuntu/ precise/main manpages-dev all 3.35-0.1ubuntu1 [1671 kB]
Get:36 http://archive.ubuntu.com/ubuntu/ precise-updates/main unattended-upgrades all 0.76ubuntu1.1 [24.7 kB]
Get:37 http://archive.ubuntu.com/ubuntu/ precise/main python-pycurl amd64 7.19.0-4ubuntu3 [49.2 kB]
Get:38 http://archive.ubuntu.com/ubuntu/ precise-updates/main python-software-properties all 0.82.7.7 [23.5 kB]
Get:39 http://archive.ubuntu.com/ubuntu/ precise-updates/main unzip amd64 6.0-4ubuntu2.3 [194 kB]
Get:40 http://archive.ubuntu.com/ubuntu/ precise/main zlib1g-dev amd64 1:1.2.3.4.dfsg-3ubuntu4 [165 kB]
Get:41 http://archive.ubuntu.com/ubuntu/ precise/main libmpc-dev amd64 0.9-4 [52.1 kB]
Fetched 31.6 MB in 11min 1s (47.7 kB/s)                                        
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libapt-inst1.4.
(Reading database ... 15984 files and directories currently installed.)
Unpacking libapt-inst1.4 (from .../libapt-inst1.4_0.8.16~exp12ubuntu10.24_amd64.deb) ...
Selecting previously unselected package libgmpxx4ldbl.
Unpacking libgmpxx4ldbl (from .../libgmpxx4ldbl_2%3a5.0.2+dfsg-2ubuntu1_amd64.deb) ...
Selecting previously unselected package libgomp1.
Unpacking libgomp1 (from .../libgomp1_4.6.3-1ubuntu5_amd64.deb) ...
Selecting previously unselected package libquadmath0.
Unpacking libquadmath0 (from .../libquadmath0_4.6.3-1ubuntu5_amd64.deb) ...
Selecting previously unselected package apt-utils.
Unpacking apt-utils (from .../apt-utils_0.8.16~exp12ubuntu10.24_amd64.deb) ...
Selecting previously unselected package bzip2.
Unpacking bzip2 (from .../bzip2_1.0.6-1_amd64.deb) ...
Selecting previously unselected package lsb-release.
Unpacking lsb-release (from .../lsb-release_4.0-0ubuntu20.3_all.deb) ...
Selecting previously unselected package iso-codes.
Unpacking iso-codes (from .../iso-codes_3.31-1_all.deb) ...
Selecting previously unselected package manpages.
Unpacking manpages (from .../manpages_3.35-0.1ubuntu1_all.deb) ...
Selecting previously unselected package python-apt-common.
Unpacking python-apt-common (from .../python-apt-common_0.8.3ubuntu7.3_all.deb) ...
Selecting previously unselected package python-apt.
Unpacking python-apt (from .../python-apt_0.8.3ubuntu7.3_amd64.deb) ...
Selecting previously unselected package python-gnupginterface.
Unpacking python-gnupginterface (from .../python-gnupginterface_0.3.2-9.1ubuntu3_all.deb) ...
Selecting previously unselected package xz-lzma.
Unpacking xz-lzma (from .../xz-lzma_5.1.1alpha+20110809-3_all.deb) ...
Selecting previously unselected package binutils.
Unpacking binutils (from .../binutils_2.22-6ubuntu1.3_amd64.deb) ...
Selecting previously unselected package libc-dev-bin.
Unpacking libc-dev-bin (from .../libc-dev-bin_2.15-0ubuntu10.12_amd64.deb) ...
Selecting previously unselected package linux-libc-dev.
Unpacking linux-libc-dev (from .../linux-libc-dev_3.2.0-86.124_amd64.deb) ...
Selecting previously unselected package libc6-dev.
Unpacking libc6-dev (from .../libc6-dev_2.15-0ubuntu10.12_amd64.deb) ...
Selecting previously unselected package gcc-4.6.
Unpacking gcc-4.6 (from .../gcc-4.6_4.6.3-1ubuntu5_amd64.deb) ...
Selecting previously unselected package gcc.
Unpacking gcc (from .../gcc_4%3a4.6.3-1ubuntu5_amd64.deb) ...
Selecting previously unselected package libstdc++6-4.6-dev.
Unpacking libstdc++6-4.6-dev (from .../libstdc++6-4.6-dev_4.6.3-1ubuntu5_amd64.deb) ...
Selecting previously unselected package g++-4.6.
Unpacking g++-4.6 (from .../g++-4.6_4.6.3-1ubuntu5_amd64.deb) ...
Selecting previously unselected package g++.
Unpacking g++ (from .../g++_4%3a4.6.3-1ubuntu5_amd64.deb) ...
Selecting previously unselected package make.
Unpacking make (from .../make_3.81-8.1ubuntu1.1_amd64.deb) ...
Selecting previously unselected package libtimedate-perl.
Unpacking libtimedate-perl (from .../libtimedate-perl_1.2000-1_all.deb) ...
Selecting previously unselected package libdpkg-perl.
Unpacking libdpkg-perl (from .../libdpkg-perl_1.16.1.2ubuntu7.6_all.deb) ...
Selecting previously unselected package dpkg-dev.
Unpacking dpkg-dev (from .../dpkg-dev_1.16.1.2ubuntu7.6_all.deb) ...
Selecting previously unselected package build-essential.
Unpacking build-essential (from .../build-essential_11.5ubuntu2.1_amd64.deb) ...
Selecting previously unselected package fakeroot.
Unpacking fakeroot (from .../fakeroot_1.18.2-1_amd64.deb) ...
Selecting previously unselected package libalgorithm-diff-perl.
Unpacking libalgorithm-diff-perl (from .../libalgorithm-diff-perl_1.19.02-2_all.deb) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Unpacking libalgorithm-diff-xs-perl (from .../libalgorithm-diff-xs-perl_0.04-2build2_amd64.deb) ...
Selecting previously unselected package libalgorithm-merge-perl.
Unpacking libalgorithm-merge-perl (from .../libalgorithm-merge-perl_0.08-2_all.deb) ...
Selecting previously unselected package libgmp-dev.
Unpacking libgmp-dev (from .../libgmp-dev_2%3a5.0.2+dfsg-2ubuntu1_amd64.deb) ...
Selecting previously unselected package libmpfr-dev.
Unpacking libmpfr-dev (from .../libmpfr-dev_3.1.0-3ubuntu2_amd64.deb) ...
Selecting previously unselected package m4.
Unpacking m4 (from .../m4_1.4.16-2ubuntu1_amd64.deb) ...
Selecting previously unselected package manpages-dev.
Unpacking manpages-dev (from .../manpages-dev_3.35-0.1ubuntu1_all.deb) ...
Selecting previously unselected package unattended-upgrades.
Unpacking unattended-upgrades (from .../unattended-upgrades_0.76ubuntu1.1_all.deb) ...
Selecting previously unselected package python-pycurl.
Unpacking python-pycurl (from .../python-pycurl_7.19.0-4ubuntu3_amd64.deb) ...
Selecting previously unselected package python-software-properties.
Unpacking python-software-properties (from .../python-software-properties_0.82.7.7_all.deb) ...
Selecting previously unselected package unzip.
Unpacking unzip (from .../unzip_6.0-4ubuntu2.3_amd64.deb) ...
Selecting previously unselected package zlib1g-dev.
Unpacking zlib1g-dev (from .../zlib1g-dev_1%3a1.2.3.4.dfsg-3ubuntu4_amd64.deb) ...
Selecting previously unselected package libmpc-dev.
Unpacking libmpc-dev (from .../libmpc-dev_0.9-4_amd64.deb) ...
Setting up libapt-inst1.4 (0.8.16~exp12ubuntu10.24) ...
Setting up libgmpxx4ldbl (2:5.0.2+dfsg-2ubuntu1) ...
Setting up libgomp1 (4.6.3-1ubuntu5) ...
Setting up libquadmath0 (4.6.3-1ubuntu5) ...
Setting up apt-utils (0.8.16~exp12ubuntu10.24) ...
Setting up bzip2 (1.0.6-1) ...
Setting up lsb-release (4.0-0ubuntu20.3) ...
Setting up iso-codes (3.31-1) ...
Setting up manpages (3.35-0.1ubuntu1) ...
Setting up python-apt-common (0.8.3ubuntu7.3) ...
Setting up python-apt (0.8.3ubuntu7.3) ...
Setting up python-gnupginterface (0.3.2-9.1ubuntu3) ...
Setting up xz-lzma (5.1.1alpha+20110809-3) ...
Setting up binutils (2.22-6ubuntu1.3) ...
Setting up libc-dev-bin (2.15-0ubuntu10.12) ...
Setting up linux-libc-dev (3.2.0-86.124) ...
Setting up libc6-dev (2.15-0ubuntu10.12) ...
Setting up gcc-4.6 (4.6.3-1ubuntu5) ...
Setting up gcc (4:4.6.3-1ubuntu5) ...
Setting up make (3.81-8.1ubuntu1.1) ...
Setting up libtimedate-perl (1.2000-1) ...
Setting up libdpkg-perl (1.16.1.2ubuntu7.6) ...
Setting up dpkg-dev (1.16.1.2ubuntu7.6) ...
Setting up fakeroot (1.18.2-1) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode.
Setting up libalgorithm-diff-perl (1.19.02-2) ...
Setting up libalgorithm-diff-xs-perl (0.04-2build2) ...
Setting up libalgorithm-merge-perl (0.08-2) ...
Setting up libgmp-dev (2:5.0.2+dfsg-2ubuntu1) ...
Setting up libmpfr-dev (3.1.0-3ubuntu2) ...
Setting up m4 (1.4.16-2ubuntu1) ...
Setting up manpages-dev (3.35-0.1ubuntu1) ...
Setting up unattended-upgrades (0.76ubuntu1.1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Setting up python-pycurl (7.19.0-4ubuntu3) ...
Setting up python-software-properties (0.82.7.7) ...
Setting up unzip (6.0-4ubuntu2.3) ...
Setting up zlib1g-dev (1:1.2.3.4.dfsg-3ubuntu4) ...
Setting up libmpc-dev (0.9-4) ...
Setting up libstdc++6-4.6-dev (4.6.3-1ubuntu5) ...
Setting up g++-4.6 (4.6.3-1ubuntu5) ...
Setting up g++ (4:4.6.3-1ubuntu5) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode.
Setting up build-essential (11.5ubuntu2.1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

安装OPAM

安装wget

root@4c4ab5d66584:/home# apt-get install wget
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  wget
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 280 kB of archives.
After this operation, 610 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ precise-updates/main wget amd64 1.13.4-2ubuntu1.2 [280 kB]
Fetched 280 kB in 4s (62.0 kB/s)
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 1.)
debconf: falling back to frontend: Readline
Selecting previously unselected package wget.
(Reading database ... 21672 files and directories currently installed.)
Unpacking wget (from .../wget_1.13.4-2ubuntu1.2_amd64.deb) ...
Setting up wget (1.13.4-2ubuntu1.2) ...

通过源码安装opam

root@4c4ab5d66584:/home# wget https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux -O opam
--2015-06-30 07:33:17--  https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux
Resolving github.com (github.com)... 192.30.252.129
Connecting to github.com (github.com)|192.30.252.129|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://s3.amazonaws.com/github-cloud/releases/3473767/3a1c1c10-f4cf-11e4-8de7-0c05074e3d76.2-x86_64-Linux?response-content-disposition=attachment%3B%20filename%3Dopam-1.2.2-x86_64-Linux&response-content-type=application/octet-stream&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1435649660&Signature=1UDZORxP8eVBRccpcW5DMst1MLU%3D [following]
--2015-06-30 07:33:20--  https://s3.amazonaws.com/github-cloud/releases/3473767/3a1c1c10-f4cf-11e4-8de7-0c05074e3d76.2-x86_64-Linux?response-content-disposition=attachment%3B%20filename%3Dopam-1.2.2-x86_64-Linux&response-content-type=application/octet-stream&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1435649660&Signature=1UDZORxP8eVBRccpcW5DMst1MLU%3D
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.18.32
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.18.32|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6265225 (6.0M) [application/octet-stream]
Saving to: `opam'

100%[======================================>] 6,265,225   39.3K/s   in 4m 38s  

2015-06-30 07:37:59 (22.0 KB/s) - `opam' saved [6265225/6265225]

初始化opam

赋权限

root@4c4ab5d66584:/home# chmod +x opam

初始化

root@4c4ab5d66584:/home#  ./opam init --comp=4.01.0
[WARNING] Running as root is not recommended
Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg
    command on your system.
  - you won't be able to use darcs repositories unless you install the darcs
    command on your system.

[WARNING] Recommended external solver aspcud not found.

=-=- Fetching repository information =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[default] synchronized from https://opam.ocaml.org

=-=- Installing compiler 4.01.0 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[compiler.get] http://caml.inria.fr/pub/distrib/ocaml-4.01/ocaml-4.01.0.tar.gz downloaded
Now compiling OCaml. This may take a while, please bear with us...
Done.

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-> installed base-bigarray.base
-> installed base-threads.base
-> installed base-unix.base
Done.

In normal operation, OPAM only alters files within ~/.opam.

During this initialisation, you can allow OPAM to add information to two
other files for best results. You can also make these additions manually
if you wish.

If you agree, OPAM will modify:

  - ~/.profile (or a file you specify) to set the right environment
    variables and to load the auto-completion scripts for your shell (sh)
    on startup. Specifically, it checks for and appends the following line:

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


  - ~/.ocamlinit to ensure that non-system installations of `ocamlfind`
    (i.e. those installed by OPAM) will work correctly when running the
    OCaml toplevel. It does this by adding $OCAML_TOPLEVEL_PATH to the list
    of include directories.

If you choose to not configure your system now, you can either configure
OPAM manually (instructions will be displayed) or launch the automatic setup
later by running:

   opam config setup -a


Do you want OPAM to modify ~/.profile and ~/.ocamlinit?
(default is 'no', use 'f' to name a file other than ~/.profile)
    [N/y/f] y

User configuration:
  Generating ~/.ocamlinit.
  Updating ~/.profile.
Global configuration:
  Updating ~/.opam/opam-init/init.sh
  Updating ~/.opam/opam-init/init.zsh
  Updating ~/.opam/opam-init/init.csh
  Updating ~/.opam/opam-init/init.fish
# To setup the new switch in the current shell, you need to run:
eval `opam config env`

设置opam环境变量

root@4c4ab5d66584:/home# eval `./opam config env`
[WARNING] Running as root is not recommended

利用opam安装其他工具

root@4c4ab5d66584:/home# ./opam install sawja.1.5 atdgen.1.5.0 javalib.2.3a extlib.1.5.4
[WARNING] Running as root is not recommended
The following actions will be performed:
  - install ocamlfind   1.5.5                           [required by javalib, atdgen, extlib, sawja]
  - install camlp4      4.01.0                          [required by extlib]
  - install menhir      20140422                        [required by atd]
  - install easy-format 1.0.2                           [required by biniou, atd, yojson]
  - install cppo        1.1.2                           [required by yojson]
  - install camlzip     1.05                            [required by javalib]
  - install extlib      1.5.4   
  - install biniou      1.0.9                           [required by atdgen]
  - install atd         1.1.2                           [required by atdgen]
  - install javalib     2.3a    
  - install yojson      1.2.1                           [required by atdgen]
  - install sawja       1.5     
  - install atdgen      1.5.0   
===== 13 to install =====
Do you want to continue ? [Y/n] y

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[default] https://opam.ocaml.org/archives/biniou.1.0.9+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/atdgen.1.5.0+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/atd.1.1.2+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/camlzip.1.05+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/easy-format.1.0.2+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/cppo.1.1.2+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/extlib.1.5.4+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ocamlfind.1.5.5+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/javalib.2.3a+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/menhir.20140422+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/yojson.1.2.1+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/sawja.1.5+opam.tar.gz downloaded

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-> installed camlp4.4.01.0
-> installed ocamlfind.1.5.5
-> installed easy-format.1.0.2
-> installed camlzip.1.05
-> installed biniou.1.0.9
-> installed cppo.1.1.2
-> installed yojson.1.2.1
-> installed extlib.1.5.4
-> installed javalib.2.3a
-> installed menhir.20140422
-> installed atd.1.1.2
-> installed sawja.1.5
-> installed atdgen.1.5.0
Done.

分析Java文件

此时,我们如果只需要分析Java文件,一切已经足够

分析命令

make -C infer java

输出


root@4c4ab5d66584:/home# cd infer
root@4c4ab5d66584:/home/infer# make -C infer java
make: Entering directory `/home/infer/infer'
make -C src java
error: unknown option `points-at'
usage: git tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]
   or: git tag -d <tagname>...
   or: git tag -l [-n[<num>]] [<pattern>...]
   or: git tag -v <tagname>...

    -l, --list            list tag names
    -n[<n>]               print <n> lines of each tag message
    -d, --delete          delete tags
    -v, --verify          verify tags

Tag creation options
    -a, --annotate        annotated tag, needs a message
    -m, --message <message>
                          tag message
    -F, --file <file>     read message from file
    -s, --sign            annotated and GPG-signed tag
    --cleanup <mode>      how to strip spaces and #comments from message
    -u, --local-user <key-id>
                          use another key to sign the tag
    -f, --force           replace the tag if exists

Tag listing options
    --contains <commit>   print only tags that contain the commit

make[1]: Entering directory `/home/infer/infer/src'
sed -e 's/@MAJOR@/0/g' \
        -e 's/@MINOR@/2/g' \
        -e 's/@PATCH@/0/g' \
        -e 's/@GIT_COMMIT@/82c4dc6d104a6643f5433c440e74b0699b7e05bf/g' \
        -e 's/@GIT_BRANCH@/master/g' \
        -e 's/@GIT_TAG@//g' \
        backend/version.ml.in > backend/version.ml
mkdir -p ../_build-infer
atdgen -t backend/jsonbug.atd -o backend/jsonbug
atdgen -j backend/jsonbug.atd -o backend/jsonbug
ocamlbuild -build-dir ../_build-infer -j 0 -I backend -I checkers -I facebook/checkers -I facebook/checkers/graphql -I facebook/scripts -I harness -I opensource -lflags -annot -cflags -bin-annot -lib unix -lib str -cflags -annot -lflags -I,/root/.opam/4.01.0/lib/easy-format,-I,/root/.opam/4.01.0/lib/biniou,-I,/root/.opam/4.01.0/lib/yojson,-I,/root/.opam/4.01.0/lib/atdgen -cflags -I,/root/.opam/4.01.0/lib/easy-format,-I,/root/.opam/4.01.0/lib/biniou,-I,/root/.opam/4.01.0/lib/yojson,-I,/root/.opam/4.01.0/lib/atdgen -lib biniou -lib atdgen -mod easy_format -mod yojson -mod ag_oj_run -mod ag_util  -cflags -annot -lflags -I,/root/.opam/4.01.0/lib/extlib,-I,/root/.opam/4.01.0/lib/camlzip/../zip,-I,/root/.opam/4.01.0/lib/ptrees,-I,/root/.opam/4.01.0/lib/javalib,-I,/root/.opam/4.01.0/lib/sawja -cflags -I,/root/.opam/4.01.0/lib/extlib,-I,/root/.opam/4.01.0/lib/camlzip/../zip,-I,/root/.opam/4.01.0/lib/ptrees,-I,/root/.opam/4.01.0/lib/javalib,-I,/root/.opam/4.01.0/lib/sawja -lib zip -lib extLib -lib ptrees -lib javalib -lib sawja backend/type_prop.native backend/inferanalyze.native backend/inferprint.native java/jMain.native
Finished, 374 targets (0 cached) in 00:00:11.
rsync -r --delete --exclude=*.ml* --exclude=*.o --exclude=*.cm* --exclude=*.native ../_build-infer/* /home/infer/infer/src/_build
cp -f -p ../_build-infer/backend/inferanalyze.native /home/infer/infer/bin/InferAnalyze
cp -f -p ../_build-infer/backend/inferprint.native /home/infer/infer/bin/InferPrint
cp -f -p ../_build-infer/java/jMain.native /home/infer/infer/bin/InferJava
make[1]: Leaving directory `/home/infer/infer/src'
make -C models java
make[1]: Entering directory `/home/infer/infer/models'
make -C java
make[2]: Entering directory `/home/infer/infer/models/java'
rm -rf /home/infer/infer/models/java/models
rm -rf ../../lib/java/models.jar
mkdir /home/infer/infer/models/java/models
INFER_ANALYZE_MODELS=1 /home/infer/infer/models/java/../../bin/inferJ --buck --analyzer infer --multicore 1 javac -bootclasspath ../../lib/java/android/android-19.jar -d /home/infer/infer/models/java/models -classpath ../../../dependencies/java/jackson/jackson-2.2.3.jar src/dalvik/system/CloseGuard.java src/java/security/DigestInputStream.java src/java/security/DigestOutputStream.java src/java/nio/channels/spi/AbstractInterruptibleChannel.java src/java/nio/channels/FileChannel.java src/java/nio/FileChannelImpl.java src/java/net/URLConnection.java src/java/net/ServerSocket.java src/java/net/HttpURLConnection.java src/java/net/Socket.java src/java/net/PlainSocketImpl.java src/java/net/JarURLConnection.java src/java/net/URL.java src/java/io/Reader.java src/java/io/PipedInputStream.java src/java/io/BufferedInputStream.java src/java/io/ObjectOutputStream.java src/java/io/DataInputStream.java src/java/io/PipedReader.java src/java/io/InputStream.java src/java/io/FileInputStream.java src/java/io/FileOutputStream.java src/java/io/ObjectInputStream.java src/java/io/PushbackInputStream.java src/java/io/FilterOutputStream.java src/java/io/FileReader.java src/java/io/BufferedReader.java src/java/io/PipedWriter.java src/java/io/BufferedOutputStream.java src/java/io/PrintStream.java src/java/io/StringReader.java src/java/io/ByteArrayInputStream.java src/java/io/InputStreamReader.java src/java/io/PushbackReader.java src/java/io/FileWriter.java src/java/io/ByteArrayOutputStream.java src/java/io/OutputStream.java src/java/io/RandomAccessFile.java src/java/io/FilterReader.java src/java/io/OutputStreamWriter.java src/java/io/PipedOutputStream.java src/java/io/BufferedWriter.java src/java/io/PrintWriter.java src/java/io/FilterInputStream.java src/java/io/Writer.java src/java/io/DataOutputStream.java src/java/lang/Integer.java src/java/lang/System.java src/java/lang/Thread.java src/java/lang/String.java src/java/lang/NullPointerException.java src/java/lang/Class.java src/java/lang/Process.java src/java/lang/reflect/Array.java src/java/lang/ProcessManager.java src/java/lang/Runtime.java src/java/lang/Object.java src/java/util/Scanner.java src/java/util/Vector.java src/java/util/jar/JarFile.java src/java/util/jar/JarInputStream.java src/java/util/jar/JarOutputStream.java src/java/util/HashMap.java src/java/util/Properties.java src/java/util/zip/GZIPInputStream.java src/java/util/zip/GZIPOutputStream.java src/java/util/zip/ZipInputStream.java src/java/util/zip/ZipOutputStream.java src/java/util/zip/ZipFile.java src/java/util/zip/DeflaterOutputStream.java src/java/util/zip/InflaterOutputStream.java src/java/util/zip/InflaterInputStream.java src/java/util/zip/DeflaterInputStream.java src/java/util/zip/CheckedInputStream.java src/java/util/zip/CheckedOutputStream.java src/javax/net/ssl/HttpsURLConnection.java src/javax/crypto/CipherOutputStream.java src/javax/crypto/CipherInputStream.java src/com/facebook/infer/models/InferBuiltins.java src/com/facebook/infer/models/InferUndefined.java src/com/facebook/infer/models/InferArray.java src/com/facebook/infer/models/InferCloseables.java src/com/google/common/base/Preconditions.java src/com/google/common/io/Closeables.java src/com/google/common/collect/ImmutableList.java src/com/google/common/collect/Iterators.java src/com/squareup/okhttp/internal/StrictLineReader.java src/com/squareup/okhttp/internal/Util.java src/com/fasterxml/jackson/core/JsonFactory.java src/com/fasterxml/jackson/core/JsonParser.java src/com/fasterxml/jackson/core/json/UTF8StreamJsonParser.java src/junit/framework/Assert.java src/android/database/CrossProcessCursor.java src/android/database/CursorWrapper.java src/android/database/sqlite/SQLiteDatabaseConfiguration.java src/android/database/sqlite/SQLiteDatabase.java src/android/database/sqlite/SQLiteQueryBuilder.java src/android/database/sqlite/SQLiteCursor.java src/android/database/sqlite/SQLiteConnectionPool.java src/android/database/AbstractCursor.java src/android/database/CrossProcessCursorWrapper.java src/android/database/Cursor.java src/android/provider/MediaStore.java src/android/content/Context.java src/android/content/ContentProviderClient.java src/android/content/IContentProvider.java src/android/content/IContentService.java src/android/content/res/TypedArray.java src/android/content/res/Resources.java src/android/content/ContentResolver.java src/android/app/Activity.java src/android/app/DownloadManager.java
[INFO] Starting analysis
Starting analysis (Infer version git-82c4dc6d104a6643f5433c440e74b0699b7e05bf)
Analysis finished in 6.082307s

112 files analyzed
[INFO] Analyzed file count: 112
[INFO] Analysis status: 0


cd /home/infer/infer/models/java/models; jar cf /home/infer/infer/models/java/models.jar *
mv /home/infer/infer/models/java/models.jar ../../lib/java/models.jar
make[2]: Leaving directory `/home/infer/infer/models/java'
make[1]: Leaving directory `/home/infer/infer/models'
make -C annotations
make[1]: Entering directory `/home/infer/infer/annotations'
mkdir -p classes
javac -cp ../../dependencies/java/jsr-305/jsr305.jar `find . -name "*.java"`
jar cvf annotations.jar `find . -name "*.java"` `find . -name "*.class"`
added manifest
adding: com/facebook/infer/annotation/Verify.java(in = 453) (out= 226)(deflated 50%)
adding: com/facebook/infer/annotation/SuppressFieldNotInitialized.java(in = 435) (out= 235)(deflated 45%)
adding: com/facebook/infer/annotation/SuppressReturnOverAnnotated.java(in = 435) (out= 232)(deflated 46%)
adding: com/facebook/infer/annotation/Initializer.java(in = 879) (out= 465)(deflated 47%)
adding: com/facebook/infer/annotation/SuppressParameterNotNullable.java(in = 436) (out= 235)(deflated 46%)
adding: com/facebook/infer/annotation/Assertions.java(in = 2000) (out= 485)(deflated 75%)
adding: com/facebook/infer/annotation/Mutable.java(in = 415) (out= 220)(deflated 46%)
adding: com/facebook/infer/annotation/SuppressNullMethodCall.java(in = 430) (out= 232)(deflated 46%)
adding: com/facebook/infer/annotation/Strict.java(in = 489) (out= 251)(deflated 48%)
adding: com/facebook/infer/annotation/SuppressNullFieldAccess.java(in = 431) (out= 232)(deflated 46%)
adding: com/facebook/infer/annotation/SuppressFieldNotNullable.java(in = 432) (out= 233)(deflated 46%)
adding: com/facebook/infer/annotation/Present.java(in = 682) (out= 365)(deflated 46%)
adding: com/facebook/infer/annotation/Initializer.class(in = 447) (out= 277)(deflated 38%)
adding: com/facebook/infer/annotation/Verify.class(in = 439) (out= 275)(deflated 37%)
adding: com/facebook/infer/annotation/SuppressParameterNotNullable.class(in = 481) (out= 290)(deflated 39%)
adding: com/facebook/infer/annotation/Present.class(in = 456) (out= 282)(deflated 38%)
adding: com/facebook/infer/annotation/Assertions.class(in = 2207) (out= 908)(deflated 58%)
adding: com/facebook/infer/annotation/Strict.class(in = 515) (out= 317)(deflated 38%)
adding: com/facebook/infer/annotation/SuppressNullFieldAccess.class(in = 471) (out= 287)(deflated 39%)
adding: com/facebook/infer/annotation/SuppressReturnOverAnnotated.class(in = 479) (out= 286)(deflated 40%)
adding: com/facebook/infer/annotation/Mutable.class(in = 439) (out= 273)(deflated 37%)
adding: com/facebook/infer/annotation/SuppressFieldNotNullable.class(in = 473) (out= 288)(deflated 39%)
adding: com/facebook/infer/annotation/SuppressNullMethodCall.class(in = 469) (out= 287)(deflated 38%)
adding: com/facebook/infer/annotation/SuppressFieldNotInitialized.class(in = 479) (out= 290)(deflated 39%)
make[1]: Leaving directory `/home/infer/infer/annotations'
make: Leaving directory `/home/infer/infer'

将infer添加到环境变量

export PATH=`pwd`/infer/bin:$PATH

这样在任何地方都可以执行infer命令

添加OC/C的分析环境

apt-get install python-software-properties

root@4c4ab5d66584:/home# apt-get install python-software-properties
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-software-properties is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

add-apt-repository ppa:ubuntu-toolchain-r/test

root@4c4ab5d66584:/home# add-apt-repository ppa:ubuntu-toolchain-r/test
You are about to add the following PPA to your system:
 Toolchain test builds; see https://wiki.ubuntu.com/ToolChain

 More info: https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpE1V5bm/secring.gpg' created
gpg: keyring `/tmp/tmpE1V5bm/pubring.gpg' created
gpg: requesting key BA9EF27F from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpE1V5bm/trustdb.gpg: trustdb created
gpg: key BA9EF27F: public key "Launchpad Toolchain builds" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

apt-get update

root@4c4ab5d66584:/home# apt-get update
Hit http://archive.ubuntu.com precise Release.gpg
Get:1 http://archive.ubuntu.com precise-updates Release.gpg [198 B]
Get:2 http://ppa.launchpad.net precise Release.gpg [316 B]
Get:3 http://archive.ubuntu.com precise-security Release.gpg [198 B]
Hit http://archive.ubuntu.com precise Release
Get:4 http://ppa.launchpad.net precise Release [12.9 kB]
Get:5 http://archive.ubuntu.com precise-updates Release [196 kB]
Get:6 http://ppa.launchpad.net precise/main Sources [7966 B]
Get:7 http://ppa.launchpad.net precise/main amd64 Packages [51.6 kB]    
Get:8 http://ppa.launchpad.net precise/main i386 Packages [49.7 kB]
Get:9 http://archive.ubuntu.com precise-security Release [54.3 kB]             
Hit http://archive.ubuntu.com precise/main Sources         
Hit http://archive.ubuntu.com precise/restricted Sources                       
Hit http://archive.ubuntu.com precise/universe Sources                         
Hit http://archive.ubuntu.com precise/main amd64 Packages                      
Hit http://archive.ubuntu.com precise/restricted amd64 Packages                
Hit http://archive.ubuntu.com precise/universe amd64 Packages                  
Hit http://archive.ubuntu.com precise/main i386 Packages                       
Hit http://archive.ubuntu.com precise/restricted i386 Packages                 
Hit http://archive.ubuntu.com precise/universe i386 Packages                   
Get:10 http://archive.ubuntu.com precise-updates/main Sources [601 kB]         
Get:11 http://archive.ubuntu.com precise-updates/restricted Sources [8152 B]   
Get:12 http://archive.ubuntu.com precise-updates/universe Sources [149 kB]     
Get:13 http://archive.ubuntu.com precise-updates/main amd64 Packages [1182 kB] 
Get:14 http://archive.ubuntu.com precise-updates/restricted amd64 Packages [20.8 kB]
Get:15 http://archive.ubuntu.com precise-updates/universe amd64 Packages [344 kB]
Get:16 http://archive.ubuntu.com precise-updates/main i386 Packages [1244 kB]  
Get:17 http://archive.ubuntu.com precise-updates/restricted i386 Packages [20.7 kB]
Get:18 http://archive.ubuntu.com precise-updates/universe i386 Packages [355 kB]
Get:19 http://archive.ubuntu.com precise-security/main Sources [165 kB]        
Get:20 http://archive.ubuntu.com precise-security/restricted Sources [3565 B]  
Get:21 http://archive.ubuntu.com precise-security/universe Sources [49.9 kB]   
Get:22 http://archive.ubuntu.com precise-security/main amd64 Packages [671 kB] 
Get:23 http://archive.ubuntu.com precise-security/restricted amd64 Packages [14.9 kB]
Get:24 http://archive.ubuntu.com precise-security/universe amd64 Packages [157 kB]
Get:25 http://archive.ubuntu.com precise-security/main i386 Packages [731 kB]  
Get:26 http://archive.ubuntu.com precise-security/restricted i386 Packages [14.9 kB]
Get:27 http://archive.ubuntu.com precise-security/universe i386 Packages [166 kB]
Fetched 6270 kB in 2min 12s (47.5 kB/s)                                        
Reading package lists... Done

apt-get install gcc-4.8 g++-4.8


root@4c4ab5d66584:/home# apt-get install gcc-4.8 g++-4.8
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  cpp-4.8 gcc-4.8-base gcc-5-base libasan0 libatomic1 libcloog-isl4
  libgcc-4.8-dev libgcc1 libgomp1 libisl10 libitm1 libquadmath0
  libstdc++-4.8-dev libstdc++6 libtsan0
Suggested packages:
  gcc-4.8-locales g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg
  gcc-4.8-multilib libmudflap0-4.8-dev libgcc1-dbg libgomp1-dbg libitm1-dbg
  libatomic1-dbg libasan0-dbg libtsan0-dbg libbacktrace1-dbg libquadmath0-dbg
  libmudflap0-dbg binutils-gold libstdc++-4.8-doc
The following NEW packages will be installed:
  cpp-4.8 g++-4.8 gcc-4.8 gcc-4.8-base gcc-5-base libasan0 libatomic1
  libcloog-isl4 libgcc-4.8-dev libisl10 libitm1 libstdc++-4.8-dev libtsan0
The following packages will be upgraded:
  libgcc1 libgomp1 libquadmath0 libstdc++6
4 upgraded, 13 newly installed, 0 to remove and 5 not upgraded.
Need to get 27.5 MB of archives.
After this operation, 69.6 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main gcc-5-base amd64 5.1.0-0ubuntu11~12.04.2 [17.5 kB]
Get:2 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libgcc1 amd64 1:5.1.0-0ubuntu11~12.04.2 [44.8 kB]
Get:3 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libstdc++6 amd64 5.1.0-0ubuntu11~12.04.2 [510 kB]
Get:4 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main gcc-4.8-base amd64 4.8.1-2ubuntu1~12.04 [16.0 kB]
Get:5 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libasan0 amd64 4.8.1-2ubuntu1~12.04 [76.0 kB]
Get:6 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libatomic1 amd64 5.1.0-0ubuntu11~12.04.2 [10.5 kB]
Get:7 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libisl10 amd64 0.12.2-2~12.04 [530 kB]
Get:8 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libcloog-isl4 amd64 0.18.2-1~12.04 [67.3 kB]
Get:9 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libgomp1 amd64 5.1.0-0ubuntu11~12.04.2 [63.6 kB]
Get:10 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libitm1 amd64 5.1.0-0ubuntu11~12.04.2 [33.5 kB]
Get:11 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libquadmath0 amd64 5.1.0-0ubuntu11~12.04.2 [145 kB]
Get:12 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libtsan0 amd64 5.1.0-0ubuntu11~12.04.2 [309 kB]
Get:13 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main cpp-4.8 amd64 4.8.1-2ubuntu1~12.04 [5835 kB]
Get:14 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libgcc-4.8-dev amd64 4.8.1-2ubuntu1~12.04 [2792 kB]
Get:15 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main gcc-4.8 amd64 4.8.1-2ubuntu1~12.04 [6609 kB]
Get:16 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main libstdc++-4.8-dev amd64 4.8.1-2ubuntu1~12.04 [1753 kB]
Get:17 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main g++-4.8 amd64 4.8.1-2ubuntu1~12.04 [8707 kB]
Fetched 27.5 MB in 13min 47s (33.2 kB/s)                                       
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 17.)
debconf: falling back to frontend: Readline
Selecting previously unselected package gcc-5-base.
(Reading database ... 21683 files and directories currently installed.)
Unpacking gcc-5-base (from .../gcc-5-base_5.1.0-0ubuntu11~12.04.2_amd64.deb) ...
Setting up gcc-5-base (5.1.0-0ubuntu11~12.04.2) ...
(Reading database ... 21690 files and directories currently installed.)
Preparing to replace libgcc1 1:4.6.3-1ubuntu5 (using .../libgcc1_1%3a5.1.0-0ubuntu11~12.04.2_amd64.deb) ...
Unpacking replacement libgcc1 ...
Setting up libgcc1 (1:5.1.0-0ubuntu11~12.04.2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
(Reading database ... 21690 files and directories currently installed.)
Preparing to replace libstdc++6 4.6.3-1ubuntu5 (using .../libstdc++6_5.1.0-0ubuntu11~12.04.2_amd64.deb) ...
Unpacking replacement libstdc++6 ...
Setting up libstdc++6 (5.1.0-0ubuntu11~12.04.2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Selecting previously unselected package gcc-4.8-base.
(Reading database ... 21704 files and directories currently installed.)
Unpacking gcc-4.8-base (from .../gcc-4.8-base_4.8.1-2ubuntu1~12.04_amd64.deb) ...
Selecting previously unselected package libasan0.
Unpacking libasan0 (from .../libasan0_4.8.1-2ubuntu1~12.04_amd64.deb) ...
Selecting previously unselected package libatomic1.
Unpacking libatomic1 (from .../libatomic1_5.1.0-0ubuntu11~12.04.2_amd64.deb) ...
Selecting previously unselected package libisl10.
Unpacking libisl10 (from .../libisl10_0.12.2-2~12.04_amd64.deb) ...
Selecting previously unselected package libcloog-isl4.
Unpacking libcloog-isl4 (from .../libcloog-isl4_0.18.2-1~12.04_amd64.deb) ...
Preparing to replace libgomp1 4.6.3-1ubuntu5 (using .../libgomp1_5.1.0-0ubuntu11~12.04.2_amd64.deb) ...
Unpacking replacement libgomp1 ...
Selecting previously unselected package libitm1.
Unpacking libitm1 (from .../libitm1_5.1.0-0ubuntu11~12.04.2_amd64.deb) ...
Preparing to replace libquadmath0 4.6.3-1ubuntu5 (using .../libquadmath0_5.1.0-0ubuntu11~12.04.2_amd64.deb) ...
Unpacking replacement libquadmath0 ...
Selecting previously unselected package libtsan0.
Unpacking libtsan0 (from .../libtsan0_5.1.0-0ubuntu11~12.04.2_amd64.deb) ...
Selecting previously unselected package cpp-4.8.
Unpacking cpp-4.8 (from .../cpp-4.8_4.8.1-2ubuntu1~12.04_amd64.deb) ...
Selecting previously unselected package libgcc-4.8-dev.
Unpacking libgcc-4.8-dev (from .../libgcc-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb) ...
Selecting previously unselected package gcc-4.8.
Unpacking gcc-4.8 (from .../gcc-4.8_4.8.1-2ubuntu1~12.04_amd64.deb) ...
Selecting previously unselected package libstdc++-4.8-dev.
Unpacking libstdc++-4.8-dev (from .../libstdc++-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb) ...
Selecting previously unselected package g++-4.8.
Unpacking g++-4.8 (from .../g++-4.8_4.8.1-2ubuntu1~12.04_amd64.deb) ...
Setting up gcc-4.8-base (4.8.1-2ubuntu1~12.04) ...
Setting up libasan0 (4.8.1-2ubuntu1~12.04) ...
Setting up libatomic1 (5.1.0-0ubuntu11~12.04.2) ...
Setting up libisl10 (0.12.2-2~12.04) ...
Setting up libcloog-isl4 (0.18.2-1~12.04) ...
Setting up libgomp1 (5.1.0-0ubuntu11~12.04.2) ...
Setting up libitm1 (5.1.0-0ubuntu11~12.04.2) ...
Setting up libquadmath0 (5.1.0-0ubuntu11~12.04.2) ...
Setting up libtsan0 (5.1.0-0ubuntu11~12.04.2) ...
Setting up cpp-4.8 (4.8.1-2ubuntu1~12.04) ...
Setting up libgcc-4.8-dev (4.8.1-2ubuntu1~12.04) ...
Setting up gcc-4.8 (4.8.1-2ubuntu1~12.04) ...
Setting up libstdc++-4.8-dev (4.8.1-2ubuntu1~12.04) ...
Setting up g++-4.8 (4.8.1-2ubuntu1~12.04) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
root@4c4ab5d66584:/home# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
update-alternatives: using /usr/bin/gcc-4.8 to provide /usr/bin/gcc (gcc) in auto mode.

配置fcp环境

下载fcp源码

执行 update-fcp.sh

root@4c4ab5d66584:/home/infer# ./update-fcp.sh
+ set -e
+++ dirname ./update-fcp.sh
++ cd .
++ pwd
+ INFER_ROOT=/home/infer
+ PLUGIN_REPO=https://github.com/facebook/facebook-clang-plugins
+ PLUGIN_DIR=/home/infer/../facebook-clang-plugin
+ VERSION_FILE=/home/infer/dependencies/clang-plugin/clang-plugin-version.config
+ '[' '!' -e /home/infer/../facebook-clang-plugin ']'
+ echo '/home/infer/../facebook-clang-plugin not found, cloning...'
/home/infer/../facebook-clang-plugin not found, cloning...
+ git clone https://github.com/facebook/facebook-clang-plugins /home/infer/../facebook-clang-plugin
Cloning into '/home/infer/../facebook-clang-plugin'...
remote: Counting objects: 941, done.
remote: Total 941 (delta 0), reused 0 (delta 0), pack-reused 941
Receiving objects: 100% (941/941), 83.31 MiB | 43 KiB/s, done.
Resolving deltas: 100% (625/625), done.
+ echo 'Checking out the right version of the clang plugin...'
Checking out the right version of the clang plugin...
+ pushd /home/infer/../facebook-clang-plugin
/home/facebook-clang-plugin /home/infer
+ git checkout master
Already on 'master'
+ git pull
Already up-to-date.
++ cat /home/infer/dependencies/clang-plugin/clang-plugin-version.config
+ git checkout 24e2b11a8802be69444a702b683c1be380570bae
Note: checking out '24e2b11a8802be69444a702b683c1be380570bae'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 24e2b11... Update clang version to 3.6.1 with patch to add nullability support
+ popd
/home/infer

下载clang

执行../facebook-clang-plugin/clang/setup.sh

耗时比较长,可以去玩别的去了。

./compile-fcp.sh

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐