Getting empty "build-wrapper-dump.json" file while building using "build-wrapper" in windows 10

Hi Iam Unable to build a C-project and iam getting the error and iam using build-wrapper-win-x86 but iam unable to generate the build wrapper dump json file , iam already generated a build wrapper dump json file but its showing empty like this
{
“version”:0,
“captures”:[
]}
And also i have given the sonar properties like this:

sonar.projectKey=newc-project
sonar.projectName=C-project
sonar.projectVersion=1.0
sonar.sources= .
sonar.login=admin
sonar.password=admin
sonar.language=c
sonar.c.compiler.parser=gcc
sonar.c.compiler.reportPath=*.c
sonar.c.file.suffixes=-
sonar.cfamily.build-wrapper-output=bw_output
sonar.c.compiler.charset=UTF-8

And i have given the execute shell command in the build section of jenkins is like :
build-wrapper-win-x86-64.exe --out-dir bw_output “C:\Program Files (x86)\Jenkins\workspace\C-Project\C-Example-Projectc-example-project-mastersrc\build-wrapper-dump.json” make /t:Rebuild

Iam using sonarqube 6.7 and sonar scanner4.2 and iam using mingw compiler and for C/C++ project iam using Cmake and my O.S is windows 10 64 bit Note: Iam not doing in any linux os or aws instance iam doing manually on windows 10 system

Dear Massimo Paladin can you pls look into this on high priority and provide me the solution with step by step

Hello @csk,

Please refrain from tagging someone explicitly on this forum.

These options aren’t related to the SonarSource C analyzer. They are related to sonar-cxx. sonar-cxx is an unofficial analyzer that isn’t supported on this forum. sonar-cxx doesn’t require build-wrapper, You are mixing the two analyzers.

If you have questions about sonar-cxx please direct them to their channel.
For the SonarSource analyzer, please check the official documentation.

Thanks,

Hi Abbas Sabra,
Can you pls help me how to do sonarqube analysis in C-project using Build-wrapper sonarqube and what are the sonar-properties we have to mention and what are the build commands we have to write ,pls tell me this process step by step or provide any material or link or website.
pls look into this on high priority and provide me the solution with step by step
Thanks

@csk,

Start by removing sonar.c options from your properties.
remove these:

replace

by

sonar.sourceEncoding=UTF-8

Follow this documentation and let me know if you face any specific issue.

