SonarScanner failed with special gcc version

Hello,

iam trying to run SonarQube with a gcc compiler from microchip (embedded gcc C Compiler).
But i get an error running sonar-scanner on my local machine.

C:\microchip\harmony\v2_06\apps\zks4\sonar_qube\tec_300_taifun_k\src>cmd /k sonar-scanner
INFO: Scanner configuration file: C:\SonarQube\sonar-scanner-4.2.0.1873-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: C:\microchip\harmony\v2_06\apps\zks4\sonar_qube\tec_300_taifun_k\src\sonar-project.properties
INFO: SonarQube Scanner 4.2.0.1873
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Windows 7 6.1 amd64
INFO: User cache: C:\Users\harms01\.sonar\cache
INFO: SonarQube server 7.9.1
INFO: Default locale: "de_DE", source code encoding: "ISO-8859-1"
INFO: Load global settings
INFO: Load global settings (done) | time=101ms
INFO: Server id: BF41A1F2-AW0pZMkyphQFPar3lVtl
INFO: User cache: C:\Users\harms01\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=83ms
INFO: Load/download plugins (done) | time=307ms
WARN: Plugin SonarQube CNES Report [cnesreport] uses a child first classloader which is deprecated
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=7ms
INFO: Project key: tec_300_taifun_k
INFO: Base dir: C:\microchip\harmony\v2_06\apps\zks4\sonar_qube\tec_300_taifun_k\src
INFO: Working dir: C:\microchip\harmony\v2_06\apps\zks4\sonar_qube\tec_300_taifun_k\src\.scannerwork
INFO: Load project settings for component key: 'tec_300_taifun_k'
INFO: Load project settings for component key: 'tec_300_taifun_k' (done) | time=38ms
INFO: Load project branches
INFO: Load project branches (done) | time=33ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=18ms
INFO: Load branch configuration
INFO: Load branch configuration (done) | time=3ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=291ms
INFO: Load active rules
INFO: Load active rules (done) | time=6821ms
INFO: Exclusions based on SCM info is disabled by configuration
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: tec_300_taifun_k.X/**
INFO:   Excluded sources for coverage: **
INFO: 45 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: Quality profile for c: Sonar way
INFO: ------------- Run sensors on module tec_300_taifun_k
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=34ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/C:/Users/harms01/.sonar/cache/a89f1943fc75b65becd9fb4ecab8d913/sonar-tsq
l-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=2ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=8ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=9ms
INFO: Sensor CFamily [cpp]
INFO: Using build-wrapper output: C:\microchip\harmony\v2_06\apps\zks4\sonar_qube\tec_300_taifun_k\src\tec_300_taifun_k.X\bw_output\build-wrapper-dump
.json
INFO: Available processors: 4
INFO: Using 1 thread for analysis according to value of "sonar.cfamily.threads" property.
INFO: Load project repositories
INFO: Load project repositories (done) | time=36ms
INFO: 0 compilation units analyzed
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 16.826s
INFO: Final Memory: 21M/77M
INFO: ------------------------------------------------------------------------
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:247)
        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)
        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:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

I already tried to run the scan with the reproducer option but i also get an error.
I added the following line to my properties file.

sonar.cfamily.reproducer=C:/microchip/harmony/v2_06/apps/zks4/sonar_qube/tec_300_taifun_k/src/main.c

C:\microchip\harmony\v2_06\apps\zks4\sonar_qube\tec_300_taifun_k\src>cmd /k sonar-scanner
INFO: Scanner configuration file: C:\SonarQube\sonar-scanner-4.2.0.1873-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: C:\microchip\harmony\v2_06\apps\zks4\sonar_qube\tec_300_taifun_k\src\sonar-project.properties
INFO: SonarQube Scanner 4.2.0.1873
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Windows 7 6.1 amd64
INFO: User cache: C:\Users\harms01\.sonar\cache
INFO: SonarQube server 7.9.1
INFO: Default locale: "de_DE", source code encoding: "ISO-8859-1"
INFO: Load global settings
INFO: Load global settings (done) | time=93ms
INFO: Server id: BF41A1F2-AW0pZMkyphQFPar3lVtl
INFO: User cache: C:\Users\harms01\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=80ms
INFO: Load/download plugins (done) | time=281ms
WARN: Plugin SonarQube CNES Report [cnesreport] uses a child first classloader which is deprecated
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=7ms
INFO: Project key: tec_300_taifun_k
INFO: Base dir: C:\microchip\harmony\v2_06\apps\zks4\sonar_qube\tec_300_taifun_k\src
INFO: Working dir: C:\microchip\harmony\v2_06\apps\zks4\sonar_qube\tec_300_taifun_k\src\.scannerwork
INFO: Load project settings for component key: 'tec_300_taifun_k'
INFO: Load project settings for component key: 'tec_300_taifun_k' (done) | time=37ms
INFO: Load project branches
INFO: Load project branches (done) | time=27ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=19ms
INFO: Load branch configuration
INFO: Load branch configuration (done) | time=3ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=248ms
INFO: Load active rules
INFO: Load active rules (done) | time=6319ms
INFO: Exclusions based on SCM info is disabled by configuration
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: tec_300_taifun_k.X/**
INFO:   Excluded sources for coverage: **
INFO: 45 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: Quality profile for c: Sonar way
INFO: ------------- Run sensors on module tec_300_taifun_k
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=26ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/C:/Users/harms01/.sonar/cache/a89f1943fc75b65becd9fb4ecab8d913/sonar-tsq
l-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=3ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=8ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=7ms
INFO: Sensor CFamily [cpp]
INFO: Using build-wrapper output: C:\microchip\harmony\v2_06\apps\zks4\sonar_qube\tec_300_taifun_k\src\tec_300_taifun_k.X\bw_output\build-wrapper-dump
.json
INFO: Available processors: 4
INFO: Load project repositories
INFO: Load project repositories (done) | time=51ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 17.618s
INFO: Final Memory: 21M/80M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: sonar.cfamily.reproducer
        at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:212)
        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)
        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:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Is the Compiler not supported or is there a problem with the sonar-scanner version?

Greats Ralf

SonarQube Server - 7.9.1.27448
SonarCFamily - 6.4 (build 11646)
SonarScanner - 4.2.0.1873-windows

Hi @Ralf09,

why running with reproducer option given the first error message you posted?

Would you be able to share the build-wrapper-dump.json file?

my build-wrapper-dump file

build-wrapper-dump.txt (81.6 KB)

Hi @Ralf09 ,

could you please rerun sonar-scanner with sonar.verbose property and share the log?

Hello Massimo,

i added “sonar.verbose = true” to my sonar-project.properties file.
Then i started sonar-scaner again.

My CMD Output:
new 1.txt (39.2 KB)

Ralf

Hi @Ralf09,

it is because of -xassembler-with-cpp option used during build, we currently skip files with that option.

Hi Massimo,

thank you for the hint. I build a clean an simple new project. After that the scan worked well.

Ralf

Hi @Ralf09,

do you really require assembler-with-cpp for your projects?