iPhone app github workflow scan failing with "file used during build doesn't exist"

Template for a good new topic, formatted with Markdown:

  • ALM used: GitHub

  • CI system used: GitHub Actions

  • Scanner command used when applicable (private details masked):

        sonar-scanner --define sonar.host.url=${{ env.SONAR_SERVER_URL }} \
                      --define sonar.cfamily.build-wrapper-output=${{ env.BUILD_WRAPPER_OUT_DIR }} \
                      --define sonar.sources=. \
                      --define sonar.organization=******* \
                      --define sonar.projectKey=******** \
    
  • Languages of the repository

ObjectiveC and Swift

  • Project is private
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:28.644s
ERROR: Error during SonarScanner execution
INFO: Final Memory: 55M/187M
java.lang.IllegalStateException: "filename-redacted" file used during build doesn't exist, please make sure you are not cleaning build files before launching the analysis. The missing file: /Users/runner/Library/Developer/Xcode/DerivedData/redacted-fvzwvsgabpwyfhcyquokrniiokpe/Build/Intermediates.noindex/Pods.build/Release-iphoneos/pop.build/all-product-headers.yaml
INFO: ------------------------------------------------------------------------
	at com.sonar.cpp.analyzer.ClangDriver.onCapture(ClangDriver.java:153)
	at com.sonar.cpp.analyzer.CompilerDrivers.onCapture(CompilerDrivers.java:35)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$12(CFamilySensor.java:643)
	at com.sonar.cpp.plugin.BuildWrapperJsonReader.readCaptures(BuildWrapperJsonReader.java:87)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:640)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:411)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:190)
	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:128)
	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.
  • Steps to reproduce

Use the build.yml code provided for C, C++ or ObjC on MacOS
Build command is as follows:

build-wrapper-macosx-x86 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} xcodebuild CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO -allowProvisioningUpdates -scheme redacted_Prod -workspace redacted.xcworkspace build clean
  • Potential workaround

None. I’ve been trying to get this working for a long time - keep coming back to it - I hope there is something very simple that I’m missing…

Thank you in advance for any/all help

Best,
RJ

I think I’ve solved my own question: I removed “clean” from the build command it it seems to be working now.