"build-wrapper-dump.json" file was found but 0 C/C++/Objective-C files were analyzed

I am integrating sonarcloud with GitHub actions to scan my repo for objective-c, c and swift languages. But I got this error. I checked other posts but couldn’t find any solution. Please help me. Thanks in advance!
Here is my logs file for your review.

(logs removed)

java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:
INFO: ------------------------------------------------------------------------
  * 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
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:462)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:202)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:51)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:446)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:442)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:400)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:130)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
Error: Process completed with exit code 1.

Hi @Ferat-Imrak,

Build-wrapper wraps your build command and stores the commands of the files it compiles in the build-wrapper.json file.

The error you are facing means that we didn’t find any c/objc/c++ file indexed by the scanner with an entry in build-wrapper.json.

1- Is it the first time you have tried to analyze this project?
2- Does the command provided to build-wrapper compile the c/objc/c++ files in the scanned directories?
3- Do you see the files you want to analyze in the build-wrapper.json?

Please upload the scanner logs in verbose mode and the build-wrapper.json and .log files for further investigation. Let me know if you prefer to share them privately.

Thanks,

Hi @Abbas ,
Thanks for responding.

  1. yes this is first time analyzing the project.
  2. this is the command that i am using:
xcodebuild -project SfaraSDK-example/SfaraSDK-example.xcodeproj -scheme SfaraSDK-example -configuration Release clean build -arch arm64 BITCODE_GENERATION_MODE=bitcode ONLY_ACTIVE_ARCH=NO -sdk iphoneos BUILD_LIBRARIES_FOR_DISTRIBUTION=YES CODE_SIGNING_ALLOWED="NO" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS=""
  1. Honestly i started using sonarcloud recently and I am running it in GitHub actions. so i don’t know how to get build-wrapper.json from github.
    I would like to share them privately.

the xcodebuild command is running SfaraSDK-example/SfaraSDK-example.xcodeproj this directory as for project directory but objective-c files are in this directory SfaraSDK-example/SfaraSDK.xcframework
how can i scan the whole files and folders?

Can someone please help me with this issue? @ganncamp @Colin @Joe @JolyLoic @Abbas
I shared my logs file and if you need me to share more recourses for solving the issue pls let me know then i can share privately. Thanks in advance!

Hey there.

Please make sure to read our Community FAQ.

https://community.sonarsource.com/faq

Specifically it asks that you:

  • Do not bump topics after a day
  • Do not tag users in a thread who are not already engaged in a thread

If you cannot follow these rules, we will not be able to provide assistance.

1 Like

Ok thanks for letting me know about these rules. I didn’t know about them. Can someone help me pls? Abbas answered the issue over the weekend and i wasn’t working so I reply him as soon as i came back online on Monday.

The code that will be scanned is the code you mention in your sonar-project.properties file in the sonar.sources property.
If that helps, you can have a look at this sample project that uses xcode and github actions: GitHub - sonarsource-cfamily-examples/macos-xcode-gh-actions-sq: An example xcode configuration for C++ project on MacOS using GitHub Actions and analyzed on SonarQube

Hi Fred,

Thanks for responding. The code i mentioned in my sonar-project.properties is this:
sonar.sources=. which is the main directory. So it should scan whole project. And the project is mixed with objective-c and swift.

Any solution any idea? I tried to change sonar.source directory but it didn’t work. Also can someone remove the attachment log file that I shared please? I am conformable to having them online.

Hi @Ferat-Imrak,
Could you please share your whole sonar-project.properties and your build.yml? If you don’t want them to be visible publicly, you can send them to me via DM.
Also can you confirm that when you run the command that you shared earlier (xcodebuild -project SfaraSDK-example/SfaraSDK-example.xcodeproj -scheme SfaraSDK-example -configuration Release clean build -arch arm64 BITCODE_GENERATION_MODE=bitcode ONLY_ACTIVE_ARCH=NO -sdk iphoneos BUILD_LIBRARIES_FOR_DISTRIBUTION=YES CODE_SIGNING_ALLOWED="NO" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="") without the build-wrapper, it builds the whole project correctly?
Thanks

Hi Fred,

Thanks for responding. I found out it is not an Objective-c project. There are only one or two files has objective-c files that in framework headers and I used these sonarcloud properties to ignore cfiles:

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

So the CI with GitHub actions is working now.

Best,

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