Sonar-scanner command error with C code

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

  • Developer Edition

  • Version 8.1 (build 31237)

  • what are you trying to achieve
    run sonar-scanner with C code.

  • what have you tried so far to achieve this

15:44:42.053 WARN:
SonarCFamily plugin supports incremental analysis with the use of a cache:

  • if you do not want to enable cache explicitly disable it by setting the following property to your analysis: sonar.cfamily.cache.enabled=false
  • to enable cache please specify the following 2 options and visit the documentation page for more information (http://localhost:9000/documentation/analysis/languages/cfamily/):
    • sonar.cfamily.cache.enabled=true
    • sonar.cfamily.cache.path=relative_or_absolute_path_to_cache_location

15:44:42.079 DEBUG: Using build-wrapper-dump.json probe
15:44:42.079 WARN: Invalid probe found, skip analysis of files: [C:/work/trunk/dev-wcd20/./src/app/version.c]
The compiler probe ‘stdout’ is expected to contain at least one ‘#define’ directive:

15:44:42.081 INFO: Subprocess(es) done in 27ms
15:44:42.082 INFO: 0 compilation units analyzed
15:44:42.173 INFO: ------------------------------------------------------------------------
15:44:42.174 INFO: EXECUTION FAILURE
15:44:42.174 INFO: ------------------------------------------------------------------------
15:44:42.175 INFO: Total time: 7.459s
15:44:42.218 INFO: Final Memory: 21M/100M
15:44:42.218 INFO: ------------------------------------------------------------------------
15:44:42.219 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:

  • you are using the latest version of the build-wrapper and the SonarCFamily analyzer
  • you are correctly invoking the scanner with correct configuration * your compiler is supported
  • you are wrapping your build correctly
  • you are wrapping a full/clean build
  • you are providing the path to the correct build-wrapper output directory
    at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:356)
    at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:386)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:382)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:351)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
    at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)

Here is the build-wrapper

build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory make clean all

I use Make to do the project compilation and linking.

New to this, not sure what went wrong and where to look.

C commpiler is WindRiver Diab v5.9.1.0, below is a part of build-wrapper.log

Tue Jan 28 15:03:14 2020: Probing C compiler: C:\WindRiver\Diab\5.9.1.0\WIN32\bin\dcc.exe
Tue Jan 28 15:03:14 2020: exit code: 0 (0x0)
Tue Jan 28 15:03:14 2020: stdout:

Tue Jan 28 15:03:14 2020: stderr:
warning: GNU option -x is not supported in DIAB

Tue Jan 28 15:03:14 2020: Probing C++ compiler: C:\WindRiver\Diab\5.9.1.0\WIN32\bin\dcc.exe
Tue Jan 28 15:03:14 2020: exit code: 0 (0x0)
Tue Jan 28 15:03:14 2020: stdout:

Tue Jan 28 15:03:14 2020: stderr:
warning: GNU option -x is not supported in DIAB

SonarCFamily:

SonarCFamily LANGUAGES

Code Analyzer for C, C++, Objective-C * 6.6.0 (build 13759) installed

Any help would be appreciated!

Hi,

I’m closing this thread because it appears to be a duplicate of

 
Ann

1 Like