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

Xcodebuild exited with code 65 ( error: no such module 'WatchKit' ) #2174

Open
xWorldx opened this issue Apr 4, 2024 · 7 comments
Open

Xcodebuild exited with code 65 ( error: no such module 'WatchKit' ) #2174

xWorldx opened this issue Apr 4, 2024 · 7 comments
Labels
needs more info Looks valid, but more info is needed

Comments

@xWorldx
Copy link

xWorldx commented Apr 4, 2024

Steps to reproduce

patrol build ios--simulator --target integration_test/example_test.dart --flavor UAT --verbose

Actual results

Hello, I am getting this error after trying to run a very simple Integration test within our project " error: no such module 'WatchKit' import WatchKit "

Failed to build app with entrypoint test_bundle.dart for iOS simulator (xcodebuild exited with code 65) (87.1s)
Error: xcodebuild exited with code 65

Logs

$ xcodebuild build-for-testing -workspace Runner.xcworkspace -scheme UAT -configuration Debug-UAT -sdk iphonesimulator -destination generic/platform=iOS Simulator -quiet -derivedDataPath ../build/ios_integ OTHER_SWIFT_FLAGS=$(inherited) -D PATROL_ENABLED
/Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol-3.6.1/darwin/Classes/Telegraph/Security/TLSPolicy.swift:36:5: warning: 'SecTrustEvaluate' was deprecated in iOS 13.0: renamed to 'SecTrustEvaluateWithError(::)'
SecTrustEvaluate(trust, &result)
^
/Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol-3.6.1/darwin/Classes/Telegraph/Security/TLSPolicy.swift:36:5: note: use 'SecTrustEvaluateWithError(::)' instead
SecTrustEvaluate(trust, &result)
^~~~~~~~~~~~~~~~
SecTrustEvaluateWithError
/Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol-3.6.1/darwin/Classes/AutomatorServer/Automator/IOSAutomator.swift:321:15: warning: value 'element' was defined but never used; consider replacing with boolean test
let element = self.waitFor(
~~~~^~~~~~~~~~

    /Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol-3.6.1/darwin/Classes/AutomatorServer/Automator/IOSAutomator.swift:341:15: warning: value 'element' was defined but never used; consider replacing with boolean test
              let element = self.waitFor(
              ~~~~^~~~~~~~~~
              
    /Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol-3.6.1/darwin/Classes/AutomatorServer/Automator/IOSAutomator.swift:941:7: warning: code after 'throw' will never be executed
          try runAction(log) {
          ^
    /Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol-3.6.1/darwin/Classes/AutomatorServer/Automator/IOSAutomator.swift:321:15: warning: value 'element' was defined but never used; consider replacing with boolean test
              let element = self.waitFor(
              ~~~~^~~~~~~~~~
              
    /Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol-3.6.1/darwin/Classes/AutomatorServer/Automator/IOSAutomator.swift:341:15: warning: value 'element' was defined but never used; consider replacing with boolean test
              let element = self.waitFor(
              ~~~~^~~~~~~~~~
              
    /Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol-3.6.1/darwin/Classes/AutomatorServer/Automator/IOSAutomator.swift:941:7: warning: code after 'throw' will never be executed
          try runAction(log) {
          ^
    /Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol-3.6.1/darwin/Classes/Telegraph/Security/TLSPolicy.swift:36:5: warning: 'SecTrustEvaluate' was deprecated in iOS 13.0: renamed to 'SecTrustEvaluateWithError(_:_:)'
        SecTrustEvaluate(trust, &result)
        ^
    /Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol-3.6.1/darwin/Classes/Telegraph/Security/TLSPolicy.swift:36:5: note: use 'SecTrustEvaluateWithError(_:_:)' instead
        SecTrustEvaluate(trust, &result)
        ^~~~~~~~~~~~~~~~
        SecTrustEvaluateWithError
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/watch Watch App/Services/WebService.swift:10:8: error: no such module 'WatchKit'
    import WatchKit
           ^
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/watch Watch App/Services/WebService.swift:10:8: error: no such module 'WatchKit'
    import WatchKit
           ^
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'IOSSecuritySuite' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'path_provider_foundation-path_provider_foundation_privacy' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'flutter_local_notifications-flutter_local_notifications_privacy' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'url_launcher_ios-url_launcher_ios_privacy' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'shared_preferences_foundation-shared_preferences_foundation_privacy' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'SentryPrivate' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'PromisesObjC' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'nanopb' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'CocoaAsyncSocket' from project 'Pods')
    warning: Skipping duplicate build file in Compile Sources build phase: /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/watch Watch App/Controller/PhoneController.swift (in target 'watch Watch App' from project 'Runner')
    warning: Skipping duplicate build file in Compile Sources build phase: /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/watch Watch App/Views/PerformanceView.swift (in target 'watch Watch App' from project 'Runner')
    warning: Skipping duplicate build file in Compile Sources build phase: /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/watch Watch App/Views/AllocationView.swift (in target 'watch Watch App' from project 'Runner')
    note: Run script build phase 'swiftlint' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'watch Watch App' from project 'Runner')
    warning: Skipping duplicate build file in Compile Sources build phase: /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/watch Watch App/Controller/PhoneController.swift (in target 'watch Watch App' from project 'Runner')
    warning: Skipping duplicate build file in Compile Sources build phase: /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/watch Watch App/Views/PerformanceView.swift (in target 'watch Watch App' from project 'Runner')
    warning: Skipping duplicate build file in Compile Sources build phase: /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/watch Watch App/Views/AllocationView.swift (in target 'watch Watch App' from project 'Runner')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'GoogleDataTransport' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'Sentry' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseCoreInternal' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'GoogleUtilities' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseInstallations' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Runner.xcodeproj: warning: The Copy Bundle Resources build phase contains this target's Info.plist file '/Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Runner/Info-debug.plist'. (in target 'Runner' from project 'Runner')
    note: Run script build phase 'Flutter' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
    note: Run script build phase 'Copy Config Files' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
    note: Run script build phase 'SwiftLint' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
    note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseMessaging' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseCore' from project 'Pods')
    /Users/ahmedamin/Dev/wm-portal-mobile-app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'Firebase' from project 'Pods')
    warning: Run script build phase 'xcode_backend build' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RunnerUITests' from project 'Runner')
    warning: Run script build phase 'xcode_backend embed_and_thin' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RunnerUITests' from project 'Runner')
    ** TEST BUILD FAILED **

✗ Failed to build app with entrypoint test_bundle.dart for iOS simulator (xcodebuild exited with code 65) (87.1s)
Error: xcodebuild exited with code 65
#0 throwToolExit (package:patrol_cli/src/base/exceptions.dart:7:3)
#1 IOSTestBackend.build. (package:patrol_cli/src/ios/ios_test_backend.dart:137:9)

#2 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7)

#3 IOSTestBackend.build (package:patrol_cli/src/ios/ios_test_backend.dart:76:5)

#4 TestCommand._build (package:patrol_cli/src/commands/test.dart:279:7)

#5 TestCommand.run (package:patrol_cli/src/commands/test.dart:213:5)

#6 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

#7 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:347:18)

#8 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:291:18)

#9 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:70:20)

#10 main (file:///Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol_cli-2.7.0/bin/main.dart:6:20)

See the logs above to learn what happened. Also consider running with --verbose. If the logs still aren't useful, then it's a bug - please report it.
Error: xcodebuild exited with code 65
#0 throwToolExit (package:patrol_cli/src/base/exceptions.dart:7:3)
#1 IOSTestBackend.build. (package:patrol_cli/src/ios/ios_test_backend.dart:137:9)

#2 DisposeScope.run (package:dispose_scope/src/dispose_scope.dart:46:7)

#3 IOSTestBackend.build (package:patrol_cli/src/ios/ios_test_backend.dart:76:5)

#4 TestCommand._build (package:patrol_cli/src/commands/test.dart:279:7)

#5 TestCommand.run (package:patrol_cli/src/commands/test.dart:213:5)

#6 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

#7 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:347:18)

#8 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:291:18)

#9 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:70:20)

#10 main (file:///Users/ahmedamin/.pub-cache/hosted/pub.dev/patrol_cli-2.7.0/bin/main.dart:6:20)

Patrol version

patrol: ^3.6.1

Patrol Doctor output

Patrol doctor:
Patrol CLI version: 2.7.0
Flutter command: flutter
Flutter 3.19.0 • channel stable
Android:
• Program adb not found (install with export PATH="$ANDROID_HOME/platform-tools:$PATH")
• Env var $ANDROID_HOME set to /path/to/your/android/sdk
iOS / macOS:
• Program xcodebuild found in /usr/bin/xcodebuild
• Program ideviceinstaller found in /usr/local/bin/ideviceinstaller

Flutter Doctor output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.0, on macOS 14.2.1 23C71 darwin-x64, locale en-DE)
[✗] Android toolchain - develop for Android devices
✗ ANDROID_HOME = /path/to/your/android/sdk
but Android SDK not found at this location.
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.87.2)
[✓] Connected device (4 available)
! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area
network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

