Unable to perform a c/c++ scan

Must-share information (formatted with Markdown):
I am using SonarQube developper edition in evaluation mode
I am trying to launch an analyse on C/C++ source code directly, we are not using msbuild
I launch the sonar-scanner and after several minutes i am facing the error below. I would like to evaluate this product before buying a licence. Can you help ? Is this necessary to use the sonarqube build-wrapper ? How can i use it (where do i need to put the exe file and where do i need to put a config file) ?

ERROR: Error during SonarQube Scanner execution

The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper
and setting the property “sonar.cfamily.build-wrapper-output”, but it was not specified.

If you don’t want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:


    at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:121)
    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)

ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Hi @aro,

just follow the documentation page about analyzing C/C++ languages.

Hi, i am trying to follow the step there:
But there are still many questions than can help:

  • For test, i have copy the source code on a vm who isn’t dedicated to build, is this even ok for the build wrapper ? (for this test, i will not integrate the build wrapper command in a build command line)
  • what do you mean when talking about build_wrapper_output_directory ? do i need to launch those command (without launching a build) before starting the scanner or do i need to integrate this command in the start scanner command ?
  • what do you mean when talking about the project root ? Is this the root directory where i store the source files ?:
    " In the sonar-project.properties file at the root of your project add the property sonar.cfamily.build-wrapper-output with the path to the Build Wrapper output directory relative to the project directory"

Thank you in advance ! :slight_smile:

Hi @aro,

No, it is required that you run the build and analysis on the same machine.

The documentation tells you to run 2 steps:

  • build-wrapper --out-dir build_wrapper_output_directory clean_build_command
  • sonar-scanner … -Dsonar.cfamily.build-wrapper-output=build_wrapper_output_directory …

If you see build_wrapper_output_directory is passed to the sonar-scanner.

The root of your project which may be the root of your sources, I don’t know the layout of your project.