Cfamily build-wrapper NOT support probing android prebuilts style clang toolchain

cfamily build-wrapper NOT support probing android prebuilts style clang toolchain:
build-wrapper-dump.json NOT captures any compiler

  • versions used (SonarQube 8.9 LTS, Scanner 4.6.2)
  • error observed (android aosp clang toolchain also wrap of clang.real, and real call flow is clang=>clang.real=>clang-11)
/prebuilts/clang/host/linux-x86/clang-r383902b/bin$ ll clang*
clang-cl -> clang*
clang.real -> clang-11*
clang++.real -> clang.real*
  • potential workaround (very clear, NOT wrap clang.real, make clang is real clang-11)
cp clang-11 clang

P.S.: i do NOT know build-wrapper rule how to probing compiler, whether make this rule configurable, now build-wrapper ONLY support one param --out-dir

$ build-wrapper --help
build-wrapper, version 6.20 (linux-x86)
Copyright (C) 2014-2021 SonarSource SA,
Usage: build-wrapper --out-dir <output directory> <build command>

Hi @lcttmc ,

for your use case, I invite you to use the JSON Compilation Database as a configuration for the analysis. If you can use SonarQube > 8.9 LTS you have the support by default. If you have to stay to 8.9 you can use the workaround described in CPP-1428.

hi @lcttmc
out of curiosity, how did you fixed your issue?
I’m trying to perform a sonarqube analysis using build-wrapper on a AOSP build, but it is not capturing all the clang commands.
I’ll try your workaround, but in case you found a less invasive solution, could you please share it?
Thanks in advance

Hi @scm_invn ,

you can use soong feature to generate a compilation database and configure the analysis to use the compilation database.

we are using 8.9 LTS, is it still an option? Or do we have to somehow use the workaround described in CPP-1428?

Hi @scm_invn ,

to use the compilation database is 8.9 LTS, you indeed need to use the workaround described in [CPP-1428] Add support for JSON Compilation Database - SonarSource.