C++/Objective-C sonar scan problem

Hi, I have problems with analysing C++/Objective-C project with sonar-scaner

ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: 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

Can you help with this, I can also provide with build-wrapper.log or build-wrapper-dump.json. Thanks in advance !

Welcome to the community @pavin117!

The issue you are facing is most likely caused by the configuration problem. For analysis to work correctly, you need to provide the information about build of the project to the scanner. This information can be presented either as:

  • build-wrapper output - generated by wrapping your build by build-wrapper
  • compilation database

If you are using build wrapper, please make sure that the same directory is passed as --out-dir to build-wrapper invocation sonar.cfamily.build-wrapper-output to sonnar-scanner. Note that this two invocation needs to be performed on same machine.

For more details, please refer to online SonarQube docs.

Hi @Tomasz_Kaminski

I have provided everything needed from the documentation, this is my sonar-project.properties file


and the build-wrapper :

build-wrapper-macosx-x86 --out-dir $WORKSPACE/sq_wrapper /usr/bin/xcodebuild -workspace "my.xcworkspace" -scheme my -configuration release -sdk iphoneos  \
							PROVISIONING_PROFILE_SPECIFIER=my $license Enterprise" \
							BUILD_ID="$buildId" \
							BUILD_TITLE="$buildTitle" \
							BUILD_VERSION="$buildVer" \
							BUILD_CODE="$buildNum" \
							BUILD_COMMIT="$buildCommit" \
					-archivePath "$targetDir"/"$artifact"/"$artifact".xcarchive clean archive

the build command is part of a bash script.

I misinterpreted the error in your first message, the build-wrapper-dump.json was found in your case (it means that the configuration was right), but it was essentially empty. Please accepts my apologies for the confusion.

They may be multiple reasons for the empty build wrapper, and for further investigation, it would be best if you could share the content of the build wrapper output directory ($WORKSPACE/sq_wrapper). If you are not comfortable sharing it publicly, let us know, and we’ll send you a private message that will allow you to send it privately.

Finally, as this is C++/Objective-C++ project, do you use macOS with Apple Silicon hardware (ARM architecture) for the build? In such a case, you need to use a compilation database.

This is the architecture for the mac:

machdep.cpu.brand_string: Intel(R) Xeon(R) W-3275M CPU @ 2.50GHz

Regarding the sq_wrapper directory and its files - yes, if you can send me a private message I will share it with you. Thanks !

I checked the output of the build-wrapper, and for the xcodebode build, we capture only commands to build set of swift files using , and includes (if I understand correctly) some Objective-C headers. We currently support analysis for the project that compiles C/Objective-C/C++ files and we analyze headers that are included in them.
Could you please validate that provided command is compiling some C++/Objective-C sources? One way would be to temporarily modify one such file to cause a compilation error and see if the build failed.

Also, I have noticed that you are using the following setting in the properties:


This one is used by a third-party plugin and we do not recognize it.

I wrote to the developers using this command - they said that it does compile the code when looking at the output of the command:

CompileC /Users/jenkins/Library/Developer/Xcode/DerivedData/Project-dvamnhvicvcntbbcqaqmxzsiqcdy/Build/Intermediates.noindex/ArchiveIntermediates/Project/IntermediateBuildFilesPath/aaaaaa.build/Release-iphoneos/aaaaaa.build/Objects-normal/arm64/CocosLogger.o /Volumes/bigdisk0/builds/workspace/Mobile/ProjectTC_SQ1/platform/modules/client_shared/cocos/CocosLogger.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'aaaaaa' from project 'aaaaaa')
cd /Volumes/bigdisk0/builds/workspace/Mobile/ProjectTC_SQ1/platform/ios/platform/aaaaaa
export LANG\=en_US.US-ASCII

Also I did remove:


but same behaviour. Could it be because we use -workspace "my.xcworkspace" ?

Could you alos share (privately on the same thread), the output produced to the console of your build command (with build-wrapper):

build-wrapper-macosx-x86 --out-dir $WORKSPACE/sq_wrapper /usr/bin/xcodebuild -workspace "my.xcworkspace" -scheme my -configuration release -sdk iphoneos  \
							PROVISIONING_PROFILE_SPECIFIER=my $license Enterprise" \
							BUILD_ID="$buildId" \
							BUILD_TITLE="$buildTitle" \
							BUILD_VERSION="$buildVer" \
							BUILD_CODE="$buildNum" \
							BUILD_COMMIT="$buildCommit" \
					-archivePath "$targetDir"/"$artifact"/"$artifact".xcarchive clean archive
1 Like

I have noticed that the CompileC entries in your build output use ccache-clang to build a process file (it is on the last line on each entry). Could you please try to configure the build to use plain clang instead of cache-clang and see if that fixed the issue?

Also, if you could provide more information on what ccache-clang is doing, that would be helpfull.

The purpose of clang-ccache is to speed up recompilation by caching previous compilations and detecting when the same compilation is being done again. Unfortunatelly switching to plain clang did not resolve the issue, It is sitll giving the same error as before.

Could you share the build-wrapper log and JSON file from the build that uses plain clang in the private thread? I mean the results for invoking build-wrapper on a clean build, that just invokes clang.

Hi @pavin117 ,

sorry for the delay, I’ll follow up on your topic.

I would like you to do 2 tests:

  • run build-wrapper-macosx-x86 --out-dir $WORKSPACE/sq_wrapper /usr/bin/xcodebuild ... clean archive without ccache-clang. Can you confirm it is working without your ccache-clang interception? I would like to clarify that before going further with the investigation
  • run
    touch main.c
    build-wrapper-macosx-x86 --out-dir $WORKSPACE/sq_wrapper_2 path/to/ccache-clang -c main.c
    and share sq_wrapper_2 folder