I´m using SonarQube Scanner to analyze my code. Everything worked fine and the analysis was uploaded to Sonarcloud, but since last week I am getting this error:
ERROR: Error during SonarQube Scanner execution java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found empty.
The code should be analysed locally with the commands:
build-wrapper-win-x86-64.exe --out-dir bw-output make clean all
where $SONAR_TOKEN is my created token at sonarcloud.io -> myAccount.
In both, locally and via remote bitbucket Pipeline testing, I always get that error message. Even after going back to the latest commit where the analysis ran perfectly and was uploaded to sonarcloud, the analysis still fails.
Did something change in SonarQube?
I´m using the latest version of SonarScanner which should be 4.0.0.1744 and, as far as I know, the latest version of the build-wrapper.
When comparing the logs of the bitbucket-pipeline after it was succesful with the log of a pipeline that failed, there is just one difference. In the failed analysis the scanner succesfully loads a repository and after that the same warnings appear (which can also be seen in local testing). Then the execution failes:
we added this safety check on latest release, this means that before you were not getting any c/c++ file correctly analyzed, now we are failing if it is the case to help you get a better analysis.
The error means that the build-wrapper-dump.json file found inside bw-output folder is found empty.
Could you please get the bw_output folder content from your build and share it? If it contains private data I can send you a PM where you can safely share it.
Wed Oct 02 11:29:01 2019: build-wrapper, version 6.3 (win-x86-64)
Wed Oct 02 11:29:01 2019: isWow64: 0
Wed Oct 02 11:29:01 2019: windows version: 6.2, service pack: 0.0, build number: 9200, product type: 1
Wed Oct 02 11:29:01 2019: current directory: C:\Users\cemci\RepoRecalm\firmware
Wed Oct 02 11:29:01 2019: command line received:
Wed Oct 02 11:29:01 2019: initializing json file
Wed Oct 02 11:29:01 2019: starting debug cycle
Wed Oct 02 11:29:01 2019: process created with pid: 1184
Wed Oct 02 11:29:01 2019: image path name: <C:\msys64\usr\bin\make.exe>
Wed Oct 02 11:29:01 2019: command line:
Wed Oct 02 11:29:01 2019: working directory: <C:\Users\cemci\RepoRecalm\firmware>
Wed Oct 02 11:29:01 2019: isWow64: 0
Wed Oct 02 11:29:01 2019: skipping process C:\msys64\usr\bin\make.exe with pid: 1184
Wed Oct 02 11:29:01 2019: process with pid 1184 exit with code: 2 (0x2)
Wed Oct 02 11:29:01 2019: finalizing json file
#This file is designed exclusively for use with the SONARSOURCE C / C++ / Objective-C Plugin. #It may not be used in connection with any other software. #Any other use is prohibited by law and may be grounds for immediate termination of your License.
{
“version”:0,
“captures”:[
]}
I always get the same error message at the excat same point in analysis. I didn´t change anything at all and the code to be checked wasn´t changed as well. How is it possible, that the analysis failes, when it ran perfectly fine? And why does it load the repository? I don´t get it.
the build is failing, what is the output of build-wrapper-win-x86-64.exe --out-dir bw-output make clean all? Its exit status is 2, which means something goes wrong.
Hi @mpaladin,
its output says: make: *** No rule to make target ‘clean’. Stop.
But that´s the output I´ve always gotten, because it is not defined yet. Then I entered the second command and usually the code was scanned, but now it failes execution.
it means that you don’t have clean defined in your Makefile. I invite you to first master your build before trying to setup an analysis, and on that, I cannot help you much.
No, the code was not scanned properly, that’s why we added this check.
Hi @mpaladin,
I am trying to get a build, but so far I didn´t. Isn´t “make clean all” supposed to get me a correct build, or did I misunderstand something? If the latter is the case: Do I need to write my own makefile?
Hi @mpaladin
I know. Usually I´ve used make but then i tried downloading msbuild and using it instead with the command MSBuild.exe instead of make clean all. But that does not change the fact that in my bitbucket Pipeline the build was succesfully checked but the analysis wasn´t. In the bitbucket Pipeline i am using a docker Image with Ubuntu 18.04.
And why does my pipeline needs to load my repositories? Where can I set that property?