! Doctor found issues in 1 category.

@muknta
Copy link

muknta commented Apr 18, 2024

I have problem with WatchOS module also, by trying to run tests on iOS simulator with flavor
@piotruela @bartekpacia

within both

patrol build ios --debug --simulator --flavor Dev --verbose

and

patrol test --target integration_test/main_test.dart --verbose --flavor Dev

@muknta
Copy link

muknta commented Apr 18, 2024

looks like Patrol not really covers the whole scope of WatchOS runner

@piotruela
Copy link
Collaborator

When running commands like patrol test or patrol build ios. It runs some iOS specific commands underneath. Something very similar to this one:
xcodebuild build-for-testing -workspace Runner.xcworkspace -scheme staging -configuration Debug-staging -sdk iphonesimulator -destination generic/platform=iOS Simulator -quiet -derivedDataPath ../build/ios_integ OTHER_SWIFT_FLAGS=$(inherited) -D PATROL_ENABLED.
I found an issue on KMP which look like it might have the same cause.

This command is passing the arguments -sdk and -arch specific to iOS, which breaks building the watchOS target with the error.

Please provide a minimal reproducible example so we could investigate this issue.

@piotruela piotruela added the needs more info Looks valid, but more info is needed label Apr 29, 2024
@muknta
Copy link

muknta commented May 2, 2024

@piotruela thanks for the response. I've added the WatchOS app dependency to your example ios project, and it fails
https://github.com/muknta/patrol/pull/1/files#r1587666525

You're right. Probably, the -sdk iphonesimulator flag cannot look into watchos' scope
So it may relate to this issue - flutter/flutter#43731

@muknta
Copy link

muknta commented May 2, 2024

we have temporarily fixed errors based on WatchOS by adding an extra target w/o WatchOS dependency, and by replacing of AppDelegate which also contains the initialization of Watchkit communication service

@muknta
Copy link

muknta commented May 21, 2024

I've added the WatchOS app dependency to your example ios project, and it fails
https://github.com/muknta/patrol/pull/1/files#r1587666525

Hi @piotruela! Did you have a chance to look into my example?

@piotruela
Copy link
Collaborator

Not yet, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Looks valid, but more info is needed
Projects
None yet
Development

No branches or pull requests

3 participants