扫描服务和"This platform is not supported by Coverity"

Scan service and "This platform is not supported by Coverity"

我正在尝试在 OS X 下提交扫描。procedure I am following 在 32 位和 64 位 Linux 下运行良好,类似的程序在使用 nmake 的 Windows。在 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 states OS X is supported, and a press release states OS X 10.8 is supported.

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

问题是您使用的 Coverity 版本不支持 Mac OSX 10.8。不幸的是,Apple 在 OS 版本中打破与 Coverity 的兼容性是很常见的。

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

这基于 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 的解决方法。它添加了 "use a different compiler"。下面,我们使用 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