Integrate SonarQube with your AI agent, scan for secrets and dependency risks, and explore and manage issues—all from the command line.
Start using SonarQube CLI
SonarCloud used within Bitbucket. Problem reproduced on local linux system. build-wrapper-linux-x86-64 doesn’t output valid build-wrapper-dump.json but build-wrapper.log appears to be populated correctly.
sonar-scanner debug (-X) output:
you are using the latest version of the build-wrapper and the CFamily analyzer
build-wrapper-linux-x86-64 version 6.29
your compiler is supported
GCC/G++: arm-none-eabi-gcc and arm-none-eabi-g++
you are wrapping your build correctly
build-wrapper.log is 19M, data appears valid, ends with “returned with code: 0”
you are wrapping a full/clean build
Confirmed, clean build. Freshly cloned git repository, then python script runs cmake and “ninja -v”. Tried single thread “-j1” and multithread, both result in same, mostly empty “build-wrapper-dump.json” file.
if you are building your project inside a Docker container, build-wrapper is wrapping the build process inside the container and not wrapping the external Docker process
using Bitbucket pipelines script provided by SonarCloud.io signup, with updated build-wrapper-linux-x86-64 line:
More details on this topic and request for documentation update.
There is a bug in Sonar’s linux build-wrapper executable. I got to the point of running strace and realized any tool being paid for shouldn’t be this hard to integrate. I had to work around build-wrapper by using a cmake compilation database flag “-DCMAKE_EXPORT_COMPILE_COMMANDS=ON”.
For CMake based builds, using Sonar’s build-wrapper is completely unnecessary and just adds more complexity and time to the analysis. It has to be downloaded, decompressed, run and troubleshot. When using cmake, you just add a single command line option and point to the output file.
I strongly suggest the documentation for C/C++ analysis be changed at: C/C++/Objective-C | SonarCloud Docs “The general recommendation is to use Build Wrapper unless you have a good reason not to.” I trusted this statement and wasted 2 days getting the build to work. I only made progress when not using the build-wrapper. Adding something about cmake builds using the flag listed above will save people time.
Sorry I missed your post due to the missing CFamily tag.
I’m sorry you had a bad experience with build-wrapper. Our recommendation is based on the safer choice based on the experience of most of our users.
Build-wrapper has limitations. Same for the compilation database. and you probably hit one of the limitations. you have a look at this blog post for more insight.
I will have to investigate further if you are interested to see why it is not working for you. For example, build-wrapper cannot track your build command if you are executing it in sudo mode. were you doing that?
there is already a direct link to the CMake page that tells you how to generate a Compilation database when using CMake:
It can be generated by tools like [CMake] It can be generated by tools like CMake
Build-wrapper has limitations. Same for the compilation database. and you probably hit one of the limitations. you have a look at this blog post for more insight.