SonarScanner 4.6.2.2472
SonarQube: Developer Edition Version 9.3 (build 51899)
C compiler: arm-none-eabi-gcc and arm-linux-gnueabihf-gcc
After few successful analyses using build-wrapper + scanner I decided to switch to compile_commands.json (so the incremental builds would also be nicely analyzed).
I have a correct compilation database - I’ve checked the commands and they do work - but scanner fails and log is full of following messages
2022-03-04 17:36:08.543 WARN: Invalid probe found, skip analysis of files: [/home/jenkins/XXXXX.c]
2022-03-04 17:36:08.543 The compiler probe 'stdout' is expected to contain at least one '#define' directive:
2022-03-04 17:36:08.543
2022-03-04 17:36:08.543 WARN: Invalid probe found, skip analysis of files: [/home/jenkins/YYYYY.c]
2022-03-04 17:36:08.543 The compiler probe 'stdout' is expected to contain at least one '#define' directive:
2022-03-04 17:36:08.543
2022-03-04 17:36:08.543 WARN: Invalid probe found, skip analysis of files: [/home/jenkins/AAAAA.c]
2022-03-04 17:36:08.543 The compiler probe 'stdout' is expected to contain at least one '#define' directive:
and so on.
I’ve only added -Dsonar.cfamily.compile-commands=compile_commands.json in place of -Dsonar.cfamily.build-wrapper-output=sonar-output and kept all other options unchanged.
Scanner seemed to work fine with build-wrapper - issues were detected, files scanned etc.
I can revert back to build-wrapper, but switching to compilation database would greatly increase team productivity.
Which is still a little confusing, since arm-none-eabi-gcc should be in PATH… (double checked it by adding explicit call just beforre calling sonnar-scanner in the script)
seems that manually editing compile_commands.json to replace compiler name with complete path to the compiler helps… why sonar-scanner is not using PATH?