SonarScanner failed to analyze C files

I tried to analyze a C Project with SonarQube which ended with the error: “java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed.”

I was executing the build-wrapper before to generate the build_wrapper_output_directory and then started the SonarScanner with the command provided by the local webserver.

SonarQube Enterprise Edition Version 8.7.1 (build 42226)
SonarScanner 4.6 2021-01-13
build-wrapper downloaded from SonarQube local Server
Used compiler: cygwin gcc

How could I fix this problem?

Full error message:

INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:03.624s
INFO: Final Memory: 26M/90M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner 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 CFamily 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
  • you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps
    at com.sonar.cpp.plugin.CFamilySensor.execute(
    at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(
    at org.sonar.core.platform.ComponentContainer.startComponents(
    at org.sonar.core.platform.ComponentContainer.execute(
    at org.sonar.scanner.scan.ProjectScanContainer.scan(
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(
    at org.sonar.core.platform.ComponentContainer.startComponents(
    at org.sonar.core.platform.ComponentContainer.execute(
    at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(
    at org.sonar.core.platform.ComponentContainer.startComponents(
    at org.sonar.core.platform.ComponentContainer.execute(
    at org.sonar.batch.bootstrapper.Batch.doExecute(
    at org.sonar.batch.bootstrapper.Batch.execute(
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(
    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(
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
    at org.sonarsource.scanner.api.EmbeddedScanner.execute(
    at org.sonarsource.scanner.cli.Main.execute(
    at org.sonarsource.scanner.cli.Main.execute(
    at org.sonarsource.scanner.cli.Main.main(
    ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Hello @danielroehrborn and welcome to our community!

Do you execute build-wrapper as a prefix of your clean build command?
If so, can you tell me which compiler you are using? And would you be able to share the build-wrapper output directory and the sonar-scanner debug log? That would be really helpful to understand what happens here.

Hello Amelie,
I think I’m not allowed from my companies side to share files like this which might contain sensitive information.
Yes I was executing the build wrapper with a “make” call as argument exactly how it is written in the documentation page.
My compiler is gcc (GCC) 10.2.0
Could you tell me for what information you would look in the .log files or can I send them to you directly?

I sent you a PM

After investigation, it turns out the problem comes from the fact that the CFamily plugin does not support absolute paths in cygwin style for include directories and compilation units.
Here is the ticket to fix that problem: CPP-3044.
A workaround is to write the include directories and compilation unit paths either with a relative path or with a windows style path.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.