Sonarscan with qmake project


I want to use Sonarcloud with a Qt project for an embedded system based on the imx6dl CPU (ARMv7 architecture). I created a custom docker image with the build environment all setup up and building works just flawlessly. Problem start occuring when using the bitbucket pipe for sonar-scan.

Details of the project:

  • ALM used: Bitbucket Cloud
  • CI system used: Bitbucket Cloud
  • Pipeline script:
    • qmake && build-wrapper-linux-x86-64 --out-dir bw_output make -j8
    • pipe: sonarsource/sonarcloud-scan:1.1.0
      DEBUG: ‘true’
      EXTRA_ARGS: ‘“bw_output” -Dsonar.cfamily.threads=8 -Dsonar.cfamily.cache.enabled=false’
  • Languages of the repository: C++ with Qt
  • Error observed:
    The build-wrapper.json contains valid output captured by the make command, as far as I can tell:
    “compiler”: “clang”,
    “cwd”: “/opt/atlassian/pipelines/agent/build//src/vplayer",
    “executable”: "/opt/sdk/latest/sysroots/x86_64-sdk-linux/usr/bin/arm--linux-gnueabi/arm-
    “cmd”: [

However in the build.log for the pipe I get those kinds of errors (Only copied one, repeats for all files of the project):
12:07:47.536 INFO: Cache is explicitly disabled: Optional[false]
12:07:47.566 DEBUG: Probing compiler: [/opt/sdk/latest/sysroots/x86_64-sdk-linux/usr/bin/arm--linux-gnueabi/arm--linux-gnueabi-g++, -x, c++, --std, gnu++11, -mcpu=cortex-a9, --sysroot=/opt/sdk/latest/sysroots/cortexa9hf-neon--linux-gnueabi, -marm, -v, -dM, -E, -]
12:07:47.590 DEBUG: stdout:

12:07:47.599 WARN: Invalid probe found, skip analysis of files: [/opt/atlassian/pipelines/agent/build/*******/src/vplayer/*******_avsync_server.cpp]
The compiler probe 'stdout' is expected to contain at least one '#define' directive:

12:07:47.700 INFO: Subprocess(es) done in 164ms
12:07:47.700 INFO: 0 compilation units analyzed
12:07:47.727 INFO: ------------------------------------------------------------------------
12:07:47.728 INFO: ------------------------------------------------------------------------
12:07:47.729 INFO: Total time: 49.615s
12:07:47.806 INFO: Final Memory: 30M/128M
12:07:47.807 INFO: ------------------------------------------------------------------------
12:07:47.807 ERROR: Error during SonarQube Scanner execution
12:07:47.807 ERROR: The "build-wrapper-dump.json" file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:
  * you are using the latest version of the build-wrapper and the CFamily analyzer
  * you are correctly invoking the scanner with correct configuration
  * your compiler is supported
  * you are wrapping your build correctly
  * you are wrapping a full/clean build
  * you are providing the path to the correct build-wrapper output directory
  * you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps
  • Steps to reproduce:
    Try to cross compile a qmake project with an arm-gnueabi toolchain.

Hi @Faxe,

Sonarcloud pipe runs in a docker container, this is not compatible with C/C++ analyzer, the analysis should be ran at the same OS layer.

Yep they do in the same script

Hi @Faxe,

sonarcloud-scan pipe runs in a docker container, ie see!/results/152, you can see it in the logs of pipe: sonarsource/sonarcloud-scan:0.1.5. For C/C++ analysis the sonar-scanner should be ran at the same OS/container layer of the build, you should set it up manually without the use of pipe: sonarsource/sonarcloud-scan.

1 Like

I just tried it using the manual scanner in the pipeline, it works :smiley: . Thanks a lot, I have been trying to fix this the last two days.

1 Like

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