6

I would like to use coverity for static analysis, and I needed it for c++. Since my project uses 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 properly? Has anyone configured a compiler for Android NDK before?

0

4 Answers 4

6

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

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

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

Then I set:

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

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

The cov-build command is:

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

The 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 bigger emit-db file in cov-log-all-output/c/emit/pcname/

4

You should configure the correct compiler for NDK:

cov-configure --comptype gcc -compiler arm-linux-androideabi-gcc --template
1
  • Exactly ! The compiler name is important . Refer to Coverity Document for more detail !
    – BULLA
    Commented Jul 12, 2016 at 8:52
1

In coverity/build-log.txt, you should see all of the commands executed during the build (look for "EXECUTING:"). Double-check that the compiler commands match the compiler that you specified to cov-configure. You can configure more than one compiler, and it might be useful to configure a generic gcc ("cov-configure --gcc").

Keep in mind that if your ndk-build doesn't actually build anything then cov-build will give a similar message. In other words, the message doesn't always indicate a problem--it's possible that the build completed and didn't actually compile any files.

1
  • Hi, thanks for your reply. After compilation it does generate .so files under the libs folder. I see the compiler command it's correct. The path to the compiler is also correct. Can you please clarify what does it mean when ndk-build doesn't compile any files. Thanks again Commented Jan 28, 2014 at 22:55
0

So I just faced the same issue and resolved it. In my case make file was the issue, even though the compiler configuration was proper, i was getting the below 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.

make file contains some targets other than what i meant to use..So if you are not sure of all the targets defined in makefile just delete them and compile whatever you need and are aware of..else discuss with the others about remaining targets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.