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

13

9

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

Poetry answered 8/8, 2022 at 14:24 Comment(1)
Here i got the steps to fix it, github.com/appium/appium/issues/17497#issuecomment-1249985876Poetry
G
5

I’m using

  • Xamarin.iOS
  • Visual Studio for Mac 17.4 with enabled manual provisioning
  • Xcode 14.1
  • macOS Monterey 12.6.1

and I experienced the same error listed in the author’s question. Here are the steps which helped me to fix the issue:

  1. Install the latest Appium Desktop as described here.

  2. Install the latest appium-doctor:

    npm install -g appium-doctor
    
  3. Make sure that appium-doctor shows green status for all necessary dependencies:

    appium-doctor --ios
    

    enter image description here

  4. Install latest WebDriverAgent:

    npm install -g appium-webdriveragent
    
  5. Navigate to the WebDriverAgent folder:

    cd /opt/homebrew/lib/node_modules/appium-webdriveragent
    
  6. As described in the documentation, start WebDriverAgent via xcodebuild with supplied platform and name:

    xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS Simulator,name=iPhone 7 Plus' test
    

    Note: when I tried to start WebDriverAgent from its folder inside of the Appium Desktop or appium npm package, then I was getting the error message from the author's question.

  7. Deploy the test application to the ios simulator, for example via Visual Studio.

  8. Start Appium Desktop server.

  9. Run the simple test from the console app with Appium.WebDriver NuGet installed:

    static void Main(string[] args)
    {
        var o = new AppiumOptions();
    
        o.AddAdditionalCapability(MobileCapabilityType.NoReset, "true");
        o.AddAdditionalCapability(MobileCapabilityType.AutomationName, "XCUITest");
        o.AddAdditionalCapability(MobileCapabilityType.PlatformName, "iOS");
        o.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "13.1");
        o.AddAdditionalCapability(MobileCapabilityType.DeviceName, "iPhone 7 Plus");
    
        // set app file path which can be found at the loction like:
        // /Users/myusername/Library/Developer/CoreSimulator/Devices/someid1/data/Containers/Bundle/Application/someid2/appname.app"
        // you can pick up this path from application output in visual studio as well
        o.AddAdditionalCapability(MobileCapabilityType.App, "path to .app file");
    
       var driver = new IOSDriver<IOSElement>(new Uri("http://127.0.0.1/wd/hub"), o);
    
       driver.FindElementByAccessibilityId("testid").Click();
    }
    

And that's it. Hope this might help someone.

Germanous answered 1/12, 2022 at 21:48 Comment(2)
Works as charm. You saved my day!Uncritical
It did not work when you ran the test within node_modules of appium desktop or appium from npm because they are using the older versions of appium-webdriveragent.Pindling
A
3

The issue has been fixed on my side please follow below steps

  1. Go to Application folder where Appium Server GUI Installed right click on it then show package contents -> contents -> Resources -> app -> node modules -> appium -> node modules -> (inside node modules go to appium-webdriveragent) now download WebDriverAgent from below link and replace everything except build and paste it
  2. Now Relaunch WebdriverAgent Project from xcode and add apple account and signin by providing team and bundleidentifier in WebDriverAgentLib, WebdriverAgentRunner and IntegrationApp.
  3. From top select WebDriverAgentRunner and build the project once project build is successfull you will not find that
Antrum answered 24/1, 2023 at 21:46 Comment(0)
N
1

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.

Nauseating answered 7/9, 2022 at 7:58 Comment(6)
I am getting error to get list, mac@static-251 % otool -l XCTAutomationSupport | grep -A 2 LC_SUB_CLIENT error: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic: can't open file: XCTAutomationSupport (No such file or directory)Poetry
Try like this: otool -l "$(xcrun --sdk iphonesimulator --show-sdk-platform-path)"/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport | grep -A 2 LC_SUB_CLIENTNauseating
Can you help me with step by step to process it?Poetry
For anyone wondering how this is done, there's an ld flag -allowable_client nowOverburdensome
I followed the example from @TimofeySolonin to create a fake lib and it built fine!! But, I am seeing System/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport (0x1028a0c28) and /private/var/containers/Bundle/Application/C2DACBFD-98FB-47C1-A0BD-7DE673B8E517/WebDriverAgentRunner-Runner.app/Frameworks/XCTAutomationSupport.framework/XCTAutomationSupport (0x105574c58). One of the two will be used. Which one is undefined. I am on XCode 15.1. I tried a few changes, such as making the fake lib mergeable. None worked. Any tip to have one XCTAutomationSupport?Marybethmaryellen
I can't use appium v2 for some reason.Marybethmaryellen
M
1

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!

