Build failed while Building target and dependencies in iOS projects

App downloads required dependencies by using CocoaPods and when SonarQube tries to build targets and dependencies build is getting failed

Run command is:
$HOME/.sonar/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir bw-output xcodebuild clean build -workspace App.xcworkspace -scheme “App scheme”

Error message:
/Users/runner/work/App Folder/App Folder/AppName/Pods/Target Support Files/Pods-App-target/Pods-App-Apptarget.debug.xcconfig:1:1: error: unable to open configuration settings file

Any lead would be appreciated.

Hello @rovins_singh ,

what version of SonarQube and build-wrapper are you using?

If you are facing issues with build-wrapper you could try the JSON Compilation Database. You can have a look at [CPP-3987] - Jira on how to use -gen-cdb-fragment-path to generate a JSON Compilation Database.

Running on sonar-scanner-cli- and build-wrapper-macosx-x86

Is there any way to scan Xcode project directly without building it?

No, there is no way.

Did you manage to use the JSON Compilation Database?

No, I had tried but didn’t get proper steps. Tried with CMake tool but compile_commands.json file is not getting generated in git repository.
If you know the steps, Please let me know

Thanks in advance.

If you have an Xcode project, how could you try with CMake?

In any case, CMake creates the compile_commands.json in the build folder.

Can we scan code without generating compile_commands.json file? Yes, I use XCode but i don’t see any way which can do this job.

Hi @rovins_singh ,

No, you cannot.

You can find information on how to generate the JSON compilation database in this ticket: [CPP-3987] - Jira . With:

# 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