为ndk生成配置coverity 我想用Copystatic进行静态分析,我需要C++。由于我的项目使用Android NDK,我将编译器配置为: cov-configure –comptype gcc –compiler ~/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc-4.6
然后我运行了为ndk生成配置coverity 我想用Copystatic进行静态分析,我需要C++。由于我的项目使用Android NDK,我将编译器配置为: cov-configure –comptype gcc –compiler ~/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc-4.6,gcc,android-ndk,coverity,Gcc,Android Ndk,Coverity,然后我运行了cov build–dir coverity ndk build–j8 ndk_DEBUG=1 一切都会建立起来,但我有一个警告 *[*WARNING] No files were emitted. This may be due to a problem with your configuration or because no files were actually compiled by your build command. Please make sure you have
cov build–dir coverity ndk build–j8 ndk_DEBUG=1
一切都会建立起来,但我有一个警告
*[*WARNING] No files were emitted. This may be due to a problem with your configuration
or because no files were actually compiled by your build command.
Please make sure you have configured the compilers actually used in the compilation.**
所以我无视警告,跑了
cov-analyze –dir coverity –all
**Coverity Static Analysis for C/C++ version 6.6.1 on Linux 2.6.38-8-server x86_64
Internal version numbers: d614fc01a4 p-eureka-push-15003.308
Looking for translation units
Error: no matching translation units.**
那么我的编译器配置正确吗?以前有人为Android NDK配置过编译器吗?在coverity/build-log.txt中,您应该可以看到构建过程中执行的所有命令(查看“EXECUTING:”)。仔细检查编译器命令是否与指定要配置cov的编译器匹配。您可以配置多个编译器,配置通用gcc(“cov configure--gcc”)可能很有用
请记住,如果您的ndk构建实际上没有构建任何东西,那么cov构建将给出类似的消息。换句话说,该消息并不总是表明存在问题——可能生成已完成,但实际上没有编译任何文件。您应该为NDK配置正确的编译器:
cov-configure --comptype gcc -compiler arm-linux-androideabi-gcc --template
您向coverity指出编译器是~/android-ndk-r8e/toolschains/arm-linux-androideabi-4.6/prebuild/linux-x86_64/bin/arm-linux-androideabi-gcc-4.6 确保这是命令中正确的完整路径(可能替换“~”?),并且arm-linux-androideabi-gcc-4.6正是用于编译的 我有同样的问题,因为Coverity希望使用GCC,但我的构建使用了cc 然后我设置:
~/coverity-current/bin/cov-configure --compiler /usr/bin/cc --comptype gcc
它显示:
[WARNING] A template configuration is recommended for this compiler.
Add "--template" to your command line, or use one of the
template configuration shortcut command lines below:
cov-configure --gcc # GNU C/C++ compiler (gcc/g++)
cov-configure --msvc # Microsoft C/C++ compiler (cl)
cov-configure --java # Sun Java compiler (javac)
You must remove the specific configuration before re-running with "--template".
* Configuring /usr/bin/cc as a C compiler
[WARNING] Config gcc-config-2 already exists for cc gcc gcc-4.8 as gcc and will be reused.
* Configuring /usr/bin/cc as a C++ compiler
[WARNING] Config g++-config-2 already exists for cc gcc gcc-4.8 as g++ and will be reused.
Generated coverity_config.xml at location /home/default/cov-analysis-linux64-X.X.X/config/coverity_config.xml
Successfully generated configuration for the compilers: cc gcc gcc-4.8
cov构建命令是:
../../coverity-current/bin/cov-build --dir ~/build_cov/myapp/cov-log-all-output make -C ~/build_cov/myapp
结果是:
../../coverity-current/bin/cov-build --dir ~/build_cov/myapp/cov-log-all-output make -C ~/build_cov/myapp
[...]
76 C/C++ compilation units (100%) are ready for analysis
The cov-build utility completed successfully.
在cov log all output/c/emit/pcname/中有一个更大的emit db文件,所以我也遇到了同样的问题并解决了它。 在我的例子中,make file是问题所在,尽管编译器配置正确,但我得到了以下警告: 没有发出任何文件。这可能是由于您的配置有问题 或者因为build命令实际上没有编译任何文件。 请确保已配置编译中实际使用的编译器
make文件包含一些我不想使用的目标。因此,如果您不确定makefile中定义的所有目标,只需删除它们并编译您需要的和知道的任何内容。否则,请与其他人讨论剩余目标。您好,感谢您的回复。编译后,它会在libs文件夹下生成.so文件。我看到编译器命令,它是正确的。编译器的路径也是正确的。请您澄清一下ndk build不编译任何文件意味着什么。再次感谢!编译器名称很重要。有关更多详细信息,请参阅Coverity文档!