apple / apple/swift-binary-parsing

Can't build test target on Windows

Open
#53 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
387
Forks
24
Avg merge
1h 3m
Merged PRs (30d)
2

Description

Can't build the test target on Windows machine.

**BinaryParsing version:** `0.0.1` or the `main` branch.
**Swift version:**
```
Swift version 6.2.3 (swift-6.2.3-RELEASE)
Target: x86_64-unknown-windows-msvc
Build config: +assertions
```

### Checklist
- [x] If possible, I've reproduced the issue using the `main` branch of this package
- [x] I've searched for [existing GitHub issues](https://github.com/apple/swift-binary-parsing/issues)

### Steps to Reproduce
1. Clone repo
2. Open it in VS Code
3. Try Build All

### Expected behavior
The project compiles.

### Actual behavior
Many errors from linker:
```
> C:\Users\Hemet\AppData\Local\Programs\Swift\Toolchains\6.2.3+Asserts\usr\bin\swift.exe build --build-tests -Xlinker -debug:dwarf
Building for debugging...
Internal Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "Corrupted JSON", underlyingError: Optional(unexpected end of file)))
Internal Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "Corrupted JSON", underlyingError: Optional(unexpected end of file)))
lld-link: error: duplicate symbol: $s11SwiftSyntax0B8ProtocolP0aB14MacroExpansionE6expand6macros2in16indentationWidthAA0B0VSDySS0aB6Macros0D0_pXpG_qd__AA6TriviaVSgtAK0dE7ContextRd__lF
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)
lld-link: error: duplicate symbol: $s11SwiftSyntax0B8ProtocolP0aB14MacroExpansionE6expand6macros16contextGenerator16indentationWidthAA0B0VSDySS0aB6Macros0D0_pXpG_qd__AJcAA6TriviaVSgtAK0dE7ContextRd__lF
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
lld-link: error: duplicate symbol: $s11SwiftSyntax0B8ProtocolP0aB14MacroExpansionE6expand10macroSpecs16contextGenerator16indentationWidthAA0B0VSDySSAD0D4SpecVG_qd__AJcAA6TriviaVSgt0aB6Macros0dE7ContextRd__lF
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverC13removingWhereACSb0aB00eB0Vc_tcfC
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverC13removingWhereACSb0aB00eB0Vc_tcfc
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverC5visity0aB00e4ListB0VAGF
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverC5visity0aB005TokenB0VAGF
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverC8viewModeAC0aB00b8TreeViewH0O_tcfC
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverCfE
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverCfd
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverCfD
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverCMa
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion0C11SystemErrorOs0F0AAMc
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverCMn
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion0C6SystemVMa
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion0C11SystemErrorOMa
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverC8viewModeAC0aB00b8TreeViewH0O_tcfc
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverC9predicateySb0aB00eB0VcvpWvd
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion16AttributeRemoverC014triviaToAttachH9NextToken0aB06TriviaVvpWvd
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: duplicate symbol: $s25SwiftSyntaxMacroExpansion0C6SystemVMn
>>> defined at E:\\Projects\\swift-binary-parsing\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftSyntaxMacroExpansion-tool.build\\MacroSystem.swift.o
>>> defined at libMacroSupport.a(MacroSystem.swift.o)

lld-link: error: too many errors emitted, stopping now (use /errorlimit:0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[126/127] Linking swift-binary-parsingPackageTests.xctest
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported `swift.exe build --build-tests -Xlinker -debug:dwarf` command on Windows from a fresh clone of the main branch. Inspect the package's test-target and SwiftSyntax macro build configuration, then verify that the test target links without duplicate symbols and completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.