Unable to scan C++ project using OpenCascade

sonar-scanner: 4.2.0.1873 linux
build-wrapper-linux-x86: 6.9
On SonarCloud, scan launched on my Linux computer

When I scan a code with OpenCascade headers include, I get the following error. For files in the same project without OpenCascade include, scanned separately, the scan works fine.

Executed commands:

build-wrapper-linux-x86-64 --out-dir bw-output make clean all
sonar-scanner -Dsonar.organization=[org] -Dsonar.projectKey=[project] -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.login=[login]

Error:

ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: [file.cpp]
	at com.sonar.cpp.analyzer.AnalysisExecutor.submit(AnalysisExecutor.java:47)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:528)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:471)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:305)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:34)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:78)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:54)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:68)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:402)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:398)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:356)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:126)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:108)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
	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 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: com.sonar.cpp.analyzer.Analyzer$AnalyzerException: Exit code != 0: /home/simon/Documents/Git/Airthium/Tanatloc/tanatloc-dockers/converters/StepUnion.cpp
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:76)
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:73)
	at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:33)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$5(CFamilySensor.java:531)
	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:53)
	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)

I can share the sonar-cfamily.reproducer privately.

Hello Simon.

Thanks for contacting us and for reporting the issue.
Following-up on your offer, please send me a private message with the reproducer.

I can’t find a way to send you private message. Registration too recent ?

I just sent you a PM.

1 Like

A ticket has been created
CPP-2547

A fix is on its way for the next release. In the meantime, you can disable the rule as a workaround.

Nice. Thank you a lot for the quick answer

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

Hi @sgarnotel.
The new version of the analyzer with the fix has been deployed on SonarCloud. Let me know if it fixes your problem.

1 Like