The "build-wrapper-dump.json" file was found but 0 C/C++/Objective-C files were analyzed

I can successfully analyze my project on a local system, but when trying to move it to Gitlab CI I get: “The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed” error.

Locally I use:
sonar-scanner-4.2.0.1873-windows
SonarQube server Developer Edition Version 8.0 (build 29455) - this is a production server
build-wrapper-win-x86-64.exe Version 6.4 - downloaded from the server above

using this setup I can successfully run build-wrapper, get build-wrapper-dump.json and have it analyzed by sonar-scanner and uploaded to SonarQube

Now my Gitlab setup looks like this:

First system (Windows gitlab-runner):
build-wrapper-win-x86-64.exe Version 6.4 - downloaded from the server above

this system can also successfully generate build-wrapper-dump.json. This happens on Windows because the compiler/IDE that we use only exists for Windows.

Second system (Docker):
SonarQube Scanner 4.2.0.1873 running in Docker container (official sonarsource/sonar-scanner-cli Docker image) that is hosted on Ubuntu

It can successfully connect to SonarQube server but gives me the error “The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed”

My assumption is that build-wrapper and sonar-scanner can only work in the same environment, maybe because build-wrapper-dump.json contains absolute paths that point to some files available on Windows, but not in Linux/Docker.

Should it be possible to make it work in such configuration or is it unsupported?

Hi @kadim,

Yes, build and analysis should be done on the same environment, during analysis we need to access the same files used during build in order to get you accurate analysis.

It is not possible, this is unsupported.