SonarQube buildwrapper on xcodebuild command fails to produce any useful input

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension)
  • how is SonarQube deployed: zip, Docker, Helm
  • what are you trying to achieve
  • what have you tried so far to achieve this

Using SonarQube Server Developer Edition
v2025.1.1 (104738), I’m trying to analyse a code base of Objective C and Swift, using build-wrapper as follows :

./build-wrapper/build-wrapper-macosx-x86 --out-dir ${BUILD_WRAPPER_OUT_DIR} xcodebuild -allowProvisioningUpdates -project $CURRENT_PROJECT -scheme $CURRENT_APP

But no files are analysed. My problem seems to be similar to the one described here :

As I obviously don’t have access to your Jira, I can’t tell if the ticket mentioned in the replies is still current. Any suggestions on how to proceed ?

Hey there.

That Jira project was supposed to be public. We’re chasing down what happened internally!

In the meantime – yes, that ticket is still open. The workaround documented in the ticket is as follows:

Workarounds

Use the JSON Compilation Database:

* To generate a Compilation Database use Clang compiler feature to generate partial compilation database files and aggregate them. You need to set -gen-cdb-fragment-path on OTHER_CFLAGS of xcodebuild command line:

# add to your xcodebuild command: OTHER_CFLAGS="\$(inherited) -gen-cdb-fragment-path \$(PROJECT_DIR)/CompilationDatabase"
xcodebuild clean build arg1 .. argN OTHER_CFLAGS="\$(inherited) -gen-cdb-fragment-path \$(PROJECT_DIR)/CompilationDatabase"
pushd CompilationDatabase
sed -e '1s/^/[\'$'\n''/' -e '$s/,$/\'$'\n'']/' *.json > ../compile_commands.json
popd
  • Then properly set the sonar.cfamily.compile-commands property to point to the generated compile_commands.json.

Or disable SIP.

Take note that using SonarQube Server v2025.1, you can take advantage of C/C++ AutoConfig and stop using the build wrapper entirely, if it’s inconvenient.

Building the compilation database this was worked perfectly, thank you very much for your help.

1 Like

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