Build-wrapper doesn't record all compiled files, sometimes zero

I am running on Windows 10, build-wrapper 6.20.3, using C++ with Visual Studio 2022. I call build_wrapper like this in the project root:

build-wrapper-win-x86-64.exe --out-dir bw_outputs cmake --build build --target package

I don’t clean the build directory every time because then the builds take too long. Now, sometimes the build-wrapper-dump.json contains 0 cpp files, sometimes a few, sometimes many. My last build had more than 200 compiled cpp files and 3 ended up in build-wrapper-dump.json.

How can I debug this and what could be the problem?

Also, my assumption is that build-wrapper is not reading any Sonar config files, like, and is therefore independent of Sonar. In other words, the problem can be isolated to build-wrapper - correct?


Welcome to the community!

I think this is your problem. The docs are pretty clear that you need to do a full build each time.


Hello @michael-brade,

If you think the full build is taking too long for you, there are a few options, none of which is as easy as doing the full build… Which one is best depends of your build system:

  • You can do a full build but then use a tool like ccache that will reuse previous build results to make this full build as fast as if it was incremental
  • If you can generate a compilation database without building your code, you can use this compilation database instead of the build wrapper as an input to the analysis
  • If you know that your build configuration is identical between two builds (same input files, build in the same folders, with the same options…), you can reuse the build-wrapper between builds. But you’re on your own to detect when that ceases to be true and you have to run a full build.

Hope this helps,

thank you! We were already using sccache, so I went with the compilation database (which I like much more than the build_wrapper approach) and so far it works without problems :smile:

Thank you for letting us know! I’m glad it works for you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.