Scanning big projects built with yocto bitbake

Hi! Our company has an extra large C++ embedded project built with Bitbake on Jenkins. Also, we are using ccache mounted from NFS to speed up build. When nothing changes in source code and all entries are found in ccache, both build-wrapper dump and CMake compile commands are empty and no build commands can be captured. Clean build without ccache takes up to 12 hours! We want to run Sonarqube scanner on each periodic build and for PR. Waiting 12 hours for PR is too long)) What can you suggest to generate build wrapper output or compile commands each time?
Thank you!

Hey there.

This answer might be helpful.

Hi, Colin.
I saw this answer. It says about support of CCache during scan. Unfortunately, there is no described case when CCache is fully cover all files (no changes in source code, all entries are cached). In this case, compiler (may be) not executes any commands, so build wrapper and cmake compile_commands does not capture any build commands and they both are empty.
Full clean build will take up to 12 hours and there is no bitbake/cmake flag to execute compile command anyway if cache exists.
Could you, please improve build_wrapper functionality to capture compilation commands anyway if all cache is valid?

Hi @KovalovVladislav,

  • the compilation database is generated in the Generation step of CMake, not the build. So you can generate a new one each time and it should be quick and you don’t have to worry about the build time as you don’t have to execute the build.

  • For build-wrapper, also it should work even if Ccache is 100% hit. What version of SonarQube are you using? what version of build-wrapper? Did you have any run with build-wrapper not empty? the empty build-wrapper might not be related to Ccache.

Thanks,

Hi, Abbas,
Could you, please, provide command or tell me how to trigger generation step in CMake without build?
About build wrapper, issue was on sonarqube 9.4 and build-wrapper downloaded from sonarqube api. We have non empty build-wrapper output when cache hit is not 100%. Unfortunately, we can not reproduce this issue, because our sonarqube developer trial license expired and this issue blocks us from buying new one.
Thank you!

@KovalovVladislav,

  • If you have build-wrapper already downloaded you don’t need a license to experiment with it.
  • There might be another reason why it was empty, we have examples where we use ccache with 100% hit and it works.

Let’s focus on the compilation database because you have all the tools to test it directly and it should be quick since you don’t need a build:

look at the documentation section, you only have to do the Generate a Project Buildsystem section explained in the CMake doc.

Also, you can follow our example where we use a compilation database without building the project:

Thanks,

1 Like

Hi @KovalovVladislav, any update?

Hi, @Abbas.
We have asked our developers to write compilation database generator script for our environment. This task is in process. Thank you for help!
But I have another question about code duplication. We can close this ticket and I will open another, or we can continue discussion here. How it will be better for you?

Hi @KovalovVladislav, we prefer to keep it one topic per post. Feel free to create another post for your other questions.

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