Configure coverage for ndk-build

I would like to use coverage for static analysis, and I need this for C ++. Since my project uses the Android NDK, I configured the compiler as:

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 

Then I ran cov-build –dir coverity ndk-build –j8 NDK_DEBUG=1

Everything builds, but I have a warning

 *[*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.** 

So I ignored the warning and ran

 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.** 

So is my compiler configured correctly? Has anyone set up a compiler for Android NDK before?

+6
source share
4 answers

You indicated that the compiler ~ / android-ndk-r8e / toolchains / arm-linux-androideabi-4.6 / prebuilt / linux-x86_64 / bin / arm-linux-androideabi-gcc-4.6

Make sure that this is the correct full path in the command (perhaps replace '~'?) And that arm-linux-androideabi-gcc-4.6 is exactly what is used for compilation.

I had the same problem because Coverity expected GCC to be used, but cc is used in my build!

Then I install:

 ~/coverity-current/bin/cov-configure --compiler /usr/bin/cc --comptype gcc 

The following is displayed:

 [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-XXX/config/coverity_config.xml Successfully generated configuration for the compilers: cc gcc gcc-4.8 

Cov-build command:

 ../../coverity-current/bin/cov-build --dir ~/build_cov/myapp/cov-log-all-output make -C ~/build_cov/myapp 

Result:

 ../../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. 

You have a large emit-db file in cov-log-all-output / c / emit / pcname /

+5
source

You must configure the correct compiler for the NDK:

 cov-configure --comptype gcc -compiler arm-linux-androideabi-gcc --template 
+4
source

In coverity / build-log.txt, you should see all the commands executed during the build (see "EXECUTING:"). Double check if the compiler commands match the compiler you specified for cov-configure. You can configure multiple compilers, and it may be useful to configure generic gcc ("cov-configure -gcc").

Keep in mind that if your ndk-build doesn't actually create anything, cov-build will give a similar message. In other words, the message does not always indicate a problem - it is possible that the assembly is complete and did not actually compile any files.

+1
source

So, I just ran into the same problem and solved it. In my case, make file was a problem, although the compiler configuration was correct, I received the following warning:

There were no files. This may be due to a problem with your configuration, or because no files were compiled by your build team. Make sure you configure the compilers actually used in the compilation.

The makefile contains some goals other than what I wanted to use. So if you are not sure about all the targets defined in the makefile, just delete them and compile everything you need and keep in mind ... discuss with the other remaining goals.

0
source

All Articles