Building both a library and a project that uses this library

Hello everyone,

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

SonarQube server 9.9.0.65466, SonarScanner 5.0.1.3006

  • how is SonarQube deployed: zip, Docker, Helm

Docker

  • what are you trying to achieve

When building both a library and a project that uses this library. Sonarqube fails its analysis saying that “0 compilation units analyzed”. (build 43)
We tried to not build the library and include the files of the library directly into the project and Sonarqube analysis works (build 42), it says “6 compilation units analyzed” (the lib is built out of these 6 files)

One clear difference we found is that in build #42, after “INFO: Loading cache from: server” sonarqube execute a command “DEBUG: Probing compiler” that is not present in build #43.
We tried changing the moment where the lib is built without success.

We think we probably need a way to tell SonarCube that a new scan is needed after the lib is built. On build #43, when it fails, the root cause is DEBUG: file xxx not marked as unchanged: file content changed. How could we trigger a new scan at this stage?

Thanks a lot :slight_smile:

Hi,

Welcome to the community!

I suppose we’re talking about C or C++ here? How are you providing build configuration?

 
Ann

Hello,

I suppose we’re talking about C or C++ here?

We are indeed talking about C code.

How are you providing [build configuration ]?

The build configuration is done through Build Wrapper and we execute through the command:
“build-wrapper-win-x86-64.exe --out-dir bw-output”

We have our sonar-project.properties file with below parameters:

sonar.projectKey=xxx
sonar.projectName=xxx
sonar.sourceEncoding=UTF-8

sonar.sources=xxx
sonar.exclusions=xxx
sonar.exclusions=xxx

sonar.cfamily.gcov.reportsPath=coverage-gcov
sonar.cfamily.build-wrapper-output=bw-output
sonar.cfamily.threads=8

sonar.host.url=xxx

So probably, Build Wrapper needs to be configured to understand our 2 steps process, but how?

Thanks,

Gregory

Hi Gregory,

I’m out of my depth at this point. I’m going to flag this for the language experts.

 
Ann

Hi @GregCris, and welcome to the community,

In order for me to track down the problem, could you share the build-wrapper-dump.json and the scanner logs for both runs?

I can also start a private thread with you if you would prefer not to share them publicly.

Best regards,
Michael

Hi Michael

Thanks a lot for your message.
Indeed, I would prefer a private thread to exchange the logs.
Can you create it?

Thanks,

Gregory