Unable to get C++ files analysed

Hi,

I am trying to analyse a C++ project on Windows PC. The project is compiled using mingw32-make and the makefile not only builds the C++ project (embedded) but also invokes build of Windows C# applications using dotnet.exe. The main interest for me is to get the C++ project analyzed but of course the C# projects would nice to have analyzed as well.

I am using SonarCFamily 6.4 and SonarQube 7.9.1

My first problem was that build-wrapper-win-x86-64.exe could not be called with both ‘clean’ and ‘all’ targets at the same as it would clean simultanuously as building, which inevitably led to build failure. I could solve that by splitting it into two separate steps.
Now it builds but when I run sonar-scanner it fails. It claims to have found issues and processed some 360k lines of code. But the coverage is 0% and when I try to look at file in which an issue is reported then I can’t see any indication of where the issue is. All I can see is that all lines of code are marked as having been skipped.

Failure output
org.sonar.ce.task.projectanalysis.component.VisitException: Visit of Component {key=CFD,uuid=AW3PZ9wblJO-cX-iWHci,type=PROJECT} failed
at org.sonar.ce.task.projectanalysis.component.VisitException.rethrowOrWrap(VisitException.java:44)
at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:41)
at org.sonar.ce.task.projectanalysis.purge.PurgeDatastoresStep.execute(PurgeDatastoresStep.java:70)
at org.sonar.ce.task.step.ComputationStepExecutor.executeStep(ComputationStepExecutor.java:81)
at org.sonar.ce.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:72)
at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:59)
at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:209)
at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:191)
at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:158)
at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:133)
at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:85)
at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
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.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
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:835)
Caused by: java.lang.IllegalStateException: Unrecoverable indexation failures: 546 errors among 546 requests
at org.sonar.server.es.IndexingListener$1.onFinish(IndexingListener.java:39)
at org.sonar.server.es.BulkIndexer.stop(BulkIndexer.java:122)
at org.sonar.server.component.index.ComponentIndexer.delete(ComponentIndexer.java:165)
at org.sonar.ce.task.projectanalysis.purge.IndexPurgeListener.onComponentsDisabling(IndexPurgeListener.java:41)
at org.sonar.db.purge.PurgeDao.purgeDisabledComponents(PurgeDao.java:107)
at org.sonar.db.purge.PurgeDao.purge(PurgeDao.java:71)
at org.sonar.ce.task.projectanalysis.purge.ProjectCleaner.purge(ProjectCleaner.java:63)
at org.sonar.ce.task.projectanalysis.purge.PurgeDatastoresStep.execute(PurgeDatastoresStep.java:76)
at org.sonar.ce.task.projectanalysis.purge.PurgeDatastoresStep.access$000(PurgeDatastoresStep.java:38)
at org.sonar.ce.task.projectanalysis.purge.PurgeDatastoresStep$1.visitProject(PurgeDatastoresStep.java:63)
at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitNode(DepthTraversalTypeAwareCrawler.java:70)
at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:51)
at org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
… 18 more

SonarQube plugins:

  • SonarCSS 1.1.1.1010 (cssfamily)
  • Svn 1.9.0.1295 (scmsvn)
  • SonarPLSQL 3.4.1.2576 (plsql)
  • SonarScala 1.5.0.315 (sonarscala)
  • SonarC# 7.17.0.9346 (csharp)
  • Vulnerability Analysis 7.9.0.5105 (security)
  • SonarJava 5.13.1.18282 (java)
  • LDAP 2.2.0.608 (ldap)
  • SonarHTML 3.1.0.1615 (web)
  • SonarFlex 2.5.1.1831 (flex)
  • SonarXML 2.0.1.2020 (xml)
  • SonarTS 1.9.0.3766 (typescript)
  • SonarVB 7.15.0.8572 (vbnet)
  • SonarSwift 4.1.0.3087 (swift)
  • SonarCFamily 6.4.0.11646 (cpp)
  • SonarPython 1.14.1.3143 (python)
  • GitHub Authentication for SonarQube 1.5.0.870 (authgithub)
  • JaCoCo 1.0.2.475 (jacoco)
  • SonarGo 1.1.1.2000 (go)
  • SonarKotlin 1.5.0.315 (kotlin)
  • SonarTSQL 1.4.0.3334 (tsql)
  • SonarJS 5.2.1.7778 (javascript)
  • SonarRuby 1.5.0.315 (ruby)
  • Vulnerability Rules for C# 7.9.0.5105 (securitycsharpfrontend)
  • Vulnerability Rules for Java 7.9.0.5105 (securityjavafrontend)
  • License for SonarLint 7.9.1 (license)
  • Git 1.9.1.1834 (scmgit)
  • SAML 2.0 Authentication for SonarQube 1.1.0.181 (authsaml)
  • SonarPHP 3.2.0.4868 (php)
  • SonarABAP 3.8.0.2034 (abap)
  • Vulnerability Rules for PHP 7.9.0.5105 (securityphpfrontend)
    Global server settings:
  • sonar.core.id=BF41A1F2-AWwZHmbQbCUd29UAnVfq
  • sonar.core.startTime=2019-10-17T14:20:35+0200
    Project server settings:
    Project scanner properties:
  • sonar.cfamily.build-wrapper-output=./cfd/build/bw_output_directory
  • sonar.cfamily.threads=2
  • sonar.host.url=http://localhost:9000
  • sonar.log.level=DEBUG
  • sonar.projectBaseDir=C:\Work\RemoteLink
  • sonar.projectKey=CFD
  • sonar.projectName=CFD Project
  • sonar.projectVersion=1.0
  • sonar.scanner.app=ScannerCli
  • sonar.scanner.appVersion=4.0.0.1744
  • sonar.sourceEncoding=UTF-8
  • sonar.sources=base,cfd
  • sonar.working.directory=C:\Work\RemoteLink.scannerwork

This is my properties file:

sonar-project.properties

must be unique in a given SonarQube instance

sonar.projectKey=CFD

— optional properties —

defaults to project key

sonar.projectName=CFD Project

defaults to ‘not provided’

sonar.projectVersion=1.0

sonar.projectBaseDir=./

Path is relative to the sonar-project.properties file. Defaults to .

sonar.sources=base,cfd

sonar.log.level=DEBUG

Encoding of the source code. Default is default system encoding

#sonar.sourceEncoding=UTF-8

set SONAR_SCANNER_OPTS=-Xmx1024m

sonar.cfamily.threads=2
sonar.cfamily.build-wrapper-output=./cfd/build/bw_output_directory

Hi @conscwit,

are is the analysis succeeding client side?
Do you consistently get the failure of the background task?

Hi Massimo,
I don’t get any error indications in the command prompt. It is only when I look at the server that I can see that something is wrong. And yes, it fails consistently.

Hi @conscwit,

if you are setting it up, did you try to delete it from SonarQube and re-analyze it?

I tried to clean everything and start all over and now it seems better. I can actually see where issues are located and the reason why it is deemed an issue.
So far so good. I am running on my own PC so how do I go about sharing a report for other people to see? I don’t want/need other people to run any checks but I want them to see what SonarQube can do.

Hi,

Your best bet here is to share the URL for your project homepage. We’ve built the interface to be communicative and easy to use and it should (hopefully!) sell itself far better than any flat report could.

 
HTH,
Ann

1 Like