The “build-wrapper-dump.json” file was found empty with xcodebuild

Must-share information (formatted with Markdown):

  • 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)

Hey there.

It sounds like you have the process right. Can you zip up your build-wrapper output directory and share it?

1 Like

Thanks for your help.
The build-wrapper output directory contains two files.Personal data are Masked.
build-wrapper-dump/json

{
"version":"6.48.1",
"captures":[
]}

build-wrapper.log

***00:18 2023: build-wrapper, version 6.48.1 (macosx-x86)
***00:18 2023: System name: Darwin Nodename: ***.local Release: 23.1.0 Version: Darwin Kernel Version 23.1.0: Mon Oct  9 21:28:31 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8112 Machine: x86_64
***00:18 2023: socket path: /tmp/build-wrapper-socket.qutP2k
***00:18 2023: dynamic library found: ****/build-wrapper-macosx-x86/libinterceptor.dylib
***00:18 2023: cwd: <***>
***00:18 2023: command executed as: <build-wrapper-macosx-x86 --out-dir build_wrapper_output_directory>
***00:18 2023: out-dir absolute path: <***/build_wrapper_output_directory>
***00:18 2023: command line received: <xcodebuild -destination generic/platform=iOS -workspace ***.xcworkspace -scheme *** CODE_SIGN_STYLE=Manual PRODUCT_BUNDLE_IDENTIFIER=*** IPHONEOS_DEPLOYMENT_TARGET=12.0 DEVELOPMENT_TEAM=*** CODE_SIGN_IDENTITY=*** PROVISIONING_PROFILE_SPECIFIER=*** clean build>
***00:18 2023: env 0: <MANPATH=/opt/homebrew/share/man::>
***00:18 2023: env 1: <TERM_PROGRAM=Apple_Terminal>
***00:18 2023: env 2: <PYENV_ROOT=***/.pyenv>
***00:18 2023: env 3: <TERM=xterm-256color>
***00:18 2023: env 4: <SHELL=/bin/zsh>
***00:18 2023: env 5: <HOMEBREW_REPOSITORY=/opt/homebrew>
***00:18 2023: env 6: <TMPDIR=/var/folders/gc/c5r9bdz50jn63gvjxsx3xbch0000gn/T/>
***00:18 2023: env 7: <CONDA_SHLVL=1>
***00:18 2023: env 8: <CONDA_PROMPT_MODIFIER=(base) >
***00:18 2023: env 9: <TERM_PROGRAM_VERSION=452>
***00:18 2023: env 10: <OLDPWD=***/cicd>
***00:18 2023: env 11: <TERM_SESSION_ID=***>
***00:18 2023: env 12: <USER=***>
***00:18 2023: env 13: <CONDA_EXE=***/anaconda3/bin/conda>
***00:18 2023: env 14: <SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.aWadcIqNo9/Listeners>
***00:18 2023: env 15: <_CE_CONDA=>
***00:18 2023: env 16: <PATH=***/anaconda3/bin:***/anaconda3/condabin:***/.rbenv/shims:***/.rbenv/bin:***/.pyenv/shims:***/.pyenv/bin:***/.pyenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:***/cicd/sonar-scanner-5.0.1.3006-macosx/bin:***/cicd/build-wrapper-macosx-x86>
***00:18 2023: env 17: <CONDA_PREFIX=***/anaconda3>
***00:18 2023: env 18: <__CFBundleIdentifier=com.apple.Terminal>
***00:18 2023: env 19: <PWD=***>
***00:18 2023: env 20: <LANG=ja_JP.UTF-8>
***00:18 2023: env 21: <XPC_FLAGS=0x0>
***00:18 2023: env 22: <RBENV_SHELL=zsh>
***00:18 2023: env 23: <_CE_M=>
***00:18 2023: env 24: <XPC_SERVICE_NAME=0>
***00:18 2023: env 25: <PYENV_SHELL=zsh>
***00:18 2023: env 26: <HOME=***>
***00:18 2023: env 27: <SHLVL=2>
***00:18 2023: env 28: <HOMEBREW_PREFIX=/opt/homebrew>
***00:18 2023: env 29: <CONDA_PYTHON_EXE=***/anaconda3/bin/python>
***00:18 2023: env 30: <LOGNAME=***>
***00:18 2023: env 31: <CONDA_DEFAULT_ENV=base>
***00:18 2023: env 32: <INFOPATH=/opt/homebrew/share/info:>
***00:18 2023: env 33: <HOMEBREW_CELLAR=/opt/homebrew/Cellar>
***00:18 2023: env 34: <_=***/build-wrapper-macosx-x86/build-wrapper-macosx-x86>
***00:18 2023: executing: <xcodebuild -destination generic/platform=iOS -workspace ***.xcworkspace -scheme *** CODE_SIGN_STYLE=Manual PRODUCT_BUNDLE_IDENTIFIER=*** IPHONEOS_DEPLOYMENT_TARGET=12.0 DEVELOPMENT_TEAM=*** CODE_SIGN_IDENTITY=*** PROVISIONING_PROFILE_SPECIFIER=*** clean build>
***00:18 2023: initializing json file
***00:18 2023: process created with pid: 77056
***00:18 2023: parent pid: 77054
***00:18 2023: working directory: <***>
***00:18 2023: executable: <***>
***00:18 2023: argv[0]: <build-wrapper-macosx-x86>
***00:18 2023: argv[1]: <-c>
***00:18 2023: argv[2]: <>
***00:18 2023: argv[3]: <xcodebuild>
***00:18 2023: argv[4]: <-destination>
***00:18 2023: argv[5]: <generic/platform=iOS>
***00:18 2023: argv[6]: <-workspace>
***00:18 2023: argv[7]: <******.xcworkspace>
***00:18 2023: argv[8]: <-scheme>
***00:18 2023: argv[9]: <***>
***00:18 2023: argv[10]: <CODE_SIGN_STYLE=Manual>
***00:18 2023: argv[11]: <PRODUCT_BUNDLE_IDENTIFIER=***>
***00:18 2023: argv[12]: <IPHONEOS_DEPLOYMENT_TARGET=12.0>
***00:18 2023: argv[13]: <DEVELOPMENT_TEAM=***>
***00:18 2023: argv[14]: <CODE_SIGN_IDENTITY=***>
***00:18 2023: argv[15]: <PROVISIONING_PROFILE_SPECIFIER=***>
***00:18 2023: argv[16]: <clean>
***00:18 2023: argv[17]: <build>
***00:18 2023: skipping process with pid: 77056
***00:18 2023: process created with pid: 77057
***00:18 2023: parent pid: 77056
***00:18 2023: working directory: <***/>
***00:18 2023: executable: </private/tmp/sonarsource-build-wrapper-cache-501/usr/bin/xcodebuild>
***00:18 2023: argv[0]: <xcodebuild>
***00:18 2023: argv[1]: <-destination>
***00:18 2023: argv[2]: <generic/platform=iOS>
***00:18 2023: argv[3]: <-workspace>
***00:18 2023: argv[4]: <******.xcworkspace>
***00:18 2023: argv[5]: <-scheme>
***00:18 2023: argv[6]: <***>
***00:18 2023: argv[7]: <CODE_SIGN_STYLE=Manual>
***00:18 2023: argv[8]: <PRODUCT_BUNDLE_IDENTIFIER=***>
***00:18 2023: argv[9]: <IPHONEOS_DEPLOYMENT_TARGET=12.0>
***00:18 2023: argv[10]: <DEVELOPMENT_TEAM=***>
***00:18 2023: argv[11]: <CODE_SIGN_IDENTITY=***>
***00:18 2023: argv[12]: <PROVISIONING_PROFILE_SPECIFIER=***>
***00:18 2023: argv[13]: <clean>
***00:18 2023: argv[14]: <build>
***00:18 2023: skipping process with pid: 77057
***01:35 2023: finalizing json file
***01:35 2023: returned with code: 0

Thanks.

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)?

1 Like

My project uses obejective-c and swift.So I believe that build wrapper is necessary.

Hi @Take ,

I am sending you a private message where I can collect more information about your project.

1 Like

Hi @Take ,

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:

1 Like