Sonar-scanner: 0 compilation units analyzed

scanner
sonarcfamily
build-wrapper

(Wim Yedema) #1

I try to get the sonar-scanner to analyze some sources for ARM firmware, but I fail to get anything out of it. It’s built on windows 10 using CMake and Ninja (though mingw32-make gives the same results).
Looking at the log below I guess it’s because it says “‘CFamily’ skipped because one of the required properties is missing”, but - come on - which one?

Can anyone help me with this?

Redacted output:
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Windows 10 10.0 amd64
INFO: SonarQube server 7.7.0

DEBUG: Declared extensions of language C were converted to sonar.lang.patterns.c : **/*.c,**/*.h
DEBUG: Declared extensions of language C++ were converted to sonar.lang.patterns.cpp : **/*.cc,**/*.cpp,**/*.cxx,**/*.c++,**/*.hh,**/*.hpp,**/*.hxx,**/*.h++,**/*.ipp

INFO: 111 files indexed

DEBUG: ‘CFamily’ skipped because one of the required properties is missing

INFO: Sensor CFamily [cpp]
INFO: Using build-wrapper output: [snipped path]\build-wrapper-dump.json

DEBUG: ‘[snipped source file]’ generated metadata with charset ‘windows-1252’
[this for many files]

INFO: 0 compilation units analyzed

INFO: 7 files had no CPD blocks
INFO: Calculating CPD for 102 files
DEBUG: Detection of duplications for [snipped filename]
[this repeates for many files]

INFO: SCM writing changed lines
DEBUG: SCM reported changed lines for 0 files in the branch
INFO: SCM writing changed lines (done) | time=16ms

sonar-project.properties
sonar.projectKey=[snip]
sonar.organization=imecdevnl
sonar.host.url=https://sonarcloud.io
sonar.login=[snip]

sonar.projectBaseDir=[X]
sonar.sources=src
sonar.cfamily.build-wrapper-output=[X]/build/BW-OUTPUT

excerpt from build-wrapper-dump.json

{
  "version":0,
  "captures":[
    {
      "compiler":"clang",
      "executable":"C:\\PROGRA~2\\GNUTOO~1\\72018-~1\\bin\\arm-none-eabi-g++.exe",

(Massimo Paladin) #2

Hi @wimyedema,

could you please share with me privately the full sonar-scanner.log and build-wrapper-dump.json files please?


(Wim Yedema) #3

Hi Massimo,

See attachment. This is the set-up as I want to have it. I do see the duplicated code messages, but that’s it.

Wim

(Attachment build-wrapper-dump.json is missing)

(Attachment sonar-project.properties is missing)

(Attachment sonar-scan.log is missing)


(Massimo Paladin) #4

Hi @wimyedema,

you haven’t attached anything:


(Wim Yedema) #5

I did, but apparently they got dropped… It seems I’m not allowed to attach these files:
“Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif, txt)”
“Sorry, new users can only put 2 attachments in a post.” sigh

build-wrapper-dump.json.txt (48.4 KB)
sonar-scan.log.txt (129.2 KB)


(Massimo Paladin) #6

Hi @wimyedema,

build-wrapper-dump.json doesn’t show any compiler invocation. How are you building your project before invoking sonar-scanner? Are you launching a clean build?


(Wim Yedema) #7

There are 2 variant in this project. One part is built using Atmel Studio 7 (which is basically an adaptation from Visual Studio), and another part is built through CMake and MinGW make. The second part isn’t working. I do get results for the Atmel Studio part.
I may have done something wrong on the files I sent you. Let me re-run and send you some new log files…


(Wim Yedema) #8

Well… I just ran a scan on our build server, just to try and - what do you know - it works there!
Still doesn’t work on my own laptop though…
beside paths and environment and such, the only difference is running a debug vs. a release build. Another thing to check…