Issue with Build wrapper in Windows

ERROR: Error during SonarQube Scanner 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 SonarCFamily 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
    at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:357)
    at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:386)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:382)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:351)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
    at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
    ERROR:
    ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Yes,

  • we use the latest wrapper and plugin,
  • we wrap correctly,
  • we make a full clean build,
  • paths are correct …

We need to fix this asap. So, can you please help us?

Hello @tkatta,

Can you share the build-wrapper log and .json files and the output of the scanner in debug mode? Let me know if you prefer to share them privately.

Yes, i would like to send a Private message. Can you send me the link for it?

@Abbas

Hi, are you able to receive the logs? Triveni is still stuck.
Thank you

Hello @Sara_Roche,

Yes I received the logs and I noticed that the scanner was configured incorrectly.
I asked Triveni four days ago to change two options in the sonar-scanner.properties file, but I still didn’t get any reply.

Triveni should replace these two options:

sonar.projectBaseDir=C:/Cheetah_Slave/workspace/cheetah_lam2bt_fw_bld/apps_3425d_headset_fwb1_118.0.41/ovl/ovl_a2dp_sbc/

sonar.sources=C:/Cheetah_Slave/workspace/cheetah_lam2bt_fw_bld/apps_3425d_headset_fwb1_118.0.41/ovl/ovl_a2dp_sbc/

by only:

sonar.sources= .

@tkatta any update on that? Did fixing sonar-scanner.properties fix the issue?

Thank you @Abbas!!!

Hi Sarah,

Thank you so much for your immediate reply. I really appreciate that.
For some reason, I didn’t receive notifications to my email for Abbas reply earlier. He is helping me now. But it’s still failing. Ive also asked him to connect remotely so that it can be resolved asap. Am also wanted to check wit you, is there anyway to connect remotely to my system?

Thank you

Hello @tkatta,

No we cannot connect remotely. The problem is identified. Please follow my instructions and it is going to be fixed…

@Sara_Roche Hi Sarah,

Still it’s taking long time to fix the issue. It’s been almost a month I’m struggling with this issue. Please try to find a way to fix this ASAP. Otherwise I’ve to cancel my license. It’s not my decision. It’s management decision. I hope you can understand. It won’t help if still talk through messages unless Abbas connect to my system remotely.

Thank you.

Hello @tkatta,

I would strongly suggest that you read the documentation carefully before trying to fix the issue. From what I saw, you are trying to make it work without reading. Please go through these two links:

Before you continue, please make sure that you have read the documentation. It will not work if you don’t read them and I will not be able to help you.

These are the things that you are doing wrong:

1- From the screenshot you sent, Build-wrapper is failing:
image
you shouldn’t download visual studio if you don’t usually use it to build. build-wrapper is just a wrapper around your build.

  • You have to pass as an argument your usual clean build command.
build-wrapper-win-x86-64.exe --out-dir  build_wrapper_output_directory *your clean build command*
  • You have to run build-wrapper-win-x86-64.exe from the directory where you usually build, not from the build-wrapper directory.

If build-wrapper succeed it should generate a .json file that you can find in build_wrapper_output_directory.

Don’t continue to the next part unless build-wrapper succeed.

2- The second issue is that you are not passing the correct configuration file to the scanner. you are modifying one file and passing another one(the unmodified one).
The scanner is reading C:\Cheetah_Slave\sonar-scanner-4.2.0.1873-windows\bin…\conf\sonar-scanner.properties
you are modifying the one you created in the build-wrapper directory:
image
Please modify the right file. When you run the scanner you can explicitly specify the config file you want to use:

sonar-scanner -Dproject.settings= *your config file"

Let me know if the analysis still fails after fixing the build-wrapper and the scanner.

Thanks,

@Abbas, Sure Abbas. Actually I’m following the same documentation. But I will ready again and see where I’m doing wrong.

Thank you.

@Abbas I did exactly as you instructed. I copied the “build-wrapper-win-x86-64.exe” in the folder where I am building the code and I ran this command there

build-wrapper-win-x86-64.exe --out-dir bw-output gmake

And it generated a “build-wrapper-dump” file which is around 7MB
Then I ran the “sonar-scanner” from the same directory and it picked up the sonar-scanner.properties from Scanner configuration file: C:\Cheetah_Slave\sonar-scanner-4.2.0.1873-windows\bin..\conf\sonar-scanner.properties
And here is my config

sonar.host.url={host_name}
sonar.projectKey=cheetah_lam2bt_fw
sonar.projectName=cheetah_lam2bt_fw
sonar.projectVersion=1.0
sonar.sources=.
sonar.cfamily.build-wrapper-output=C:/Cheetah_Slave/workspace/cheetah_lam2bt_fw_bld/apps_3425d_headset_fwb1_118.0.49/apps/av3425d_headset/bw-output
sonar.sourceEncoding=UTF-8
#sonar.cfamily.cache.enabled=true
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8

But I am still seeing the same issue. Here’s the log log.txt (464.1 KB)

Let me know if you need any additional information but at this point am not sure what else needs to be done

BTW, I uninstalled Visual Studio, if that matters

@tkatta,

Thanks for following the documentation. Everything is configured correctly now.

Now that you are running build-wrapper correctly, I can see that you are using MetaWare as a compiler.
Unfortunately, this is not one of the compilers we support. The supported compilers are listed here.

Thanks,

Hi Sonar Team,

I am facing similar issues, i have gone through your above discussions, but have been able to generate build_Wrapper.json files but sonar-scanner throwing out errors.
Can you please help.
NOTE:SAME Error as Treveni shared. I am tryning QNX based code and have 8.4 evaluation link
If you need log file help me where will it present so that i can share you privately.
Sonar Server used 8.2

-Thanks
KV

Dear Sonar Team,

This is really urgent and a blocker for us, can you please help us quickly.

-Regards
KV

Hi Team,

The below is the error i see when i ran sonar server(Version 8.1)
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console…
wrapper | <-- Wrapper Stopped

Please help resolving

Hello @K_V,
Please create another post describing in details the problem you are facing so that the right person can answer you.

you seem to be facing a different issue than the main post