Monophthong answered 15/9, 2022 at 9:39 Comment(3)
I need to check with Xcode 14 only.Poetry
I also can't downgrade: need Xcode 14 for my Apium server to even 'see' (via command xcrun xctrace list devices) connected iPhone devices with iOS 16.Orozco
have you tried installing device support tools? you can download those from GH: github.com/filsv/iOSDeviceSupportMonophthong
T
1

Getting the same error with:

Appium desktop version: 1.22.3

Xcode:14.1

iOS:16.1.2

MacOs:12.6.1

Step1:

npm install -g appium@next

This installed the appium version: 2.0.0-beta.46

Step2: Then install the driver for xcuitest:

appium driver install xcuitest

if you get issues like below in running above command: STDOUT:

STDERR:

npm ERR! code ERESOLVE

npm ERR! ERESOLVE unable to resolve dependency tree

npm ERR!

npm ERR! While resolving: undefined@undefined

npm ERR! Found: [email protected]

npm ERR! node_modules/appium

npm ERR! appium@”^1.22.1″ from the root project

Solution is:

  • Remove desktop Appium of above mentioned version
  • Navigate to users/userName directory and delete the following folder and files

-- /node_modules/

-- package.json

-- package.lock.json

These above files refer to earlier appium installation.

then try to run command to install appium drivers, you should be good now!

Step 3: Go to the folder:

/Users/${your_user}/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent

Run this command for Real device:

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id='{device_id}' test -allowProvisioningUpdates

Run this command for Simulator:

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination name='{device_name}' test -allowProvisioningUpdates
Trothplight answered 1/12, 2022 at 19:8 Comment(0)
A
1

XCode 14.1 error with WDA Solution for appium installed via node i.e.

npm -g install appium

Crux of problem is WDA version which needs to be 4.9.0 As we installed appium using node, we need to update package.json to get 4.9.0 WDA

Dependency chain is

appium -> appium-xcuitest-driver -> appium-webdriveragent

We need to update appium-xcuitest-driver version at package.json of appium I figure out perfect version for this is 4.12.0

Steps to resolve this issue is

  1. cd #appiumNodeDirectory#
  2. open pacakge.json inside appium directory
  3. Search for "appium-xcuitest-driver"
  4. Replace with "appium-xcuitest-driver": "4.12.0" (updated to 4.12.0)
  5. save file and quit webdriveragent xcode project if it is open
  6. npm install (make sure you are at appium folder)
  7. Open WDA in Xcode 14.1 and code sign

Now you may use Xcode 14.1 and ios 16 devices with your appium installed with node

Athallia answered 8/12, 2022 at 0:57 Comment(0)
B
0

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

Bloodhound answered 13/9, 2022 at 6:48 Comment(2)
framework added in frameworks and libraries, I am just updating my question.Poetry
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Academicism
C
0

Answer of VincentYao here works for me

We need to update WebDriverAgent to v4.9.0

Cara answered 13/10, 2022 at 12:18 Comment(0)
A
0

This is fixed using latest WebDriverAgent 4.10.2 (npm install -g appium@latest). However, if you installed appium via node, the appium version is just 1.22.3 and it's not included the latest WDA. I suggest to download the WDA from the website (https://github.com/appium/WebDriverAgent/releases) and install it on your device then using the capability "usePrebuiltWDA" = true to bypass this.

Acquaint answered 16/11, 2022 at 4:56 Comment(0)
R
0

I had the same issue and solved by downgrading Xcode from 14.1 to 13.4.1

Unfortunately Appium2 (2.0.0-beta.46) didn't work on my framework (Katalon Studio), so I'm still working with appium 1.22.3

Rolanda answered 29/11, 2022 at 9:51 Comment(0)
N
0

Getting the same error with:

Appium desktop version: 1.22.3

Xcode:14.1

iOS:16.1.2

MacOs:12.6.1

Steps to fix the issue:

npm install -g appium@next

This installed the appium version: 2.0.0-beta.46

Then install the driver for xcuitest:

appium driver install xcuitest

Go to the folder:

/Users/${your_user}/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent

Open WebDriverAgent.xcodeproj with xCode and sign it.

Then run the command:

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id='{device_id}' test -allowProvisioningUpdates
Nitriding answered 30/11, 2022 at 23:32 Comment(0)
A
0

Here is what worked for me:

cd /usr/local/lib/node_modules/appium-webdriveragent.

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS Simulator,name=iPhone 13’  test
Allenaallenby answered 25/5, 2023 at 8:3 Comment(0)
S
0

deleted the appium-webdriveragent folder from my project:

/opt/homebrew/lib/node_modules/appium/node_modules/appium-webdriveragent

and then ran the following command saved my day:

npm install -g appium-webdriveragent
Seafood answered 6/11, 2023 at 21:7 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.