Sonarqube scanning build-wrapper empty json

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): SonarQube: 9.2-developer, SonarScanner: 4.6.2.2472, CFamily plugin version: 6.20.2.38358, build-wrapper: /build-wrapper-output/build-wrapper-dump.json was generated using 6.20 build-wrapper version
  • what are you trying to achieve: scan my code
  • what have you tried so far to achieve this: update all the plugins and sonar to latest

Using Texas Instruments v20.2.5.LTS for CC1352P - compiler
How I wrap build command:

  1. Importing projects

    • $ti_ccstudio_path/ccstudio -noSplash -data build-zigbee -application com.ti.ccstudio.apps.projectImport -ccs.location zigbee/hub_bim_onchip_CC1352R -ccs.copyIntoWorkspace true -ccs.autoImportReferencedProjects true -ccs.configuration Release

    • $ti_ccstudio_path/ccstudio -noSplash -data build-zigbee -application com.ti.ccstudio.apps.projectImport -ccs.location zigbee/hub_CC1352R -ccs.copyIntoWorkspace true -ccs.autoImportReferencedProjects true -ccs.configuration Release

  2. Start building process

    • /root/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir “${CI_PROJECT_DIR}/build-wrapper-output” $ti_ccstudio_path/ccstudio -noSplash -data build-zigbee -application com.ti.ccstudio.apps.projectBuild -ccs.workspace -css.buildType full -ccs.listProblems -ccs.configuration Release
    • cd ${CI_PROJECT_DIR}
    • sonar-scanner -X

Can you guide me what I am doing wrong here? Also I can send log files.

Hi @bucha09 ,

Texas Instruments compiler are supported only on macOS and Windows, as stated in our documentation:

  • Texas Instruments compilers on Windows and macOS for ARM, C2000, C6000, C7000, MSP430, and PRU

The primary reason is the fact that TI compilers on linux are statically built and build-wrapper is not able to work with statically linked binary. You can try to generate a JSON Compilation Database, i.e. using bear tool and using the JSON Compilation Database as configuration.

Hi @mpaladin Thanks for your answer. I was working on changing container from Linux to Windows. And still result isn’t proper. Could you help me With solving this issue. Looks like I missed something and can’t get what exactly.

  1. Docker file based on: mcr.microsoft.com/windows/servercore:ltsc2019
  2. SONAR_SCANNER_VERSION = “4.6.2.2472”
  3. TI CCS Version CCS10.4.0.00006_win64
    And still there are no scanning result.

From gitlab-ci.yml execute this command:
- Start-Process -FilePath “cmd.exe” “/c $CI_PROJECT_DIR/sonar.bat” -PassThru -Wait -NoNewWindow
File contains:
C:\build-wrapper-win-x86-64.exe --out-dir .\build-wrapper-output C:\ti\ccs\eclipse\eclipsec.exe -noSplash -data build -application com.ti.ccstudio.apps.projectBuild -ccs.workspace -css.buildType full -ccs.listProblems -ccs.configuration Release

Hi @bucha09 ,

what problem are you facing now? You haven’t really mentioned what is wrong.

Hi @mpaladin ,
Sorry, forgot to paste
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:

  • you are using the latest version of the build-wrapper and the CFamily analyzer
  • you are correctly invoking the scanner with correct configuration
  • your compiler is supported
  • you are wrapping your build correctly
  • you are wrapping a full/clean build
  • you are providing the path to the correct build-wrapper output directory
  • you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps

But json file isn’t empty. Can send you in private messages (as file contain env variables and additional info from build etc…)

Hi @bucha09 ,

I sent you a private message.

For the records, the issue was coming from misconfiguration of the sonar-scanner, the set of indexed files was different from the set of built files. The issue has been solved.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.