error build: Cannot link directly with dylib/framework XCTAutomationSupport for architecture arm64

Viewed 998

I am using Xcode Beta 14, tring to build WebDriverAgent

getting below errors

WebDriverAgent/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework/WebDriverAgentLib

ld: cannot link directly with dylib/framework, your binary is not an allowed client of /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

note: Using codesigning identity override: iPhone Developer note: Building targets in dependency order ** TEST BUILD FAILED **

any issue with Beta or any further preferences required to set it up.

enter image description here

3 Answers

Starting with Xcode 14 XCTAutomationSupport and other private frameworks have an allowlist of libraries that can link with them. The list is specified with the LC_SUB_CLIENT load commands. You can see who is allowed to link using: otool -l XCTAutomationSupport | grep -A 2 LC_SUB_CLIENT.

One way I found to bypass this restriction is to:

  1. Create a fake library with an allowed name
  2. When linking the fake library, specify that it should reexport XCTAutomationSupport: -reexport_framework XCTAutomationSupport
  3. Link the image that requires XCTAutomationSupport with your fake library instead of linking it with XCTAutomationSupport

Here is an example showing how you can set this up in Xcode.

@Solid Soft You should give full path like: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport

Had the same issue because of Xcode update to 14.0

So if you don't need to work on 14.0 ver, simply downgrade your Xcode to 13.4 (or such) version and it should work.

You can download it from apple developers page

Hope this helps!

Related