Ubuntu 14.04下安装静态源码分析工具Splint3.1.2

------------------------------------ 版权信息 ------------------------------------

此文链接: http://blog.csdn.net/doniexun/article/details/45219863

此文作者: Windness

版权说明: 此文为作者经过检索网上资源及根据个人开发经验整理所得,所有参考文献均已在文末标注,转载请务必保留本文链接及作者信息!

------------------------------------ 版权信息 ------------------------------------


1. 安装文件准备

1) 下载splint

    官方主页:  http://www.splint.org

    下载链接:  http://www.splint.org/downloads/splint-3.1.2.src.tgz

    原Lclint源码主页:  http://sourceforge.net/projects/lclint/

2) 如果系统中未安装flex/bison/autoconf/automake/m4等工具,还需要下载以上工具.

    #  下载autoconf

     FTP站点:  ftp://ftp.gnu.org/gnu/

     下载链接:  ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz (automake1.15要求autuconf2.65+)

    #  下载automake

    HTTP站点:  http://ftp.gnu.org/gnu/

    下载链接:    http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz 

    # 下载bison

    FTP站点:    ftp://ftp.gnu.org/gnu/

    下载链接:    ftp://ftp.gnu.org/gnu/bison/bison-3.0.2.tar.gz

    #  下载flex

    源码主页:    http://sourceforge.net/projects/flex/

    下载链接:    http://cznic.dl.sourceforge.net/project/flex/flex-2.5.39.tar.bz2

    #  下载m4

    HTTP站点:   http://ftp.gnu.org/gnu/

    下载链接:      http://ftp.gnu.org/gnu/m4/m4-1.4.17.tar.gz


2. 安装过程

    1) m4

    2) autoconf

    3) automake

    4) flex

    5) bison

    6) splint

    其中,

    1)~3)均可以直接在Terminal下依次使用命令: # ./configure     |     # make    |    # sudo make install  完成安装,安装路径默认为: /usr/local/bin/***;

    4)~5)除了按1)~3)的安装步骤安装外,还可以直接利用Ubuntu的源进行安装: sudo apt-get install flex bison

    6)安装步骤如下:

    A) 解压缩到任意位置,如: /home/{User}/Applications/目录下,解压后Splint的源码路径为: /home/{User}/Applications/splint-3.1.2

    命令: # tar -zxvf splint-3.1.2.src.tgz

    B) 创建安装目录

    命令: # sudo mkdir /usr/local/splint

    C) 进入解压后的splint目录

    命令: # cd splint-3.1.2

    D) 完成配置

    命令: # ./configure --prefix=/usr/local/splint

    注意:If possible do not built splint in a directory under /usr/. If the test suite is run in a directory under /usr/ for example /usr/src/, it will report errors even if Splint was built correctly.

    E) 完成编译

    命令: # make

    注意: 若编译过程中发现找不到yywarp的错误,则进入splint解压后根目录下的src目录,打开文件cscanner.c,在其后添加以下代码:
    int yywrap()
    {
          return 1;
    }

    重新make即可.

    F) 完成安装

    命令: # make install

    G) 配置环境

    命令: # sudo vi ~/.bashrc

    在.bashrc文件中输入以下内容:

    export LARCH_PATH= /usr/local/splint/share/splint/lib
    export LCLIMPORTDIR=/usr/local/splint/share/splint/import

    注意:

    LARCH_PATH - path to search for splint libraries and initializations files. If you are using the standard directories, this should be .:base-directory/splint-3.1.2/lib.
    LCLIMPORTDIR - directory containing lcl imports files. If you are using the standard directories, this is base-directory/splint-3.1.2/imports.

    H) 使配置生效

    命令: # source ~/.bashrc

    I) 配置环境变量(亦可按照步骤G和H一样,将下面着底色字符串写入~/.bashrc文件中,并再次source使能)

    命令: # export PATH=/usr/local/splint/bin:$PATH

  

     如此,splint即安装成功!


3. 参考资料

    1) Splint官方网站:  http://www.splint.org/source.html

    2) splint 编译安装   http://blog.csdn.net/sunjiajiang/article/details/7368684

猜你喜欢

转载自blog.csdn.net/doniexun/article/details/45219863
今日推荐