SonarQube 7.6 java.lang.IllegalArgumentException

Hello !

We’ve recently upgraded our SonarQube server from the version 7.2.1 to the version 7.6 (build 21501) but we encounter now an error during the analyse :

java.lang.IllegalArgumentException
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:72)
        at com.sonar.cpp.llvm.BitstreamReader.jumpToBit(BitstreamReader.java:93)
        at com.sonar.cpp.llvm.BitstreamReader.readRecord(BitstreamReader.java:287)
        at com.sonar.cpp.llvm.ClangPCH.getOriginalSourceFile(ClangPCH.java:89)
        at com.sonar.cpp.llvm.ClangPCH.getOriginalSourceFile(ClangPCH.java:44)
        at com.sonar.cpp.analyzer.ClangDriver.onCapture(ClangDriver.java:142)
        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(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: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) 

Our project is a C++ project which use clang for NX for compiling.

Here are the different version used :

  • SonarCFamily 6.2 (build 11201)
  • build-wrapper-win-x86-64.exe 6.1
  • sonar-scanner 3.3.0.1492
  • clang for NX 1.5.8 (based on LLVM 6.0.1)

I’ve also tried with the version 6.2 of the build-wrapper and clang for NX 1.7.5 (based on LLVM 7.0.1) but the crash still remains.

Let me know if you need me to provide other informations.

Thanks,
Vincent

Hello @vbordenave,

it seems like there is a failure trying to read a precompiled header. Would you be able to disable precompiled headers in your build to see if you get a successful analysis? Once that works we could then check the failure with precompiled headers.

Hello @mpaladin,

It works perfectly when the precompiled headers are disabled !

I’ve recreated a minimal project in order to reproduce it and the result is the same, when the precompiled header are enabled it crashes, otherwise it works without any issue.

Hi @vbordenave,

what compiler is Clang for NX? To help me to reproduce the issue.

It’s a clang provided by Nintendo (also called Rynda clang) in order to compile project for the Nintendo Switch console.
I guess you have to register on the Nintendo Developer Portal if you need to get it :thinking:

Hi @vbordenave,

ok, I am going to try to reproduce with clang version 6 as a start, would you be able to share with me the build-wrapper-dump.json file? I am sending you a PM where you can share it privately.

Hi @vbordenave,

FYI the issue comes from a failure in our Clang precompiled headers parser, I created a ticket to fix it, it is going to be released beginning of June: https://jira.sonarsource.com/browse/CPP-2223.
Thank you very much for your collaboration and help.

1 Like

Hi. Was the fix released. If so, how can I get it?

Hi ! Yes the fix has been released in the version 6.3 of the SonarCFamily plugin.
I guess that you just need to upgrade to this version at least.

Thanks.
Do you have any idea about my other post?

https://community.sonarsource.com/t/not-able-to-import-llvm-cov-report/26698

Thank you,
Eric