klocwork-11问题汇总

安装问题

安装时报错: exec: 10: /home/ … /cahoots/exec/ix86-pc-linux/kwupdate: not found

The 32-bit compatibility libraries must be installed. Cahoots works on 64-bit platforms in 32-bit emulation mode, so in order for Cahoots to work on Linux 64-bit platforms, you must ensure that the 32-bit libraries are installed. The way you check and install 32-bit libraries depends on your Linux distribution. For example, for Ubuntu, run the following command to install 32-bit compatibility libraries:
即,需要安装一些32位的系统环境文件:

sudo apt-get install ia32-libs

如何从Maven源代码文件中生成Ant build file

klocwork目前不支持maven编译分析,需要将maven的编译脚本pom.xml转换成ant的build.xml。

  • 首先安装maven环境,ubuntu系统直接 sudo apt-get install maven
  • 安装jdk,如果图方便,可以直接用 sudo apt-get install openjdk-8-jdk 安装openjdk,然后设置环境变量:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 
  • 在拥有pom.xml文件的源代码根目录下执行: mvn ant:ant,结束后,根目录下生成了 build.xml 文件,可以直接实现 ant 编译了。
$mvn ant:ant
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'ant'.
[INFO] artifact org.apache.maven.plugins:maven-ant-plugin: checking for updates from central
...
[INFO] ------------------------------------------------------------------------
[INFO] Building abc
[INFO]    task-segment: [ant:ant]
[INFO] ------------------------------------------------------------------------
...
Downloading: http://repo1.maven.org/maven2/xalan/xalan/2.7.0/xalan-2.7.0.pom
491b downloaded
...
Downloading: http://repo1.maven.org/maven2/xalan/xalan/2.7.0/xalan-2.7.0.jar
2666K downloaded
[INFO] [ant:ant]
[INFO] Wrote Ant project for ABC to D:\Project_ABC
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28 seconds
[INFO] Finished at: Thu Feb 12 16:16:15 SGT 2009
[INFO] Final Memory: 9M/16M
[INFO] ------------------------------------------------------------------------

你可能感兴趣的:(Klocwork)