-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Description
[update] Please use newer xcuitest driver with appium 2.
https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/migrating-1-to-2.md
npm install --location=global appium@next
appium driver install xcuitest # or "appium driver update xcuitest"
appium server --base-path=/wd/hub
Still the error occurred:
rm ~/.appium # or remove $APPIUM_HOME
appium driver install xcuitest
appium server --base-path=/wd/hub
The problem
This happens only XCTAutomationSupport.framework/XCTAutomationSupport
included in Xcode 14 beta 3. XCTAutomationSupport
in Xcode 14 beta 2 did not have. So as a workaround, you can use Xcode 14 beta 3 by replacing XCTAutomationSupport
in Xcode 14 beta 3 with Xcode beta 2 for now.
(This does not mean Appium/WDA does not work on iOS 16 beta 3.)
mac2/WDA does not have this issue since it does not have a binary link to XCTAutomationSupport.
Environment
- Xcode 14 beta 3 x https://github.com/appium/WebDriverAgent
- not appium version dependent
Details
Xcode build caused below errors:
- simulator (on an intel mac)
error build: Cannot link directly with dylib/framework, your binary is not an allowed client of /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport for architecture x86_64
- real device
error build: 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
Xcode build example...:
xcodebuild build-for-testing -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=00008030-000C51E13C29802E IPHONEOS_DEPLOYMENT_TARGET=15.4 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO
then:
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)
So far, the workaround is to replace XCTAutomationSupport.framework/XCTAutomationSupport
in beta 3 with the framework binary in beta 2.
Link to Appium logs
Code To Reproduce Issue [ Good To Have ]
Build Appium/WDA with Xcode 14 beta 3.
Activity
mykola-mokhnach commentedon Jul 10, 2022
We'd have to change WDA code to avoid dependencies on private frameworks. It looks like Apple is becoming more and more paranoid: https://developer.apple.com/forums/thread/124782
Dan-Maor commentedon Jul 11, 2022
Here are my findings upon an initial investigation:
allowable_client
flags specifying which clients are allowed to link to theXCTAutomationSupport
framework (new LC_SUB_CLIENT load commands were added).XCTAutomationSupport
is defined to only allow the following clients:AutomationInfrastructureIntegrationTests
,IDEApplicationTests
,IDETestingFoundationTests
,IDEXcodeUITesting
,XCTAutomationSupportTests
,XCTDaemon
,XCTDaemonControl
,XCTDaemonControlTests
,XCTDaemonTests
,XCTHarness
,XCTest-AppHostedTests
,XCTest-PerformanceTests
,XCTest-ToolHostedTests
,XCTest-UITests-iOS
,XCTest-UITests-macOS
,XCTest-UITests-tvOS
,XCTestCore
,XCUIAutomation
,XCUIRecorderService
,testmanagerd
,xctest
.-client_name xctest
to the other linkers flags section ofWebDriverAgentLib
, however then the compiler will complain that the flag can only be used when building a bundle, not a dynamic library. ChangingWebDriverAgentLib
's Mach-O type to Bundle will result in an inability for the main test bundle to link against it, stating that only dynamic libraries can be linked against.WebDriverAgentLib
target entirely and add all linked libraries references, header files and source files directly to the WebDriverAgent runner targets. After combining this method with the added flag (the main test bundle is already defined as a Mach-O bundle type) and adding the frameworks search path fromWebDriverAgentLib
(so that the XCTest frameworks can be located during link time) I managed to get WebDriverAgent runner to run on a simulator and on my iPhone running the iOS 16.0 beta 3.Information regarding load commands taken from here:
https://opensource.apple.com/source/cctools/cctools-921/include/mach-o/loader.h
mykola-mokhnach commentedon Jul 11, 2022
thanks for the investigation @Dan-Maor
This makes sense, however I'm not quite sure it is not going to create another issues related to project building or configuration, which would require to rewrite xcuitest driver wrappers for it.
I've started working on another solution, which removes private classes from the dependencies list. However, this change requires to refactor a lot of dependant code (really, a lot) and will require some weeks to land before I can even make it to compile successfully. Although it is safer from the perspective that all the other building infra should remain as is.
All the related changes could be found at https://github.com/appium/WebDriverAgent/tree/xcode_upd
KazuCocoa commentedon Jul 12, 2022
thank you for the detailed investigation @Dan-Maor
Would you mind asking a question..? How did you find allowed clients you addressed as below?
I initially guessed to remove dynamic links, but haven't tried well yet.
Dan-Maor commentedon Jul 12, 2022
@KazuCocoa I retrieved the list from Hopper by going through the load commands and listing the strings of the
LC_SUB_CLIENT
load commands.They can also be retrieved in the same manner by using
otool -l
on theXCTAutomationSupport
framework.KazuCocoa commentedon Jul 12, 2022
thank you! I've learned the tool and the way...
mykola-mokhnach commentedon Jul 14, 2022
Closed as fixed
32 remaining items
KazuCocoa commentedon Feb 25, 2023
Maybe it shows more information such as the code sign did not work etc, but your environment was for a simulator, and Appium 2 and newer XCUITest driver, then potentially some other issues might be there. Could you share the full log as GIST?
Haochenyu2021 commentedon Feb 26, 2023
Hi @KazuCocoa Here is the log....
appium-server-logs.txt
KazuCocoa commentedon Feb 26, 2023
Thanks, but I meant the vanilla xcodebuild instead of the Appium log at this time (sorry)
Haochenyu2021 commentedon Feb 26, 2023
Thanks @KazuCocoa - I use xcrun simctl spawn log stream | grep Appium to check the xcodebuild for the simulator, got no such file or directory for this UDID.
I guess there's no log created from xcode because from appium we could see: [xcodebuild error message:] is null here
KazuCocoa commentedon Feb 26, 2023
I meant xcodebuild with the below command directly.
I noticed you used Appium 1.22.3 embedded in Appium Desktop 1.22.3, which is not Appium 2 and newer Appium XCUITest driver. Our Appium inspector means https://github.com/appium/appium-inspector
Haochenyu2021 commentedon Feb 26, 2023
hi @KazuCocoa sorry for the version number - The correct ones should be:
Appium Server GUI 1.22.3 & Appium Inspector 2023.2.1
KazuCocoa commentedon Feb 27, 2023
Then, could you try out Appium 2.0 with latest appium-xcuitest-driver?
Haochenyu2021 commentedon Feb 27, 2023
Hi @KazuCocoa - I'm using the latest appium-xcuitest-driver, which is 4.18.1
KazuCocoa commentedon Feb 27, 2023
Then, could you share the version's xcodebuild command result?
Haochenyu2021 commentedon Feb 27, 2023
I found I got an error of WebDriverAgentRunner-Runner.app

