SwiftUI previews for WatchKit Extension always fail on "Command CompileSwiftSources failed with a nonzero exit code" even when the project builds OK
Originator: | tk | ||
Number: | rdar://FB9634311 | Date Originated: | 17.9.2011 |
Status: | Resolved: | ||
Product: | Xcode | Product Version: | 13.0 |
Classification: | Swift Compiler | Reproducible: | Yes |
Please describe the issue: SwiftUI previews of WatchKit Extension never show up, attempts to refresh the preview fail with “Command CompileSwiftSources failed with a nonzero exit code” even though the product builds and runs on Apple Watch without any error. This is a regression for latest Xcode 12.5.1 where a same preview works OK. Please list the steps you took to reproduce the issue: 1. Create a SwiftUI component for WatchKit Extension with a Preview 2. Try to view the preview What did you expect to happen? Preview shows up What actually happened? Error “Command CompileSwiftSources failed with a nonzero exit code”, preview never shows up The command from “Build target WatchKit Extension - Log”: CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'WeathergraphWatchKitExtension' from project 'Weathergraph Independent') cd /Users/kafkat/Dev/weathergraph/weathergraph-ios export DEVELOPER_DIR\=/Applications/Xcode.app/Contents/Developer export SDKROOT\=/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator8.0.sdk /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name WeathergraphWatchKitExtension -Onone -enable-batch-mode -enforce-exclusivity\=checked @/Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/Objects-normal/arm64/WeathergraphWatchKitExtension.SwiftFileList -DDEBUG -sdk /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator8.0.sdk -target arm64-apple-watchos7.0-simulator -g -module-cache-path /Users/kafkat/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -application-extension -enable-testing -index-store-path /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Index/DataStore -swift-version 5 -I /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Products/Debug-watchsimulator -F /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Products/Debug-watchsimulator/PackageFrameworks -F /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Products/Debug-watchsimulator/PackageFrameworks -F /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Products/Debug-watchsimulator/PackageFrameworks -F /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Products/Debug-watchsimulator -c -j8 -output-file-map /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/Objects-normal/arm64/WeathergraphWatchKitExtension-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/Objects-normal/arm64/WeathergraphWatchKitExtension.swiftmodule -Xcc -I/Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/WeathergraphWatchKitExtension-generated-files.hmap -Xcc -I/Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/WeathergraphWatchKitExtension-own-target-headers.hmap -Xcc -I/Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/WeathergraphWatchKitExtension-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/WeathergraphWatchKitExtension-project-headers.hmap -Xcc -I/Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/SourcePackages/checkouts/promises/Sources/FBLPromises/include -Xcc -I/Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Products/Debug-watchsimulator/include -Xcc -I/Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/DerivedSources-normal/arm64 -Xcc -I/Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/DerivedSources/arm64 -Xcc -I/Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/DerivedSources -Xcc -DDEBUG\=1 -emit-objc-header -emit-objc-header-path /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/Previews/Weathergraph\ WatchKit\ App\ -\ Debug/Intermediates.noindex/Weathergraph\ Independent.build/Debug-watchsimulator/WeathergraphWatchKitExtension.build/Objects-normal/arm64/WeathergraphWatchKitExtension-Swift.h -import-objc-header /Users/kafkat/Dev/weathergraph/weathergraph-ios/Shared/Weathergraph-Bridging-Header.h -pch-output-dir /Users/kafkat/Library/Developer/Xcode/DerivedData/Weathergraph_Independent-apgbjjwodocdpiaehfrqnhmyfmsi/Build/Intermediates.noindex/PrecompiledHeaders -working-directory /Users/kafkat/Dev/weathergraph/weathergraph-ios -Xfrontend -enable-implicit-dynamic -Xfrontend -enable-private-imports -Xfrontend -enable-dynamic-replacement-chaining -Xfrontend -disable-previous-implementation-calls-in-dynamic-replacements
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!