C Sonarqube analysis

Here is my configuration:

  1. SonarScanner 4.6.2.2472
    Java 11.0.11 AdoptOpenJDK (64-bit)
    Linux 5.4.0-104-generic amd64
  2. build-wrapper, version 6.26 (linux-x86)

I am trying to run code analysis on a code base written in C language.

The analysis goes to success if I remove the lines with the include directives (-Ipath-to-header-file)
from the build-wrapper-dump.json file. Otherwise it fails with the error message as follows:

09:12:16.414 ERROR: Exception in thread pool-1-thread-1
com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: /home/user/git/prod/fsw/bsw/BswMain.c
at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:154)
at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:54)
at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:150)
at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:54)
at com.sonar.cpp.plugin.CFamilySensor.lambda$process$14(CFamilySensor.java:791)
at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
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)

Could you help me with the issue?

Hey there.

v6.26 of the build wrapper would indicate that you’re using SonarQube v9.1, which is for all purposes an EOL SonarQube version (it’s not an LTS, nor the very latest version)

The first step would be to update to v9.4 (the latest version of SonarQube) and ensure you use the version of the build-wrapper that comes with this version to wrap your build.

If the problem persists, feel free to come back to us!

Hello,

Thank you for the reply. I have upgraded Sonar scanner as well as build wrapper.

The current configuration is as follows:
SonarQube * Version 9.4 (build 54424)
SonarScanner 4.7.0.2747
build-wrapper, version 6.32 (linux-x86)

Unfortunately the behavior remains the same. The upload of analysis report to the server fails when the build wrapper json contains references to include headers. If that part is removed from the json, then the upload works.