System: The bundle identifier for WebDriverAgentRunner-Runner.app couldn't be read
But I have successfully built WebDriverAgentLib, WebDriverAgentRunner, and IntegrationApp onto simulator from xcode
And another thing is my Appium folder is under usr\local\lib\node_modules
But appium drivers are under user\username.appium\node_modules
Does this matter?
KazuCocoa commentedon Feb 27, 2023
The drivers' path was expected. https://appium.github.io/appium/docs/en/2.0/guides/migrating-1-to-2/
Did you try out xcodebuild command the same as Appium 2 issued like below? (The below's one was what you shared before. In appium 2 appium log also may have the same
xcodebuild build-for-testing test-without-building ...
command result. I meant the entire build result.dduphorn commentedon May 4, 2023
I got the message error build: 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
npm install --location=global appium@next
appium driver install xcuitest # or "appium driver update xcuitest"
appium server --base-path=/wd/hub
Then I got the error /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport for architecture arm64
I removed the XCTAutomationSupport Linked Binary and now I"m getting the error
Undefined symbol: OBJC_CLASS$_XCAccessibilityElement
Undefined symbol: OBJC_CLASS$_XCDeviceEvent
Undefined symbol: OBJC_CLASS$_XCElementSnapshot
Linker command failed with exit code 1 (use -v to see invocation)
My linked Binary does include XCTest.frameworks.
Any idea what I'm missing?