Hi Abbas_Sabra,
I have given the properties as per your suggestions it is working fine and now i want to build this using build wrapper sonarqube. I have given the executive shell command in build section of jenkins like this:
sysntax: ```
build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory MSBuild.exe /t:Rebuild

Actually I have given like this:
build-wrapper-win-x86-64.exe --out-dir bw-output "C:\Program Files (x86)\Jenkins\workspace\C-Project\build_wrapper_output_directory\build-wrapper-dump.json" make /t:Rebuild

But it is not working and giving errors. Pls look into this on high priority and provide me the solution with step by step

 Iam using sonarqube 6.7 and sonar scanner4.2 and iam using mingw compiler and for C/C++ project iam using Cmake and my O.S is windows 10 64 bit Note: Iam not doing in any linux os or aws instance iam doing manually on windows 10 system

I have replaced like this; It is workinf fine
sonar.projectKey=newc-project
sonar.projectName=C-project
sonar.projectVersion=1.0
sonar.sources= .
sonar.login=admin
sonar.password=admin
sonar.language=c
sonar.cfamily.build-wrapper-output=bw_output
sonar.cfamily.cache.enabled=true
sonar.c.compiler.charset=UTF-8

But i was struggling with build command in the executable shell command in c-project using build -wrapper sonarqube i have analyse the c-project in sonarqube

Read my previous comment that said that you should replace this option.

You aren’t running the build-wrapper in the correct way.

  • You should not specify the path of the json file. build-wrapper actually generate the json file. So you should remove this part:
    "C:\Program Files (x86)\Jenkins\workspace\C-Project\build_wrapper_output_directory\build-wrapper-dump.json"
  • /t:Rebuild doesn’t work with make. Here instead of make /t:Rebuild you should pass the command that you usually use to build your project from scratch. What command do you usually use to build your project?

Hi Abbas Sabra,
Iam using this commands to build c-project in Cmake application

mkdir build
cd build
cmake … -G “MinGW Makefiles”
mingw32-make

Actuall i was stuck uo to build this c-project using build-wrapper sonarqube. I dont know how to build this c-project using build wrapper.Pls help me how to build this c-project. I have using the above commands in execute shell and also in Execute the SonarScanner ( sonar-scanner ) from the root directory of the project. I am getting lots of erroe iam getting proper output.

Pls kindly help me to build in build-wrapper sonarqube and send me the execute build commands foe c/c++ project by sending any documents, website links or step by step process to build.

Thanks

you build using build-wrapper the same way you build without it. you just add build-wrapper-win-x86-64.exe --out-dir bw_output to your full build command.
so for you after doing this step

you should do:
build-wrapper-win-x86-64.exe --out-dir bw_output mingw32-make clean all instead of mingw32-make

Hi Abbas Sabra,
when i run this command in cmd prompt from root directory of the project command as "build-wrapper-win-x86-64.exe --out-dir bw_output mingw32-make clean all " i am getting this kind of error can you pls look into this on high priority and provide me the correct command to execute this is urgent requirement.

C:\C-Example-Project\c-example-project-master>build-wrapper-win-x86-64.exe --out-dir bw_output mingw32-make clean all
process_begin: CreateProcess(NULL, pwd, …) failed.
-d was unexpected at this time.
‘PKG_CONFIG_PATH’ is not recognized as an internal or external command,
operable program or batch file.
process_begin: CreateProcess(NULL, pwd, …) failed.
process_begin: CreateProcess(NULL, pwd, …) failed.
FIND: Invalid switch
rm -f /src/dll.o /src/libdll.a
process_begin: CreateProcess(NULL, rm -f /src/dll.o /src/libdll.a, …) failed.
make (e=2): The system cannot find the file specified.
src/src.mk:14: recipe for target ‘clean-libdll’ failed
mingw32-make: *** [clean-libdll] Error 2

@csk What is the output if you run mingw32-make clean all in the same directory without build-wrapper?

process_begin: CreateProcess(NULL, pwd, …) failed.
-d was unexpected at this time.
‘PKG_CONFIG_PATH’ is not recognized as an internal or external command,
operable program or batch file.
process_begin: CreateProcess(NULL, pwd, …) failed.
process_begin: CreateProcess(NULL, pwd, …) failed.
FIND: Invalid switch
rm -f /src/dll.o /src/libdll.a
process_begin: CreateProcess(NULL, rm -f /src/dll.o /src/libdll.a, …) failed.
make (e=2): The system cannot find the file specified.
src/src.mk:14: recipe for target ‘clean-libdll’ failed
mingw32-make: *** [clean-libdll] Error 2

mingw32-make: *** [clean-libdll] Error 2

@csk it is the same error with and without build-wrapper. Please figure out how to build your project properly without build-wrapper.
Once you succeed add build-wrapper-win-x86-64.exe --out-dir bw_output before the working build command.

with out build wrapper iam able to build the code thier is no problem i use the commands like
mkdir build
cd build
cmake … -G “MinGW Makefiles”
this is with out build wrapper

with build wrapper i have used the command which you suggested as

build-wrapper-win-x86-64.exe --out-dir bw_output mingw32-make build.sh
then iam getting the error as like this;

process_begin: CreateProcess(NULL, pwd, …) failed.
-d was unexpected at this time.
‘PKG_CONFIG_PATH’ is not recognized as an internal or external command,
operable program or batch file.
process_begin: CreateProcess(NULL, pwd, …) failed.
process_begin: CreateProcess(NULL, pwd, …) failed.
FIND: Invalid switch
rm -f /src/dll.o /src/libdll.a
process_begin: CreateProcess(NULL, rm -f /src/dll.o /src/libdll.a, …) failed.
make (e=2): The system cannot find the file specified.
src/src.mk:14: recipe for target ‘clean-libdll’ failed
mingw32-make: *** [clean-libdll] Error 2

This command doesn’t build. It generates build files. It should be done as you usually do it.

What is build.sh? I never suggested that.

When I asked about the output of

mingw32-make clean all

without build-wrapper you sent me the same error that was shown with build-wrapper.

Again does mingw32-make clean all work by itself without build-wrapper? does it build your project?
If yes please share with me its output. If not please figure out the command that cleanly build your project.

Please take the time to read my answers and try them out before replying.

I apologise actually i tried with this command first build-wrapper-win-x86-64.exe --out-dir bw_output mingw32-make clean all

and later i tried another like this build-wrapper-win-x86-64.exe --out-dir bw_output mingw32-make build.sh

But for both i got the error like this
C:\C-Example-Project\c-example-project-master> build-wrapper-win-x86-64.exe --out-dir bw_output mingw32-make clean all

process_begin: CreateProcess(NULL, pwd, …) failed.
-d was unexpected at this time.
‘PKG_CONFIG_PATH’ is not recognized as an internal or external command,
operable program or batch file.
process_begin: CreateProcess(NULL, pwd, …) failed.
process_begin: CreateProcess(NULL, pwd, …) failed.
FIND: Invalid switch
rm -f /src/dll.o /src/libdll.a
process_begin: CreateProcess(NULL, rm -f /src/dll.o /src/libdll.a, …) failed.
make (e=2): The system cannot find the file specified.
src/src.mk:14: recipe for target ‘clean-libdll’ failed
mingw32-make: *** [clean-libdll] Error 2

can you pls provide me the solution which command should be used as soon as possible on high priority.