java.lang.NullPointerException when running sonar-scanner

Sonar Qube version : * Enterprise Edition * Version 7.6 (build 21501)
SonarCFamily, Code Analyzer for C, C++, Objective-C: 6.1 (build 11021)

We are running Sonar Qube on a linux machine.
With a sonar property defined locally on windows machine. First we are running the below command.

build-wrapper-win-x86-64 --out-dir bw-outputs app-build.bat

the application build is happening using Scons.
This is creating files in the build-wrapper-dump.json and build-wrapper.log in
bw-outputs folder.

Post this when we run sonar-scanner -X command we are getting null pointer exception as below.

11:23:16.505 ERROR: Error during SonarQube Scanner execution
java.lang.NullPointerException
        at com.sonar.cpp.analyzer.StdFlags.fromCppMacros(StdFlags.java:23)
        at com.sonar.cpp.analyzer.ClangDriver.onCapture(ClangDriver.java:332)
        at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:266)
        at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:198)
        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:408)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:403)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:360)
        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:126)
        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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        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:185)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)

Can you please help in resolving this issue.

Hi @Pradeep_K_V,

could you please share build-wrapper-dump.json and build-wrapper.log files? Thank you.

Sure, Please find attached build-wrapper.log.txt (25.7 KB)
build-wrapper-dump.json.txt (14.5 KB)

Hi @Pradeep_K_V,

we fail because of vrxcc.exe which we detect as compiler but which we don’t support (even if I see that vrxcc.exe is calling armcc).

Hi @mpaladin,

Before trying it on the actual project, we first tried with a sample project which also uses vrxcc.exe compiler and for that project we are able to see the results on the server for the sample project.

Attaching the sample project build-wrapper-dump.json, build-wrapper.log and the results screen shot for your reference. build-wrapper.log.txt (30.4 KB)
build-wrapper-dump.json.txt (17.6 KB)

Once we found the sample project working, then only we tried it on the actual project.

Can you please help on this.

Thanks in advance.

Hi @Pradeep_K_V,

did you upgrade the version of SonarQube or the C/C++ analyzer in the mean time?

Hi @mpaladin No, We did not upgrade. We are trying both the applications on same versions of SonarQube and C++ analyzer.

Hi @mpaladin, hope you are doing good. By any chance did you get any idea how to resolve this?

Hi @Pradeep_K_V,

unfortunately we don’t support vrxcc.exe, even if under the cover it is calling armcc, I am not sure what we can do about it. Could you please share what vrxcc.exe you are using? What tool, version?