-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Extension Macro fails with nonzero exit code on compile #67620
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Comments
Still running into this on the newest toolchain 2023-08-03 |
I was able to reproduce this issue on the nightly Swift release 2023-08-12 Running eg. a modified main.swift import KeyPathIterable
@KeyPathIterable
struct Thing {
var foo: Double
var bar: Double
}
var thing = Thing(foo: 1, bar: 20)
for keyPath in Thing.keyPaths {
debugPrint(keyPath)
}
print("Hello")
Building for debugging...
error: emit-module command failed due to signal 6 (use -v to see invocation)
...
Assertion failed: (conformance->isComplete() || allowCompilerErrors()), function writeLocalNormalProtocolConformance, file Serialization.cpp, line 1669.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2023-08-12-a.xctoolchain/usr/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /Users/viranchee/Documents/KeyPathIterable/Sources/MyMacroClient/main.swift -target arm64-apple-macosx10.15 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -I /Users/viranchee/Documents/KeyPathIterable/.build/arm64-apple-macosx/debug -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -module-cache-path /Users/viranchee/Documents/KeyPathIterable/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2023-08-12-a.xctoolchain/usr/bin/swift-driver -entry-point-function-name MyMacroClient_main -load-plugin-executable /Users/viranchee/Documents/KeyPathIterable/.build/arm64-apple-macosx/debug/KeyPathIterableMacro#KeyPathIterableMacro -empty-abi-descriptor -resource-dir /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2023-08-12-a.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name MyMacroClient -package-name keypathiterable -target-sdk-version 13.3 -target-sdk-name macosx13.3 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2023-08-12-a.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2023-08-12-a.xctoolchain/usr/local/lib/swift/host/plugins -emit-module-doc-path /Users/viranchee/Documents/KeyPathIterable/.build/arm64-apple-macosx/debug/MyMacroClient.swiftdoc -emit-module-source-info-path /Users/viranchee/Documents/KeyPathIterable/.build/arm64-apple-macosx/debug/MyMacroClient.swiftsourceinfo -emit-dependencies-path /Users/viranchee/Documents/KeyPathIterable/.build/arm64-apple-macosx/debug/MyMacroClient.build/MyMacroClient.emit-module.d -o /Users/viranchee/Documents/KeyPathIterable/.build/arm64-apple-macosx/debug/MyMacroClient.swiftmodule -emit-abi-descriptor-path /Users/viranchee/Documents/KeyPathIterable/.build/arm64-apple-macosx/debug/MyMacroClient.abi.json
1. Apple Swift version 5.9-dev (LLVM fd38736063c15cd, Swift a533c63d783f5b8)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Non-Diagnostic Mandatory Optimizations, Serialization, Rest of Onone } on SIL for MyMacroClient)
4. While running pass #48 SILModuleTransform "SerializeSILPass".
5. While serializing protocol conformance to 'KeyPathIterable' (in module 'KeyPathIterable') for type 'Thing' (declared at [/Users/viranchee/Documents/KeyPathIterable/Sources/MyMacroClient/main.swift:4:1 - line:7:1] RangeText="struct Thing {
var foo: Double
var bar: Double
")
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000105df0d80 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000105df0124 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x0000000105df13c0 SignalHandler(int) + 304
3 libsystem_platform.dylib 0x00000001a0a9aa24 _sigtramp + 56
4 libsystem_pthread.dylib 0x00000001a0a6bc28 pthread_kill + 288
5 libsystem_c.dylib 0x00000001a0979ae8 abort + 180
6 libsystem_c.dylib 0x00000001a0978e44 err + 0
7 swift-frontend 0x00000001060b4ee8 swift::serialization::Serializer::addConformanceRef(swift::ProtocolConformance*) (.cold.1) + 0
8 swift-frontend 0x0000000101bdb088 swift::serialization::Serializer::writeLocalNormalProtocolConformance(swift::NormalProtocolConformance*) + 2008
9 swift-frontend 0x0000000101bee058 swift::serialization::Serializer::writeAllDeclsAndTypes() + 65532
10 swift-frontend 0x0000000101beff9c swift::serialization::Serializer::writeAST(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>) + 3768
11 swift-frontend 0x0000000101bf8768 swift::serialization::Serializer::writeToStream(llvm::raw_ostream&, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SILModule const*, swift::SerializationOptions const&, swift::fine_grained_dependencies::SourceFileDepGraph const*) + 936
12 swift-frontend 0x00000001011e2f4c bool llvm::function_ref<bool (llvm::raw_pwrite_stream&)>::callback_fn<swift::serialize(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SerializationOptions const&, swift::symbolgraphgen::SymbolGraphOptions const&, swift::SILModule const*, swift::fine_grained_dependencies::SourceFileDepGraph const*)::$_3>(long, llvm::raw_pwrite_stream&) + 96
13 swift-frontend 0x0000000100e42b98 swift::withOutputPath(swift::DiagnosticEngine&, llvm::vfs::OutputBackend&, llvm::StringRef, llvm::function_ref<bool (llvm::raw_pwrite_stream&)>) + 168
14 swift-frontend 0x00000001011e2b58 swift::serialize(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SerializationOptions const&, swift::symbolgraphgen::SymbolGraphOptions const&, swift::SILModule const*, swift::fine_grained_dependencies::SourceFileDepGraph const*) + 192
15 swift-frontend 0x0000000100fe8ffc bool llvm::function_ref<bool (swift::fine_grained_dependencies::SourceFileDepGraph&&)>::callback_fn<performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*)::$_33::operator()() const::'lambda'(swift::fine_grained_dependencies::SourceFileDepGraph&&)>(long, swift::fine_grained_dependencies::SourceFileDepGraph&&) + 40
16 swift-frontend 0x0000000102546090 swift::fine_grained_dependencies::withReferenceDependencies(llvm::PointerUnion<swift::ModuleDecl const*, swift::SourceFile const*>, swift::DependencyTracker const&, llvm::vfs::OutputBackend&, llvm::StringRef, bool, llvm::function_ref<bool (swift::fine_grained_dependencies::SourceFileDepGraph&&)>) + 164
17 swift-frontend 0x0000000100fe8f70 std::__1::__function::__func<performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*)::$_33, std::__1::allocator<performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*)::$_33>, void ()>::operator()() + 296
18 swift-frontend 0x0000000101cecab4 swift::SILModule::serialize() + 44
19 swift-frontend 0x0000000101a096a8 SerializeSILPass::run() + 156
20 swift-frontend 0x00000001018b77ac swift::SILPassManager::runModulePass(unsigned int) + 980
21 swift-frontend 0x00000001018bd6c8 swift::SILPassManager::execute() + 624
22 swift-frontend 0x00000001018b472c swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 68
23 swift-frontend 0x00000001018b46b0 swift::ExecuteSILPipelineRequest::evaluate(swift::Evaluator&, swift::SILPipelineExecutionDescriptor) const + 68
24 swift-frontend 0x00000001018f5058 swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 28
25 swift-frontend 0x00000001018de5a8 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) + 252
26 swift-frontend 0x00000001018b4920 swift::executePassPipelinePlan(swift::SILModule*, swift::SILPassPipelinePlan const&, bool, swift::irgen::IRGenModule*) + 84
27 swift-frontend 0x00000001018e08fc swift::runSILPassesForOnone(swift::SILModule&) + 80
28 swift-frontend 0x00000001011b606c swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 260
29 swift-frontend 0x0000000100fe5338 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 792
30 swift-frontend 0x0000000100fe4c5c swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1164
31 swift-frontend 0x0000000100ff3dd4 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
32 swift-frontend 0x0000000100fe7584 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 740
33 swift-frontend 0x0000000100fe6508 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2496
34 swift-frontend 0x0000000100e1ff04 swift::mainEntry(int, char const**) + 2144
35 dyld 0x00000001a0713f28 start + 2236 Running again:
Building for debugging...
warning: Could not open '/Users/viranchee/Documents/KeyPathIterable/.build/arm64-apple-macosx/debug/MyMacroClient.swiftmodule'
[2/2] Linking MyMacroClient
Build complete! (0.65s)
\Thing.foo
\Thing.bar
Hello |
This is fixed in nightly 2023-08-27 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
I'm creating an extension macro in a swift package.
On compiling the executable target that is using my Macro I get the following:
Command SwiftEmitModule failed with a nonzero exit code
Steps to reproduce
This can be reproduced as follows:
Package.swift file with the following:
Sources/MyMacroClient/main.swift:
Sources/KeyPathIterable/KeyPathIterable.swift
Sources/KeyPathIterableMacro/KeyPathIterableMacro.swift
Expected behavior
Macro would compile or give me better compiler errors to fix my code.
Environment
Apple Swift version 5.9-dev (LLVM 9b562f55c38e378, Swift b4ee68b)
Target: arm64-apple-macosx13.0
Xcode 15.0
Build version 15A5209g
The text was updated successfully, but these errors were encountered: