Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing failed: Cannot link directly with dylib/framework while building WDA #17497

Closed
siddhantraut opened this issue Sep 16, 2022 · 21 comments
Closed

Comments

@siddhantraut
Copy link

The problem

Getting error after full manual configuration while building WebDriverAgent
( xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=' test )

Test session results, code coverage, and logs:
/Users/siddhant/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Logs/Test/Test-WebDriverAgentRunner-2022.09.15_21-45-16--0400.xcresult

Testing failed:
Cannot link directly with dylib/framework, your binary is not an allowed client of /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport for architecture arm64
Testing cancelled because the build failed.

** TEST FAILED **

The following build commands failed:
Ld /Users/siddhant/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework/WebDriverAgentLib normal (in target 'WebDriverAgentLib' from project 'WebDriverAgent')
(1 failure)

Environment

  • Appium version (or git revision) that exhibits the issue: 1.22.3
  • Last Appium version that did not exhibit the issue (if applicable): 1.21 | XCODE - 13 | MAC OS 12.3
  • Desktop OS/version used to run Appium:12.5.1 / XCODE -14
  • Node.js version (unless using Appium.app|exe):
  • Npm or Yarn package manager:
  • Mobile platform/version under test: iPhone 12 PRO Max - OS version 16
  • Real device or emulator/simulator:iPhone 12 PRO MAX
  • Appium CLI or Appium.app|exe: CLI

Details

Getting error after full manual configuration
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=' test

Link to Appium logs

NA

Code To Reproduce Issue [ Good To Have ]

NA

ticket created on apple developer forum as well - ref - https://developer.apple.com/forums/thread/712039?login=true&page=1#728216022

@KazuCocoa
Copy link
Member

Duplicate of #17174
Please use latest xcuitest driver, which has the fix, with appium 2.

@siddhantraut
Copy link
Author

thanks, @KazuCocoa finally iOS 16 with appium@next | MAC. 12.5 | XCODE 14 EXECUTED SUCCESSFULLY :

Folks- if needed below env to work everything fine

Steps done -

  1. installed -
  • Node.js v16.17.0 t
  • npm v8.15.0
  1. npm install -g appium@next. - v2.0.0-beta.44
  2. appium plugin install execute-drivers
  3. appium start @ appium -pa /wd/hub --use-plugins execute-driver
  4. driver installed - appium driver install xcuitest | appium driver install uiautomator2

@Digi27
Copy link

Digi27 commented Sep 19, 2022

@siddhantraut and @KazuCocoa I tried to perform the above steps but i am unable to get it done
Can you help me to perform it. I am completely stuck in it

@Digi27
Copy link

Digi27 commented Sep 19, 2022

@KazuCocoa and @siddhantraut i am running on real iOS device where i am using manual configuration build the webdriverAgent once and on that webdriveragent runner i am running my entire suite
Language i am using java

@siddhantraut
Copy link
Author

@siddhantraut and @KazuCocoa I tried to perform the above steps but i am unable to get it done Can you help me to perform it. I am completely stuck in it

@Digi27 Could you please make sure WDA in xcode from correct - path - /Users/username/.appium/node_modules/appium-xcuitest-driver/node_modules/

@Digi27
Copy link

Digi27 commented Sep 19, 2022

2. npm install -g appium@next

@siddhantraut after this command npm install -g appium@next
i should use the above path for WDA right?

@siddhantraut
Copy link
Author

yes, you can find in console log as well like "No WDA found" @usr/path../node_modules.

  1. mkdir -p Resources/WebDriverAgent.bundle
  2. Open WDA in XCODE
  3. Manual configuration steps (WDARunner and Lib)
  4. then xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=' test

@Edwick-Raj
Copy link

hy @KazuCocoa @siddhantraut @Digi27
After Executing this command npm install -g appium@next , Am getting error in xcode...shows like some related packages are missing.
Screenshot 2022-09-21 at 10 41 35 AM
Could u please help?...Currently am using
appium-1.22.3
tvos-15.6
xcode-14.
npm - 8.19.2
nodejs - 18.9.0

@KazuCocoa
Copy link
Member

I haven't seen the error, but I wonder if this was because you installed appium in root permission space and Xcode failed to open them.

@shlomobraverman
Copy link

What worked for me

installed -

  • Node.js v16.13.1
  • npm 8.9.0

run this in terminal

  1. npm install -g appium@2.0.0-beta.44
  2. appium plugin install execute-driver
  3. appium -pa /wd/hub --use-plugins execute-driver
  4. appium driver install xcuitest
  5. appium driver install uiautomator2

@Immanuel-Codoid
Copy link

Hi @siddhantraut , I'm trying to understand your solution steps
Installed:

  • Xcode - 14.0
  • node v16.17.1
  • npm 8.15.0
  • macOS - 12.6
  • iOS - 16.0.2

Steps followed:

  1. npm install -g appium@2.0.0-beta.44
  2. appium plugin install execute-driver
  3. appium -pa /wd/hub --use-plugins execute-driver
  4. appium driver install xcuitest
  5. appium driver install uiautomator2

I used wda xcode proj file from this location /Users/username/.appium/node_modules/appium-xcuitest-driver/node_modules/ to build wda into connected iPhone

Cannot link directly with dylib/framework, your binary is not an allowed client of /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport for architecture arm64

Facing this issue still

Help is much appreciated

@KazuCocoa
Copy link
Member

What about cleaning your xcode cache stuff such as ~/Library/Developer/Xcode/DerivedData/? Then, please double check the installed xcuitest is latest version.

@zaphodikus
Copy link

Is there a way to install the xcuitest older driver instead, for people who don't have the time to upgrade all their tests to Appium 2.0? I'm on xcode 14.0 . I rolled forward, on a single machine but it totally breaks too much of our test code to fix in a hurry, so I'd like to roll back correctly, but installing appium (1) seems to install or use the newer driver still on that machine even after uninstalling appium.

@siddhantraut
Copy link
Author

@Immanuel-Codoid could you try reinstallation(remove first) XCODE once?

@KazuCocoa
Copy link
Member

Is there a way to install the xcuitest older driver instead, for people who don't have the time to upgrade all their tests to Appium 2.0? I'm on xcode 14.0 . I rolled forward, on a single machine but it totally breaks too much of our test code to fix in a hurry, so I'd like to roll back correctly, but installing appium (1) seems to install or use the newer driver still on that machine even after uninstalling appium.

JavaScript code in appium-xcuitest-driver/appium-webdriveragent has breaking changes internally, but the below may work:

Replace appium/node_modules/appium-webdriveragent (or maybe appium/node_modules/appium-xcuitest-driver/appium-webdriveragent) with https://github.com/appium/WebDriverAgent except for build and node_modules directories in appium-webdriveragent. Appium/WDA itself does not have breaking changes (but https://github.com/appium/WebDriverAgent repo has JavaScript code), so keeping appium-webdriveragent/build and appium-webdriveragent/node_modules but replace other Xcode project stuff can do.

Let me take a look (hopefully) tonight if we could pick necessary changes up for xcode 14 for appium 1 to include only it

@zaphodikus
Copy link

As a short term workaround I managed to install both appium via brew and override the node version 2 installation, then manually
\cd /opt/homebrew/lib/node_modules/appium-webdriveragent ; xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=00008020-001458161E12002E' test
to start the driver and connect it in test mode to the target phone, then start appium V1 normally in my test (from brew) which promptly sees that the driver is already running and does not try to start it and then things work - at least very temporary for my developers who only installed appium this week.

Ah I see you just posted some workaround hints, that tally with my very limited java experience above showing that this can be transplanted. Will try do that tomorrow. Thanks for all the effort, will verify tomorrow and feedback.

@marcelozenjob
Copy link

A quick workaround for this still using Appium 1.22.3 is to go to the ./node_modules/appium folder and update the
appium-xcuitest-driver to the latest version
e.g.

cd ./node_modules/appium
npm install appium-xcuitest-driver@latest

@jdmesalosada
Copy link

jdmesalosada commented Nov 30, 2022

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

@jlipps
Copy link
Member

jlipps commented Dec 1, 2022

@mykola-mokhnach what would you think about an xcuitest driver script like this:

appium driver run xcuitest open-wda-proj

And all it does is call open /correct/path/to/WebDriverAgent.xcodeproj; could make it easy for people to get to the point of signing it?

@mykola-mokhnach
Copy link
Collaborator

@mykola-mokhnach what would you think about an xcuitest driver script like this:

appium driver run xcuitest open-wda-proj

And all it does is call open /correct/path/to/WebDriverAgent.xcodeproj; could make it easy for people to get to the point of signing it?

yes, I like this idea

@SkPratihar1
Copy link

The following build commands failed:
Ld /Users/it062305/Library/Developer/Xcode/DerivedData/WebDriverAgent-femkzeamkxbpckfotevcllhvvmda/Build/Products/Debug-iphonesimulator/WebDriverAgentLib.framework/WebDriverAgentLib normal (in target 'WebDriverAgentLib' from project 'WebDriverAgent')
(1 failure)
2023-09-05 15:28:10.451 xcodebuild[39632:370001] [MT] IDETestOperationsObserverDebug: 0.012 elapsed -- Testing started completed.
2023-09-05 15:28:10.451 xcodebuild[39632:370001] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2023-09-05 15:28:10.451 xcodebuild[39632:370001] [MT] IDETestOperationsObserverDebug: 0.012 sec, +0.012 sec -- end
Test session results, code coverage, and logs:
/Users/it062305/Library/Developer/Xcode/DerivedData/WebDriverAgent-femkzeamkxbpckfotevcllhvvmda/Logs/Test/Test-WebDriverAgentRunner-2023.09.05_15-28-04-+0530.xcresult
Testing failed:
Cannot link directly with dylib/framework, your binary is not an allowed client of /Users/it062305/dev/software/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport for architecture x86_64
Linker command failed with exit code 1 (use -v to see invocation)
Test target WebDriverAgentRunner encountered an error (The bundle identifier for WebDriverAgentRunner-Runner.app couldn’t be read. The application may be damaged or incomplete: “/Users/it062305/Library/Developer/Xcode/DerivedData/WebDriverAgent-femkzeamkxbpckfotevcllhvvmda/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app”.)
** TEST EXECUTE FAILED **

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests