which versions are you using
SonarQube-10.2.1.78527,
build-wrapper-macosx-x86,
sonar-scanner-5.0.1.3006-macosx,
M2 macOS sonoma 14.1.1
how is SonarQube deployed: GCP
what are you trying to achieve
Execute analysis by sonarscanner and send the analysis results to sonarqube, which is located on GCP.
what have you tried so far to achieve this
Verify that the clean build succeeds with the command “xcodebuild -workspace ** -scheme **”.
But that the command “build-wrapper-macosx-x86 --out-dir build_wrapper_output_directory xcodebuild -workspace ** -scheme **” and "sonar-scanner
-Dsonar **"gets the following error and ends in analysis failure.
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
INFO: 0/1172 files marked as unchanged
INFO: Cache: 0/0 hits, 125 bytes
INFO: 0 compilation units analyzed
DEBUG: the bridge server will shutdown
DEBUG: the bridge server closed
INFO: Time spent writing ucfgs 6ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:40.127s
INFO: Final Memory: 59M/234M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found empty. Please make sure that:
* you are using the latest version of the build-wrapper and the CFamily analyzer
* your compiler is supported
* you are wrapping your build correctly
* you are wrapping a full/clean build
* if you are building your project inside a Docker container, build-wrapper is wrapping the build process inside the container and not wrapping the external Docker process
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:602)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:241)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64)
at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:398)
at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:394)
at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:363)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:139)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
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 jdk.proxy1/jdk.proxy1.$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:126)
at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
at org.sonarsource.scanner.cli.Main.main(Main.java:62)
It doesn’t look like xcodebuild is doing all that much (like compiling code). Do you expect to analyze C/C++/Objective-C files, or, for example, only Swift files (in which case the build wrapper is not needed)?
to sum up our private conversation, the build-wrapper is not able to capture the compiler invocations from Xcode 15, I created a ticket for that: [CPP-4941] - Jira.
We plan to solve that throughout the year. In the meantime, the compilation database can be used to run the analysis, instructions provided in the ticket.
For more information about the compilation database, please refer to the SonarQube documentation:
If you didn’t see – last year we introduced support in SonarQube Server for a feature called C/C++ AutoConfig! Removing the question of using a compilation database altogether.
This is available in SonarQube Server v10.6+, although you should really target at least v2025.1.
All said, you can continue to reference the workaround in the ticket Massimo mentioned.