Issue with build-wrapper-output

Hello everyone,

I’m using a script to trigger sonar cloud on bitrise but I have an issue I can’t fix

./sonar-scanner-3.2.0.1227-macosx/bin/sonar-scanner
-Dsonar.projectKey=MyProjectName
-Dsonar.organization=MyOrganisation
-Dsonar.sources=./MyProject
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.login=$SONAR_TOKEN
-Dsonar.pullrequest.branch=$BITRISE_GIT_BRANCH
-Dsonar.pullrequest.key=$BITRISE_PULL_REQUEST
-Dsonar.pullrequest.provider=GitHub
-Dsonar.pullrequest.github.repository=myRepository
-Dsonar.sources=./MyProject
-Dsonar.cfamily.build-wrapper-output.bypass=true

I have the error below:
‘sonar.cfamily.build-wrapper-output’ is mandatory

Can you tell me what I do wrong please? I’ve search work arround for hours now.
Thanks for reading me.

Jérémy

Jérémy,

sonar.cfamily.build-wrapper-output.bypass is no longer supported on SonarCloud as it is using a new version of SonarCFamily (v6.0) where this long deprecated parameter has been dropped.

I’d go ahead and check out our documentation on analyzing C/C++ code with the build wrapper

Colin

Thanks for your reply.
I’ve check this part of the doc and I tried to set a path instead of using bypass. But I had an error
java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /Users/vagrant/git/./sonar-scanner-3.2.0.1227-macosx/bin/build-wrapper-dump.json

Indeed I don’t have a build-wrapper-dump.json but I don’t know how to download the Build Wrapper.
In the doc they told to download on local host has they create the server themself but I don’t know how to find the Build Wrapper in my case (I use SonarCloud).

I was not able to find mention of that in the doc.

This is a good point (and not the first time confusion has come from the docs referencing localhost).

For SonarCloud, you can substitute sonarcloud.io (https://sonarcloud.io/static/cpp/build-wrapper-win-x86.zip)

1 Like

Thank you for your help! It works now.

Hi,

I am having the same issue when running a build from a Build Definition in Azure DevOps on a private build server.
The following message is shown in during the ‘Run Code Analysis’ task:

ERROR: Error during SonarQube Scanner execution
ERROR: java.nio.file.NoSuchFileException: C:\A\1_work\87\bw_output\build-wrapper-dump.json
ERROR: Caused by: C:\A\1_work\87\bw_output\build-wrapper-dump.json
ERROR:
The SonarQube Scanner did not complete successfully
19:32:27.25 Post-processing failed. Exit code: 1
C:\A\1_work_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.6.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe failed with return code: 1

I have download the Build Wrapper and I have copied the files to the private build server and set a path to the folder where I have copied the files (build-wrapper-win-x86-32.exe and build-wrapper-win-x86-64.exe).

I have set the sonar.cfamily.build-wrapper-output to bw_output

The solution that is build contains C#, VB.NET, C++

Without C++ analysis everything is going fine, however I would like also to have analysis on the C+±code.

Do you have a suggestion what could be wrong or did I missed ?

Kind Regards,
Thierry

Hi @tkn,

could you please open a new topic to track your issue? Did you add build-wrapper to your setup and generated a build-wrapper-dump.json file?

Hi Massima,

Thank your for your reply. I have finally fixed this issue by replacing the build solution task through a command line script task which is calling the build-wrapper-win-x86-64.exe with the msbuild-command.
This is generating the build-wrapper-dump.json-file.
So I have missed a step :slight_smile:

Kind Regards,
Thierry

1 Like

How would you do that in Azure DevOps build process ?

Hi Ivar,

Hereby the steps I did:

  • Copy the build-wrapper-win-x86-64.exe to the build server and add location of the directory to the path-environment

  • In the build pipeline add a ‘Command line’-task to before the your Visual Studio build task

  • Configure the script of the ‘Command line’-task:
    build-wrapper-win-x86-64.exe --out-dir …\bw_output “C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe” .\SolutionToBuild.sln /t:Clean;Rebuild /p:Configuration=“Release” /p:Platform=“x86” /m

  • Configure the Working Directory in the Advanced part of the ‘Command line’-task:
    $(Build.SourceBranch)/FolderWhereTheSolutionIsLocated

Note that this is influencing your ‘bw_output’ location!

  • Disable the Visual Studio build task

I hope this helps you somewhat further.

Kind Regards,
Thierry

April 2020 calling and those docs are still causing confusion. Perhaps they could be updated or the info made available on some sonarcloud docs? :roll_eyes:

A post was split to a new topic: How to run build-wrapper-windows