扫描服务和“Coverity不支持此平台”

时间:2016-09-29 03:09:49

标签: xcode macos static-analysis coverity

我正在尝试在OS X下提交扫描。procedure I am following在32位和64位Linux下运行良好,类似的程序在具有nmake的Winows下运行良好。在OS X上cov-build失败了:

$ CXXFLAGS="-DNDEBUG -g2 -O3" cov-build --dir cov-int make -j 2

Coverity Build Capture (64-bit) version 8.5.0.3 on Darwin 12.6.0 x86_64
Internal version numbers: db70178643 p-kent-push-26368.949

Platform info:
Sysname = Darwin
Release = 12.6.0
Machine = x86_64

[ERROR] This platform is not supported by Coverity.
[ERROR] See documentation for the list of supported platforms.

另一台OS X机器产生相同的错误:

$ CXXFLAGS="-DNDEBUG -g2 -O3" cov-build --dir cov-int make -j 2

Coverity Build Capture (64-bit) version 8.5.0.3 on Darwin 13.4.0 x86_64
Internal version numbers: db70178643 p-kent-push-26368.949

Platform info:
Sysname = Darwin
Release = 13.4.0
Machine = x86_64

[ERROR] This platform is not supported by Coverity.
[ERROR] See documentation for the list of supported platforms.

我无法找到文档:

$ cov-build --help
Coverity Build Capture (64-bit) version 8.5.0.3 on Darwin 12.6.0 x86_64
Internal version numbers: db70178643 p-kent-push-26368.949

No help found for 'cov-build'

Coverity Data Sheet表示支持OS X,press release states OS X 10.8 is supported

  • AIX
  • FreeBSD的
  • HP-UX
  • 的Linux
  • Mac OS X
  • NetBSD的
  • 的Solaris

为什么我会收到 [ERROR] This platform is not supported by Coverity ,我该如何解决?

2 个答案:

答案 0 :(得分:2)

问题是您正在使用的Coverity版本不支持Mac OSX 10.8。不幸的是,苹果公司破坏与Coverity与OS版本的兼容性有点普遍。

您可以导出COVERITY_UNSUPPORTED = 1。这将绕过平台支持检查,但是不能保证事情按预期工作。你确实有很好的成功几率。

答案 1 :(得分:0)

这建立在Flash Sheridan和Caleb的建议之上。平台问题较少,编译器问题较多。 Xcode 5.0和5.1产生了扫描构建失败:

CXXFLAGS="-DNDEBUG -g2 -O3" cov-build --dir cov-int make -j 2
...

cat cov-int/build-log.txt
...

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../
lib/clang/5.0/include/stddef.h", line 29: error #109:

expression preceding parentheses of apparent call must have

(pointer-to-) function type

#if !defined(_PTRDIFF_T) || __has_feature(modules)


"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../
lib/clang/5.0/include/stddef.h", line 31: error #59:

function call is not allowed in a constant expression

#if !__has_feature(modules)
...

第二种解决方法取决于Flash Sheridan和Caleb的解决方法。它增加了“使用不同的编译器”。下面,我们使用MacPorts Clang 3.7执行扫描构建。

$ CXX=/opt/local/bin/clang++-mp-3.7 COVERITY_UNSUPPORTED=1 CXXFLAGS="-DNDEBUG -g3 -O2" cov-build --dir cov-int make -j 8
Coverity Build Capture (64-bit) version 8.5.0.3 on Darwin 12.6.0 x86_64
Internal version numbers: db70178643 p-kent-push-26368.949

/opt/local/bin/clang++-mp-3.7 -DNDEBUG -g3 -O2 -fPIC -march=native -pipe -c cryptlib.cpp
/opt/local/bin/clang++-mp-3.7 -DNDEBUG -g3 -O2 -fPIC -march=native -pipe -c cpu.cpp
...

Emitted 134 C/C++ compilation units (100%) successfully

134 C/C++ compilation units (100%) are ready for analysis
The cov-build utility completed successfully.

对于任何有兴趣的人,我们都是免费的开源软件项目,我们免费使用Coverity Scan Service。但是,文档很轻松。

如果您需要执行针对Unix,Linux,OS X和Windows的扫描构建的说明性说明,请参阅Crypto++ wiki | Coverity Scan