Arduino CLI and 0 files analyzed

Hi,

SonarScanner version is 4.4.0.2170

When I run “build-wrapper-win-x86-64.exe --out-dir bw-output arduino-cli compile --fqbn esp8266:esp8266:d1_mini tag.ino” on Arduino CLI, it works.

I got very similar errors when I run sonar-scanner.bat -D"sonar.organization=[organizationkey]" -D"sonar.projectKey=[projectkey]" -D"sonar.sources=." -D"sonar.cfamily.build-wrapper-output=bw-output" -D"sonar.host.url=https://sonarcloud.io"

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

I can provide the full log in PM.

Regards,
JX

Hi Emmanuel,

Thanks for the info. I had difficulty following the .travis.yml. I have to build a CI pipeline on Azure DevOps, and the build pipeline is mainly using Arduino CLI tasks. From my understanding I have to run ArduinoCliBuild using Arduino CLI task and analyse using sonarcloud at the same time, how do I do that?

Many thanks,
JX

Hi @JX_Yeoh,

I merged your 2 posts in a new topic. Have you tried to follow what they do in Adding a source code analysis for IOT?

Hi Massimo,

Due to the urgency of source code scan, I have decided to do the scan on my local machine instead. As I mentioned in the post, when I run “build-wrapper-win-x86-64.exe --out-dir bw-output arduino-cli compile --fqbn esp8266:esp8266:d1_mini tag.ino” on Arduino CLI, it works. However, I got the error during sonarscanner execution. I can send the build-wrapper-dump.json and sonarscanner log via PM to help in diagnosis.

Regards,
JX

Hi Massimo,

Are you able to assist me on the issue? If yes, kindly PM me so that I can provide the build-wrapper-dump.json and sonarscanner log.

Kind regards,
JX

Hi @JX_Yeoh,

sorry for the delay, as shown in https://github.com/makers-for-life/makair/pull/41/files#diff-e7ba42416335d56575feb9ea61b5009cbacba14afdcb6382cfdbe1f3888031adR5 the workaround is to set --build_path and --output to a subtree of the project directory and to analyze the copy of the file which is made during build, have you tried that?

Hi Massimo,

Thanks for the suggestion. I tried on my local machine and it works. Next step, I will attempt doing this on project build pipeline and update here once I try.

Regards,
JX

Hi @JX_Yeoh,

as an extra operation you could also follow what this other user has done: Scanning platformio c++ embeded projects.

1 Like