Compiling a macro target on Windows in Release Mode hangs the Compiler

Tested on 5.9.2 release and 5.11 trunk development.

The compiler gets hung when compiling the macro target in release mode. Debug works just fine and results in a working binary.

Last output of the compiler:

ntax.build\SyntaxDeclNodes.swift.o -o F:\Projects\Kyanite\.build\x86_64-unknown-windows-msvc\release\SwiftSyntax.build\SyntaxExprNodes.swift.o -o F:\Projects\Kyanite\.build\x86_64-unknown-windows-msvc\release\SwiftSyntax.build\SyntaxNodes.swift.o -o F:\Projects\Kyanite\.build\x86_64-unknown-windows-msvc\release\SwiftSyntax.build\SyntaxPatternNodes.swift.o -o F:\Projects\Kyanite\.build\x86_64-unknown-windows-msvc\release\SwiftSyntax.build\SyntaxStmtNodes.swift.o -o F:\Projects\Kyanite\.build\x86_64-unknown-windows-msvc\release\SwiftSyntax.build\SyntaxTypeNodes.swift.o

SyntaxTypeNodes.swift.o is where both compiler versions are stuck so the issue seems to be reproducible.

Macro target:

.macro(
    name: "Macros",
    dependencies: [
        .product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
        .product(name: "SwiftCompilerPlugin", package: "swift-syntax")
    ],
    path: "scripting/macros"
),

Note:
The macro target build fails even when the source files are empty, so the issue does seem to be SwiftSyntax itself.

Edit:
Even the example macro target created via swift package init --type=macro fails

Would you be able to file an issue for this with detailed reproduction steps on GitHub?

1 Like
2 Likes