Error during SonarQube Scanner exectuion

SonarQube 7.7

Error Observed:

error 10-Oct-2019 20:46:49 ERROR: Error during SonarQube Scanner execution
error 10-Oct-2019 20:46:49 ERROR: Illegal char <:> at index 2: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include
error 10-Oct-2019 20:46:49 ERROR:
error 10-Oct-2019 20:46:50 The SonarQube Scanner did not complete successfully

I’m building a combined C# and C++ msbuild project does anyone know what might be going on here?

Hi @Ed_Die,

could you please share the entire log please?

Please see the attched txt fileSonarqube.log.txt (18.6 KB)

@mpaladin didn’t mention you but i’ve uploaded the log

Hi @Ed_Die,

Could you please re-run sonar-scanner with option -X and share again the logs?

Hi @mpaladin

error 14-Oct-2019 10:23:19 java.nio.file.InvalidPathException: Illegal char <:> at index 2: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include
error 14-Oct-2019 10:23:19 at sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
error 14-Oct-2019 10:23:19 at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
error 14-Oct-2019 10:23:19 at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
error 14-Oct-2019 10:23:19 at sun.nio.fs.WindowsPath.parse(Unknown Source)
error 14-Oct-2019 10:23:19 at sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
error 14-Oct-2019 10:23:19 at java.nio.file.Paths.get(Unknown Source)
error 14-Oct-2019 10:23:19 at com.sonar.cpp.analyzer.MsvcDriver.absolute(MsvcDriver.java:293)
error 14-Oct-2019 10:23:19 at com.sonar.cpp.analyzer.MsvcDriver.lambda$onCapture$1(MsvcDriver.java:196)
error 14-Oct-2019 10:23:19 at java.util.Arrays$ArrayList.forEach(Unknown Source)
error 14-Oct-2019 10:23:19 at com.sonar.cpp.analyzer.MsvcDriver.onCapture(MsvcDriver.java:196)
error 14-Oct-2019 10:23:19 at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:262)
error 14-Oct-2019 10:23:19 at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:198)
error 14-Oct-2019 10:23:19 at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
error 14-Oct-2019 10:23:19 at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
error 14-Oct-2019 10:23:19 at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
error 14-Oct-2019 10:23:19 at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
error 14-Oct-2019 10:23:19 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
error 14-Oct-2019 10:23:19 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
error 14-Oct-2019 10:23:19 at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:359)
error 14-Oct-2019 10:23:19 at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:354)
error 14-Oct-2019 10:23:19 at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:317)
error 14-Oct-2019 10:23:19 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
error 14-Oct-2019 10:23:19 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
error 14-Oct-2019 10:23:19 at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
error 14-Oct-2019 10:23:19 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
error 14-Oct-2019 10:23:19 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
error 14-Oct-2019 10:23:19 at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
error 14-Oct-2019 10:23:19 at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
error 14-Oct-2019 10:23:19 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
error 14-Oct-2019 10:23:19 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
error 14-Oct-2019 10:23:19 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
error 14-Oct-2019 10:23:19 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
error 14-Oct-2019 10:23:19 at java.lang.reflect.Method.invoke(Unknown Source)
error 14-Oct-2019 10:23:19 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
error 14-Oct-2019 10:23:19 at com.sun.proxy.$Proxy0.execute(Unknown Source)
error 14-Oct-2019 10:23:19 at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
error 14-Oct-2019 10:23:19 at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
error 14-Oct-2019 10:23:19 at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
error 14-Oct-2019 10:23:19 at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
error 14-Oct-2019 10:23:19 at org.sonarsource.scanner.cli.Main.main(Main.java:61)
build 14-Oct-2019 10:23:19 Process returned exit code 1

Hi @Ed_Die,

would you be able to share the build-wrapper-dump.json file? If you prefer to do it privately let me know and I will send you a PM where you can share privately.

I was looking through the build-wrapper-dump.json, I can share it via a PM, that would be great

Hi @Ed_Die,

I sent you a PM.

Hi @Ed_Die,

thank you for sharing the file. The issue comes from the fact that you have 4 occurrences of bad INCLUDE environment variable. If you search for ; (semicolon followed by whitespace) in the build-wrapper-dump.json file you will find 4 occurrences of this kind:

INCLUDE=folder1;folder2; folder3

I would recommend you to fix your INCLUDE path, running a test on our side it seems that folder3 is completely ignored by cl.exe, so useless. We should however probably not crash on our side, ticket created for that: CPP-2300.

I have actualy no idea where the "; " space is coming from…
thanks for finding it… What I could do is set the INCLUDE file correct after running
call “C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat” x64

So when I Echo the INCLUDE i see this…

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt

could this be a sonarqube issue that is it parsing it wrong and dumping it in the JSON file?

Hi @Ed_Die,

the one I am talking about is:

“INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include;;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\atlmfc\include;;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\VS\include;;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt;;;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\cppwinrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um; C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include;;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\atlmfc\include;;C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\VS\include;;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt;;;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\cppwinrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um;”,

It seems like you are customising the INCLUDE for some files, I can tell you for which files if you wish.

@mpaladin Yes I know, but the thing is I’m not adding anything to the INCLUDE variable.

Here is what I do:
call “C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat” x64
SonarScanner begin
msbuild with the Wrapper
SonarScanner end

I’m not injecting any addition Variables into the INCLUDE environment.
can you ask the sonarqube team to fix : CPP-2300 as soon as possible

Hi @Ed_Die,

the broken INCLUDE doesn’t come from vcvarsall.bat, it probably comes from some settings in the project for some files, directly set in Visual Studio.

I am one of the developers working on the analyzer, I created the ticket and as you can see it is scheduled for next version, for which I cannot give you a precise ETA, just be patient.

I would recommend you to review configuration for the project/files which have a bad INCLUDE environment variable.

Hi @mpaladin great to see that CPP-2300 was resolved :slight_smile: would to be possible for me to test .exe file already for windows?

Hi @Ed_Die,

I sent you a PM.

Running much better now: after running the full build got this error message:
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found empty. Please make sure that:

  • you are using the latest version of the build-wrapper and the SonarCFamily analyzer
  • your compiler is supported
  • you are wrapping your build correctly
  • you are wrapping a full/clean build
    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)
    INFO: Final Memory: 131M/3150M
    INFO: ------------------------------------------------------------------------
    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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at 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:
    The SonarQube Scanner did not complete successfully
    15:44:38.939 Post-processing failed. Exit code: 1

I am running 7.9.1 now with your cfamily .jar file but still the old build-wrapper .exe not sure if that is the problem

19:54:16.986 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: java.lang.IllegalStateException: exit code != 0
at com.sonar.cpp.analyzer.AnalysisExecutor.submit(AnalysisExecutor.java:47)
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:367)
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:336)
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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at 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)
Caused by: java.lang.IllegalStateException: exit code != 0
at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:55)
at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:26)
at com.sonar.cpp.plugin.CFamilySensor.lambda$process$4(CFamilySensor.java:380)
at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:53)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Process returned exit code 1
The SonarQube Scanner did not complete successfully
19:54:17.205 Post-processing failed. Exit code: 1

good news, the original code base, the c++ code is now analyzed :slight_smile: