Running SonnarScanner for a C++ project on windows. It uses bazel for compilation .
This is the command for build:
build-wrapper-win-x86-64.exe --out-dir C:\sonartools\buildwrapper-ouput bazel --batch build --spawn_strategy=standalone --genrule_strategy=standalone //source/ztna/ZtnaAgentLib/…
this is the command for analysis:
content of the file
It creates the analysis json file, detail is attached but the analysis is failing with the error below
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
attaching the zip file for details.
sonarscannererror.zip (72.0 KB)
Appreciate any help here
Welcome to the community!
This thread may help:
indeed you are right, checking new bazel version the options should be as follow:
build-wrapper-linux-x86-64 --out-dir sonar-dir bazel --batch build --spawn_strategy=standalone --genrule_strategy=standalone //...
spawn_strategy and genrule_strategy should come after build. Could you please confirm it works? I am going to update the documentation.
The same arguments as above are passed for building and json file creation is fine. Scanning is failing.
We use a test license for sonar server, is that an issue ?
Any update here ?
Any suggestion or alternative we can try from our end ?
From which directory are you running the scanner? it should be run from a directory that contains the file that you are building with build-wrapper.
Why are you adding this? can you remove it?
What compiler are you using?
standalone is deprecated, try to use local instead
If the analysis is still failing after applying all the suggestions, Can you share your build-wrapper JSON and log files in addition to the scanner output in verbose mode. I can send you a private message if you prefer to send them privately.
Have tried with above suggested options , but still I see the same error.
Please send me a private message to shared the requested data privately.
Thanks for the log.
Before I give it a deeper look can you try on the latest LTS: SonarQube 8.9.8 LTS.
We fixed similar issues on that version and it might work for you.
Let me know if you still face the issue after.
A post was split to a new topic:
Setup analysis of bazel project
Were you able to try with the latest release?