MY SonarQube C++ scan is successful but results only flag Duplications and none other issues where flagged

MY SonarQube C++ scan is successful but results only flag Duplications and none other where flagged, which seems their is some thing going wrong with the scan. I have looked at jenkins output and Background tasks none of them have any errors.

Have anyone faced this before? How can i overcome this issue?

Please give some suggestions. Thanks in Advance.

sonar-project.properties

Default SonarQube server

sonar.host.url=xxxxxxxx

Root project information

sonar.projectKey=xxxxxx
sonar.projectName=xxxx
sonar.projectVersion=1.0

Metadata

sonar.links.homepage=
sonar.links.ci=xxxx
sonar.links.scm=xxxx
sonar.links.issue=xxxx

Sources to scan

sonar.sourceEncoding=UTF-8
sonar.projectBaseDir=system
sonar.sources=xxxx
sonar.exclusions=xxxx

SonarCFamily configuration

sonar.cfamily.build-wrapper-output=build_output
sonar.cfamily.threads=1
sonar.language=cpp
sonar.log.level=DEBUG

Jenkins Output
INFO: Scanner configuration file: /opt/sonar-scanner-3.3.0.1492-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /project-root/sonar-project.properties
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_212 IcedTea (64-bit)
INFO: Linux 3.10.0-1062.4.3.el7.x86_64 amd64
INFO: SONAR_SCANNER_OPTS=-Djavax.net.ssl.trustStore=/usr/bin/sq.keystore -Djavax.net.ssl.trustStorePassword=changeit
INFO: User cache: ?/.sonar/cache
INFO: SonarQube server 7.9.1
INFO: Default locale: “en_US”, source code encoding: “UTF-8”
WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x
INFO: Load global settings
INFO: Load global settings (done) | time=174ms
INFO: Server id: XXXXXXXXXXXXXXXX
INFO: User cache: /project-root/?/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=78ms
INFO: Load/download plugins (done) | time=6226ms
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=7ms
INFO: Project key: org.wabtec.pdsserver
INFO: Base dir: /project-root/system
INFO: Working dir: /project-root/system/.scannerwork
INFO: Load project settings for component key: ‘XXXXXXXXXXX’
INFO: Load project settings for component key: ‘XXXXXXXXX’ (done) | time=23ms
INFO: Load project branches
INFO: Load project branches (done) | time=21ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=15ms
INFO: Load branch configuration
INFO: Load branch configuration (done) | time=2ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=57ms
INFO: Load active rules
INFO: Load active rules (done) | time=786ms
INFO: Indexing files…
INFO: Project configuration:
INFO: Excluded sources: XXXXXXXXXXXXXXXXX
INFO: 10342 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for c: Sonar way
INFO: Quality profile for cpp: Sonar way
INFO: ------------- Run sensors on module PDS Server NS
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=22ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=23ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=40ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=23ms
INFO: Sensor CFamily [cpp]
INFO: Using build-wrapper output: /project-root/build_output/build-wrapper-dump.json
INFO: Available processors: 8
INFO: Using 1 thread for analysis according to value of “sonar.cfamily.threads” property.
INFO: Load project repositories
INFO: Load project repositories (done) | time=145ms
WARN: Metric ‘comment_lines_data’ is deprecated. Provided value is ignored.
INFO: 0 compilation units analyzed
INFO: Sensor CFamily [cpp] (done) | time=16616ms
INFO: Sensor JavaSecuritySensor [security]
INFO: Reading type hierarchy from: /project-root/system/.scannerwork/ucfg2/java
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /project-root/system/.scannerwork/ucfg2/java
INFO: No UCFGs have been included for analysis.
INFO: Sensor JavaSecuritySensor [security] (done) | time=7ms
INFO: Sensor CSharpSecuritySensor [security]
INFO: Reading type hierarchy from: /project-root/system/ucfg_cs2
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /project-root/system/ucfg_cs2
INFO: No UCFGs have been included for analysis.
INFO: Sensor CSharpSecuritySensor [security] (done) | time=0ms
INFO: Sensor PhpSecuritySensor [security]
INFO: Reading type hierarchy from: /project-root/system/.scannerwork/ucfg2/php
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /project-root/system/.scannerwork/ucfg2/php
INFO: No UCFGs have been included for analysis.
INFO: Sensor PhpSecuritySensor [security] (done) | time=1ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=68ms
INFO: 548 files had no CPD blocks
INFO: Calculating CPD for 8453 files
INFO: CPD calculation finished
INFO: Analysis report generated in 2580ms, dir size=100 MB
INFO: Analysis report compressed in 14394ms, zip size=32 MB
INFO: Analysis report uploaded in 2595ms
INFO: ANALYSIS SUCCESSFUL, you can browse
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
INFO: Analysis total time: 52.906 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:02.029s
INFO: Final Memory: 58M/1665M
INFO: ------------------------------------------------------------------------

Hi @Pavankunadaharaju,

could you please update SonarCFamily plugin analyzer to its latest version 6.6 and rerun the analysis?

Hi @mpaladin,

I was actually making this scans in Docker Container after making some changes i was able to do the scan.

But I am seeing the below error now.

java.lang.IllegalStateException: 0x67706368
at com.sonar.cpp.llvm.ClangPCH.readOffset(ClangPCH.java:61)
at com.sonar.cpp.llvm.ClangPCH.getOriginalSourceFile(ClangPCH.java:36)
at com.sonar.cpp.analyzer.ClangDriver.onCapture(ClangDriver.java:161)
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:273)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:205)
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:400)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
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:141)
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)

Hi @Pavankunadaharaju,

are you on MacOS? If yes, what version of Xcode are you using?

Hi @mpaladin,

No, I am on Linux.

Hi @Pavankunadaharaju,

what version of Clang are you using?

Hi @mpaladin,

We don’t use Clang. We use gcc (GCC) 4.4.7 for C++ compilation.

Hi @Pavankunadaharaju,

could you please share the build-wrapper output folder?

Hi @Pavankunadaharaju,

you are affected by CPP-2445, while waiting for the fix you can disable precompiled headers and all should work as expected.

Hi @mpaladin,

As I am new to SonarQube, can i know how can i disable precompiled headers?

Hi @Pavankunadaharaju,

You should try to disable precompiled headers in your project build, not on SonarQube, I don’t know how your project is built so I cannot really help you on that.