Error while SonarScanner : com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0

Template for a good bug report, formatted with Markdown:

  • versions used (SonarQube - * Version 7.9.4 (build 35981), Scanner - (sonar-scanner-cli-4.5.0.2216-linux) , Build-wrapper - (build-wrapper-linux-x86))

  • error observed as in below logs for cpp project analysis while running Sonarscanner:

Caused by: com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: /path/to/file/file.cpp
at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:76)
at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:73)
at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:33)
at com.sonar.cpp.plugin.CFamilySensor.lambda$process$5(CFamilySensor.java:503)
at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:53)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

Hi @ankita.patil ,

what version of the CFamily analyzer do you have installed in your SonarQube server?

Hi Massimo,

Version for SonarCFamily plugin is 6.8.0.16475 .

Hi @ankita.patil ,

would you be able to try with a newer version of SonarQube to see if the problem has been fixed?

@mpaladin It would not be possible for me to upgrade the SonarQube version as it is hosted and managed by team at organizational level. We have multiple project already integrated.

Is there any issue which is already fixed in new SonarQube version related to error which I am facing? We have multiple cpp projects already being analyzed with same SonarQube, but this is first where we get this error. I even tried with work around on com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0 - Get help / SonarQube - SonarSource Community. But it is not working for me.

Hi @ankita.patil ,

many issues have been faced since SonarCFamily plugin 6.8.0.16475, there has been 10 releases since then. Could you please share the entire sonar-scanner log?

Hi Massimo,

I am sharing this logs in the attached file. I have removed project specific details (URL, PATH, etc) maintaining companies privacy policy.

Please let me know if this works for you.

Also when I add this few file (causing this error) to exclusion sonar-scanner execution is successful. But as we need to analyze all the source code we cannot remove this few files.

sonar-logs.txt (675.1 KB)

Hi @ankita.patil ,

you may want to run the analysis with the property sonar.cfamily.reproducer=<SOME-PATH>/message_processor.cpp

where <SOME-PATH>/message_processor.cpp should be the exact path you find in the non-redacted log. It is going to create a file sonar-cfamily.reproducer which you should share with us. I can send you a pm where you can share it privately if it is ok with you.