com.sonar.cpp.analyzer.Analyzer exception

I am trying to scan a .hpp file using SonarLine On-The-Fly for C++ header file with SonarLint 7.5 plug-in from Eclipse Markeplace in STM32CubeIDE. The following error (snippet) shows on the console.

Execute Sensor: CFamily
CFamily plugin version: 6.38.0.60268
Using build-wrapper output: C:\Users\Ed Menard\STM32CubeIDE\workspace-vs-20-cleanup\.metadata\.plugins\org.eclipse.core.resources\.projects\sspl_platform_cpp\org.sonarlint.eclipse.core\sonarlint7382278009213211065\build-wrapper-dump.json
Available processors: 16
Using 16 threads for analysis.
Using build-wrapper-dump.json probe
[pool-14-thread-1] C:\git\Microcontoller-vs-20-cleanup\sspl_cpp\platform\inc\data\sspl_Buffer.hpp
Reached stage: parsing
Reproducer logs:
Exception in thread pool-14-thread-1
com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: C:\git\Microcontoller-vs-20-cleanup\sspl_cpp\platform\inc\data\sspl_Buffer.hpp
	at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:41)
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:1031)
	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

Error executing sensor: 'CFamily'
java.lang.IllegalStateException: com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: C:\git\Microcontoller-vs-20-cleanup\sspl_cpp\platform\inc\data\sspl_Buffer.hpp
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:434)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:212)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:75)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.sensor.SensorsExecutor.execute(SensorsExecutor.java:66)
	at org.sonarsource.sonarlint.core.analysis.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:122)
	at org.sonarsource.sonarlint.core.plugin.commons.container.SpringComponentContainer.startComponents(SpringComponentContainer.java:182)
	at org.sonarsource.sonarlint.core.plugin.commons.container.SpringComponentContainer.execute(SpringComponentContainer.java:161)
	at org.sonarsource.sonarlint.core.analysis.container.module.ModuleContainer.analyze(ModuleContainer.java:71)
	at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:58)
	at org.sonarsource.sonarlint.core.analysis.command.AnalyzeCommand.execute(AnalyzeCommand.java:32)
	at org.sonarsource.sonarlint.core.analysis.AnalysisEngine$AsyncCommand.execute(AnalysisEngine.java:153)
	at org.sonarsource.sonarlint.core.analysis.AnalysisEngine.executeQueuedCommands(AnalysisEngine.java:71)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: C:\git\Microcontoller-vs-20-cleanup\sspl_cpp\platform\inc\data\sspl_Buffer.hpp
	at com.sonar.cpp.analyzer.AnalysisHandler.acceptResult(AnalysisHandler.java:41)
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:113)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:1031)
	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	... 1 more

Hello @Ed-Enspectra, and welcome,

To understand what happens, we would need a reproducer file. For that, you should add the property sonar.cfamily.reproducer with the value C:\git\Microcontoller-vs-20-cleanup\sspl_cpp\platform\inc\data\sspl_Buffer.hpp to the analysis.

To do that, you can go to “Window” > “Preferences” > “SonarLint” > “Analyzer Properties”, then trigger a new analysis of this file.

In the log, you should see that a file is generated. Please send it to us. If you think this file contains private information, let us know, we’ll send you a private message that will allow you to send it privately.

Hi Loic,

I have generated the reproducer file – will you please send a link so that I can send it privately?

Thanks,

–Ed

Hello again @Ed-Enspectra,

You seem to suffer from the same issue as the one reported in SonarLint CFamily Errors - #11 by JolyLoic.

We don’t correctly recognize your compiler (could you please tell us its exact version?) and as a consequence, we are missing data during the analysis which leads to a crash.

Could you explicitly define in your build the macro __SIZEOF_POINTER__ to the right value for your architecture (usually 4 or 8), this should work around the issue (and don’t forget to remove the sonar.cfamily.reproducer property). Let us know if this works!

I also added your case to [CPP-3550] - Jira

Hello again,

Thanks for your help!

I’m using GNU Tools for STM32 (10.3-2021.10).
Let me know if there’s some other version number I should be reporting.

Oddly enough, I re-connected the SonarCloud connection, and the problem seemed to go away then. Maybe I was just lucky.
Also just added the SIZEOF_POINTER definition just to be sure.

Looks like it’s working now! No more exceptions reported.

Thanks again for your help!

–Ed

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.