Scanning Objc code failed

Hi sirs,

I encountered a error when I was scanning my code and I got no idea to solve it.

Here is the issue:
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.execute(CFamilySensor.java:388)
    at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:388)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:384)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:353)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
    at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
    at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
    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(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    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.

Here is the terminal info when I build the “build-wrapper”:
➜ ~ /Users/yukaichang/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir /Users/yukaichang/build-wrapper-macosx-x86 xcodebuild clean build
dyld: warning: could not load inserted library ‘/Users/yukaichang/build-wrapper-macosx-x86/libinterceptor.dylib’ into hardened process because no suitable image found. Did find:
/Users/yukaichang/build-wrapper-macosx-x86/libinterceptor.dylib: code signature in (/Users/yukaichang/build-wrapper-macosx-x86/libinterceptor.dylib) not valid for use in process using Library Validation: mapping process is a platform binary, but mapped file is not
/Users/yukaichang/build-wrapper-macosx-x86/libinterceptor.dylib: stat() failed with errno=1
xcodebuild: error: The directory /Users/yukaichang does not contain an Xcode project.

And then “build-wrapper-dump.json” is generated. JSON file’s content is as below:
{
“version”:0,
“captures”:[
]}

Is it caused by the “build-wrapper-dump.json” is empty or there is another reason?
version information:
SonarQube: developer 8.4.2
SornaScanner: 4.4.0 macosx
Build Wrapper: 6.11

Could anyone help me to figure out? Thank you in advance.

Hello @AndyChang,
Welcome to the community.
The analysis is failing because the command you are passing to build-wrapper is failing; it doesn’t build your project.

You don’t have xcode project so why are you passing xcodebuild to build-wrapper.
To make analysis work:
1- Figure out how to clean build your project from the command line without build-wrapper.
2- Pass the build command to build-wrapper:

build-wrapper-macosx-x86 --out-dir /Users/yukaichang/build-wrapper-macosx-x86 replace_this_by_clean_build_command_that_build_your_project_succefully_without_build_wrapper

3- The previous command should build your project from scratch successfully and the build-wrapper.json should not be empty

Thanks,

1 Like

Hi @Abbas,

Thank you for the reply!
Seems I made some mistakes with build-wrapper process.
I will follow the your steps and figure out right command to build the project.

Andy

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