Obj-C+xcodebuild: Build-wrapper: connect to /tmp/build-wrapper-socket....: Operation not permitted

Hey all,

When running without build-wrapper, compilation works fine.

This is the CI as it currently stands:

Thank you

      - name: Run build-wrapper RollbarCommon
        run: |
          xcodebuild \
            -workspace RollbarSDK.xcworkspace \
            -scheme RollbarCommon \
            -derivedDataPath DerivedData \
            clean build

If I add build-wrapper-macos-x86 there, it doesn’t work.

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

SonarSource/sonarcloud-github-c-cpp@v2

As indicated in macos-xcode-gh-actions-sc/.github/workflows/build.yml at main · sonarsource-cfamily-examples/macos-xcode-gh-actions-sc · GitHub

  • how is SonarQube deployed: zip, Docker, Helm
    GitHub Action

  • what are you trying to achieve
    xcodebuild clean build with build-wrapper

  • what have you tried so far to achieve this

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Full log:

22s
Run build-wrapper-macosx-x86 --out-dir DerivedData/compilation-database xcodebuild -workspace RollbarSDK.xcworkspace -scheme RollbarDeploys -derivedDataPath DerivedData -enableCodeCoverage YES build test CODE_SIGN_IDENTITY="-" CODE_SIGNING_REQUIRED=NO
Command line invocation:
    /Applications/Xcode_14.2.app/Contents/Developer/usr/bin/xcodebuild -workspace RollbarSDK.xcworkspace -scheme RollbarDeploys -derivedDataPath DerivedData -enableCodeCoverage YES build test CODE_SIGN_IDENTITY=- CODE_SIGNING_REQUIRED=NO

User defaults from command line:
    IDEDerivedDataPathOverride = /Users/runner/work/***/***/DerivedData
    IDEPackageSupportUseBuiltinSCM = YES

Build settings from command line:
    CODE_SIGN_IDENTITY = -
    CODE_SIGNING_REQUIRED = NO

Resolve Package Graph

build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted

build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted

build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted

build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted

build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted

build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted

2024-02-13 15:36:46.505 xcodebuild[3630:16439] Writing error result bundle to /var/folders/gh/0cww6vn93nv_jjsw3xkm0b4m0000gn/T/ResultBundle_2024-13-02_15-36-0046.xcresult

Resolved source packages:
  RollbarNotifier: /Users/runner/work/***/***/RollbarNotifier
  RollbarAUL: /Users/runner/work/***/***/RollbarAUL
  RollbarDeploys: /Users/runner/work/***/***/RollbarDeploys
  RollbarCommon: /Users/runner/work/***/***/RollbarCommon
  RollbarCocoaLumberjack: /Users/runner/work/***/***/RollbarCocoaLumberjack
  UnitTesting: /Users/runner/work/***/***/UnitTesting

xcodebuild: error: Could not resolve package dependencies:
  Invalid manifest
build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted
  Invalid manifest
build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted
  Invalid manifest
build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted
  Invalid manifest
build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted
  Invalid manifest
build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted
  Invalid manifest
build-wrapper: connect to /tmp/build-wrapper-socket.lZxS1Q: Operation not permitted

Error: Process completed with exit code 74.

Hi @matux ,

do you always get failure for such job? If you relaunch it does it pass from time to time?

We observed some hiccups for some jobs on macOS, one way to overcome those is to use the JSON Compilation Database.

  • To generate a Compilation Database use Clang compiler feature to generate partial compilation database files and aggregate them. You need to set -gen-cdb-fragment-path on OTHER_CFLAGS of xcodebuild command line:
# add to your xcodebuild command: OTHER_CFLAGS="\$(inherited) -gen-cdb-fragment-path \$(PROJECT_DIR)/CompilationDatabase"
xcodebuild clean build arg1 .. argN OTHER_CFLAGS="\$(inherited) -gen-cdb-fragment-path \$(PROJECT_DIR)/CompilationDatabase"
pushd CompilationDatabase
sed -e '1s/^/[\'$'\n''/' -e '$s/,$/\'$'\n'']/' *.json > ../compile_commands.json
popd
  • Then properly set the sonar.cfamily.compile-commands property to point to the generated compile_commands.json