SonarQube execution Error for c++ code using build-wrapper

Hi …I am getting Exection failure with below error while doing sonar-scanner for c++ code using build-wrapper and sonarqube version * Enterprise Edition

  • Version 7.9.1 .can someone help me on this.
    12:28:58.280 DEBUG: Using build-wrapper-dump.json probe
    12:28:58.282 WARN: Invalid probe found, skip analysis of files:

The compiler probe ‘stdout’ is expected to contain at least one ‘#define’ directive:

12:28:58.284 INFO: Subprocess(es) done in 53ms
12:28:58.284 INFO: 0 compilation units analyzed
12:28:58.325 INFO: ------------------------------------------------------------------------
12:28:58.325 INFO: EXECUTION FAILURE
12:28:58.325 INFO: ------------------------------------------------------------------------
12:28:58.326 INFO: Total time: 1:43.446s
12:28:58.483 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 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

  • 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(CFamilySensor.java:357)
    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:400)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
    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:73)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
    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)12:28:58.483 INFO: Final Memory: 32M/117M
    12:28:58.483 INFO: ------------------------------------------------------------------------

    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)
    

Can someone help me on this.

Hi @mpaladin i am facing similar problem like
Invalid probe found ,skip analysis of files . I am using clang compiler and i am unable to do successfully the sonar scanner.
Execution failure.can you help me on this?

Hi @Prakash_Vadaga,

what compiler are you using? What version of the cfamily analyzer have you installed?

And please, do not tag people directly to ask for help :pray: .

sorry i have seen similar issue that you were discussing on the post.
Compiler: clang
build-wrapper-linux-x86.zip .
cfamily analyzer version where can i able to see the version.

Hi @Prakash_Vadaga,

You can see it in the SonarQube UI in the Marketplace.

version of cfamily analyzer : SonarCFamily 6.8.0.16475 (cpp)
compiler : clang++.
I am able to scan the results using below command
build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-outputs make clean clean all.
but i am seeing zero coverage report.
Can you please help me the steps required to generate coverage report and pass the coverage report to sonarqube dashboard.

Our project has our cpp code inside src/ under different folders. Can you suggest the coverage tools compatible with clang++ compiler and supported by sonarqube as well.

Hi @Prakash_Vadaga,

did you make progress on that? To generate coverage report for your project you can find many guides on internet.