Jenkins Sonar scanner of C project only showing "0 compilation units analyzed" for sonarcfamily

scanner
sonarcfamily

(Wesley Crelly) #1

Information
SonarQube version: 7.5.0.20543
Jenkins version: v 2.150.1 LTS
SonarQube Scanner for Jenkins plugin version: SonarQube Scanner 3.2.0.1227
SonarCFamily plugin version: SonarCFamily 6.0.0.10816 (cpp)
Server OS version: Windows Server 2016 10.0 amd64
Java version: Java 1.8.0_201 Oracle Corporation (64-bit)

Problem:
The Jenkins job using sonar scanner plugin does not analyze any of the C code of which it generates metadata.

Only code smells related to duplicated code are being reported in SonarQube. We have near 100K lines of code and SonarLint shows many errors that aren’t being reported.

Multiple files were "indexed with language ‘c’ " and show " generated metadata with charset ‘windows-1252’ "

Tried:
Checked for component updates.
Tried modifiying Jenkins job analysis properties

Notes:
We set Jenkins job analysis properties for sonar.projectKey, sonar.sources, sonar.cfamily.build-wrapper-output, sonar.sourceEncoding, sonar.exclusions
Our server is running both Jenkins & SonarQube


(Massimo Paladin) #2

Hi @Wes,

could you please share the sonar-scanner log?


(Wesley Crelly) #3

Hi Massimo,

I’ll need to redact some items from the log, but for the time being, let me outline our Jenkins build setup.

  1. Our source code is in a git repo, and we only build off of our master branch.

  2. We run Code Composer Studio (Eclipse based) to clean the project directory

  3. We use the following as an ‘Execute Windows batch command’ to run the build wrapper
    ::This is modified from src\build.bat for use by sonar analysis build wrapper
    D:\sonarqube-7.5\build-wrapper-win-x86\build-wrapper-win-x86\build-wrapper-win-x86-64.exe --out-dir D:\Jenkins\workspace\redacted_project\sonar_build_report C:\ti\ccsv8\eclipse\eclipsec.exe -noSplash -data workspace_redacted -application com.ti.ccstudio.apps.projectBuild -ccs.workspace

  4. We ‘Execute SonarQube Scanner’ with analysis properties as follows:

sonar.projectKey=redacted_SonarQube_project
sonar.sources=D:/Jenkins/workspace/redacted_project/source, D:/Jenkins/workspace/redacted_project/tests
sonar.cfamily.build-wrapper-output=sonar_build_report
sonar.sourceEncoding=UTF-8

Also I include the -X additional argument to get verbose logs

  1. After this is just clean-up

I’ll reply soon with a redacted log.


(Wesley Crelly) #4

Hi @mpaladin,
I attached a recent redacted Jenkins sonar log: jenkins-job-sonar-log.txt (37.8 KB)
Thanks for your help,
-Wes


(Wesley Crelly) #5

Also, our core issue right now is not being able to scan our C code with our Jenkins build. If there is another scanner that we should use or a different configuration that we should try, please let me know.
Thanks!
-Wes


(Wesley Crelly) #6

Do you know if there are any compatibility issues with TI Compilers? Note, this used to work for our team.


(Massimo Paladin) #7

Hi @Wes,

the list of supported compilers is available at this page. If you are not using a supported compiler it is expected that you don’t get your files analyzed. What compiler are you using?


(Wesley Crelly) #8

Hi @mpaladin,

Right now we are using Code Composer Studio (Eclipse based) with Texas Instruments compiler v18.1.5 LTS

Also, we don’t have any problem using SonarLint which is scanning the code and showing us the expected issues.


(Massimo Paladin) #9

Hi @Wes,

yes, SonarLint for Eclipse is compiler agnostic. Unfortunately we don’t support any Texas Instruments compiler at the moment, as documented at https://redirect.sonarsource.com/plugins/cpp.html.

What platform compiler are you using from Texas Instruments compiler v18.1.5 LTS?


(Wesley Crelly) #10

Hi @mpaladin

We use the C2000 TMS320F28x C/C++ Compiler


(Massimo Paladin) #11

Hi @Wes,

no promise and ETA but I created a dev ticket to track the request and traction for TI C2000 compiler: CPP-2094


(Wesley Crelly) #12

I understand. Thanks @mpaladin