AnalyzerException when running SonarScanner

Hi there,

I’m currently trying to configure SonarScanner to run on our code base, which is embedded C code, being compiled by a TI ARM compiler on windows. We are using SonarQube Enterprise Edition Version 9.9 (build 65466), running on company server, which uses CFamily plugin version: 6.41.0.60884. I’m getting the following errors in the log (starting from the start of the CFamily plugin, which seems the culprit):

INFO: Sensor CFamily [cpp]
INFO: CFamily plugin version: 6.41.0.60884
INFO: Using build-wrapper output: M:\TestSonarQube\bw-output\build-wrapper-dump.json
INFO: Available processors: 16
INFO: Using 16 threads for analysis.
INFO: Found empty cache on server
INFO: [pool-2-thread-1] M:/TestSonarQube/src/main.c
INFO: Reached stage: parsing
INFO: Requesting reproducer for: M:/TestSonarQube/src/main.c
ERROR: Exception in thread pool-2-thread-1
com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code -1073741676: M:/TestSonarQube/src/main.c
        at com.sonar.cpp.analyzer.Subprocess.lambda$execute$1(Subprocess.java:42)
        at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
        at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:38)
        at com.sonar.cpp.analyzer.ReproducerRequester.requestReproducer(ReproducerRequester.java:37)
        at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:39)
        at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
        at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:1074)
        at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:58)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)

ERROR:
An error occurred while analyzing the following compilation unit:
  M:/TestSonarQube/src/main.c
A file named "sonar-cfamily-reproducer.zip" has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
  M:\TestSonarQube\sonar-cfamily-reproducer.zip

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 12.886s
INFO: Final Memory: 38M/176M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException:
An error occurred while analyzing the following compilation unit:
  M:/TestSonarQube/src/main.c
A file named "sonar-cfamily-reproducer.zip" has been generated to help the problem investigation.
Please contact SonarSource support providing the following file to help improving the analyzer:
  M:\TestSonarQube\sonar-cfamily-reproducer.zip

        at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:442)
        at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:215)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64)
        at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
        at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
        at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
        at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
        at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
        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 jdk.proxy1/jdk.proxy1.$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:126)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
        at org.sonarsource.scanner.cli.Main.main(Main.java:62)
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Does the exception exit code already explain the issue in this case? I’m open to share the reproducer.zip privately when needed.

I’ve tried scaling down the codebase significantly, but no change in the error. Also tried some definitions to ignore/exclude some exceptions found online did not help.

Thank you in advance,
Kind regards,
Kevin

Hi @kevineas ,

I am sending you a private message where you can share the reproducer privately.

Hi @kevineas ,

thank you for the reproducer. You are using an old version of the Texas compiler, see CPP-2906.

Would you be able to update it to a newer version?

Hi Massima,

Thank you for analyzing. Unfortunately we have to use this specific (old) version of the compiler, as this is the compiler with the correct certifications regarding safety. Are the workaround mentioned in CPP-2906 possible solutions for my issue you think?

If the issue is directly related to the compiler, I can also try with another variant of the same system, which is dedicated to another hardware platform + architecture + compiler.

Hi @kevineas ,

Yes, you can try to do that, you could add macro definition to a common header file after the build as a test.

Yes, this is another possibility.

Hi Massimo,

I’ve tried for another project which compiles for another hardware platform, and the sonarscanner is running perfectly for that one. So it indeed seems to be related to the compiler (/version). I will also check the workaround mentioned in the ticket in the future.

Thank you for the support!

1 Like

Hi @kevineas ,

great, thank you for coming back to us confirming that it worked properly.