Using the latest CFamily plugin (6.0.0.10816) there are problems with scanning projects that are built with gcc 4.9.1.
This is a Developer Edition server, which was recently update to the latest version (7.6). Reverting the plugin to an older version (5.0.0.9359) solve the problem.
The last lines of the output with the new plugin:
23:58:32.251 INFO: ------------------------------------------------------------------------
23:58:32.251 INFO: EXECUTION FAILURE
23:58:32.251 INFO: ------------------------------------------------------------------------
23:58:32.252 INFO: Total time: 10.137s
23:58:32.366 INFO: Final Memory: 31M/425M
23:58:32.367 INFO: ------------------------------------------------------------------------
23:58:32.367 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: java.lang.IllegalStateException: exit code != 0
at com.sonar.cpp.N.F.A(na:1714)
at com.sonar.cpp.plugin.R.B(na:3237)
at com.sonar.cpp.plugin.R.A(na:1306)
at com.sonar.cpp.plugin.R.execute(na:156)
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(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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)
Caused by: java.lang.IllegalStateException: exit code != 0
at com.sonar.cpp.N.E.A(na:869)
at com.sonar.cpp.N.E.A(na:444)
at com.sonar.cpp.plugin.R.A(na:2250)
at com.sonar.cpp.N.F.B(na:50)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
WARN: Unable to locate âreport-task.txtâ in the workspace. Did the SonarScanner succedeed?
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE
I know that gcc 4.9.1 is old, but we cannot just switch to a new version suddenly.
Is this a known limitation of the new CFamily plugin? And if yes, what is the minimum version of gcc that is working fine with the latest plugin?
It should create a file named sonar-cfamily.reproducer in the project folder which you should share with me to help in the investigation, send it privately if it contains sensitive information.
The above was generated with the following line:
e:\Tools\sonar-scanner-3.3.0.1492-windows\bin\sonar-scanner.bat sonar.cfamily.reproducer=e:/Jenkins/Slave/workspace/cc_prs/src/implement/diag_cfg.c -X
I was not sure where to add this extra parameter, so I added at the command line.
Seeing the error (âTasks support was removedâŚâ) I though maybe it should not be a command line parameter, but an extra line in the sonar-project.properties file.
After adding the extra line into sonar-project.properties and running the scanner, I got different errors. See attachment.
I get the message: Please contact SonarSource Support and provide file E:\Jenkins\Slave\workspace\cc_prs\sonar-cfamily.reproducer scanner-output.txt (30.5 KB)
But the sonar-cfamily.reproducer is not there at all.
While I tried to create a minimalistic project, I discovered that if I change the directory name of the project, the scanner is not crashing.
For example, to original folder name is cc_prs. If I renamed it to test, or even to cc_prs_, the scanner is working and the analyses finishes.
Could this give you some hint, guys?
I am bit struggling to create the minimalistic project, as I have to guard our IP, yet create a project that crashes. On top of this, a simple directory rename makes the whole issue disappearâŚ
if you did that keeping the property sonar.cfamily.reproducer=e:/Jenkins/Slave/workspace/cc_prs/src/implement/diag_cfg.c itâs normal that there is no crash anymore, because the analyzer doesnât do anything in such case because the filename doesnât match, hence no crash. Is it the case?
Sorry for the late reply. I was not able to spend time on this in the past weeksâŚ
I am not sure exactly what happened. The âreproducerâ line was not in the project properties file when I was testing this. But now I cannot reproduce this: the scanner crashing also in renamed directories.
This is on one hand good, as I was able to create a simple project which still fails.
How can I send you the test project? I can upload only images and text, not a zipped folderâŚ
The build command I use: build-wrapper-win-x86-64.exe --out-dir bw-output make -kr all _TARGET=gcc _CONFIG=release
The scanner command: sonar-scanner.bat -D"sonar.projectKey=cc_prs_" -D"sonar.organization=tcsabina-github" -D"sonar.sources=." -D"sonar.cfamily.build-wrapper-output=bw-output" -D"sonar.host.url=https://sonarcloud.io" -D"sonar.login=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
The auth.token might be expired when you read this (or not?), but I think you know how to deal with it.
The gcc version I am using is 4.9.3. I guess the build wrapper is calling gcc, right?
we will fix it in next release for sure, unfortunately I still donât know when.
In the mean time you could try to use a different compiler than mingw32 gcc, that should work. Is it the only compiler you can use for your project?