Skip to content

[SPI https://github.com/123flo321/pogoprotos-swift ]: swift build crashes when building package with 'swiftbuild' backend #9067

@kcieplak

Description

@kcieplak

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

swift build --buildsystem=swiftbuild crashes when building the https://github.com/123flo321/pogoprotos-swift package.

debug: PIF:     Added resource file '/workspace/spi-workdir/6D3BABBC-AC0B-4EE6-811F-B45117E08D65/pogoprotos-swift/.build-swiftbuild/checkouts/swift-protobuf/Sources/SwiftProtobufPluginLibrary/PrivacyInfo.xcprivacy'
debug: PIF:   Added linked dependency on target 'PACKAGE-TARGET:SwiftProtobuf'
debug: PIF: Created target 'PACKAGE-TARGET:SwiftProtobufPlugin' of type hostBuildTool and name 'SwiftProtobufPlugin'
debug: PIF:   Added dependency on target 'PACKAGE-TARGET:SwiftProtobuf'
debug: PIF:   Added dependency on target 'PACKAGE-TARGET:SwiftProtobufPluginLibrary'
SwiftBuildSupport/PackagePIFBuilder+Helpers.swift:518: Fatal error: Unexpectedly found nil while unwrapping an Optional value

*** Signal 4: Backtracing from 0x782dfb72dfbf... done ***

*** Program crashed: Illegal instruction at 0x0000782dfb72dfbf ***

Platform: x86_64 Linux (Debian GNU/Linux 12 (bookworm))

Thread 0 "swift-build":

  0  0x0000782df9d4f301 <unknown> in libc.so.6
...

Thread 1 "DispatchWorker" crashed:

  0                  0x0000782dfb72dfbf closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 623 in libswiftCore.so
  1 [ra]             0x0000782dfb8a2758 _assertionFailure(_:_:file:line:flags:) + 327 in libswiftCore.so
  2 [ra]             0x0000644bea42f0ba closure #1 in ResolvedModule.productRepresentingDependencyOfBuildPlugin(in:) + 297 in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PackagePIFBuilder+Helpers.swift:518:48
  3 [ra] [thunk]     0x0000644bea432b60 partial apply for closure #1 in ResolvedModule.productRepresentingDependencyOfBuildPlugin(in:) + 15 in swift-build at //<compiler-generated>
  4 [ra]             0x0000644bea43d21a Sequence.only(where:) + 729 in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PackagePIFBuilder+Helpers.swift:1171:20
  5 [ra]             0x0000644bea43cd0b ResolvedModule.productRepresentingDependencyOfBuildPlugin(in:) + 250 in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PackagePIFBuilder+Helpers.swift:513:28
  6 [ra]             0x0000644bea45d886 closure #2 in PackagePIFProjectBuilder.makePluginModule(_:) + 1093 in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PackagePIFProjectBuilder+Modules.swift:75:26
  7 [ra]             0x0000644bea430817 visitDependency #1 <A>(_:) in Collection<>.recursivelyTraverseDependencies(with:) + 950 in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PackagePIFBuilder+Helpers.swift:783:17
  8 [ra]             0x0000644bea442058 Collection<>.recursivelyTraverseDependencies(with:) + 807 in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PackagePIFBuilder+Helpers.swift:801:13
  9 [ra]             0x0000644bea441d12 ResolvedModule.recursivelyTraverseDependencies(with:) + 241 in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PackagePIFBuilder+Helpers.swift:761:16
 10 [ra]             0x0000644bea4727bd PackagePIFProjectBuilder.makePluginModule(_:) + 2044 in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PackagePIFProjectBuilder+Modules.swift:59:22
 11 [ra]             0x0000644bea45bcbf PackagePIFBuilder.build() + 4734 in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PackagePIFBuilder.swift:494:36
 12 [ra]             0x0000644bea416711 closure #1 in PIFBuilder.constructPIF(buildParameters:) + 4080 in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PIFBuilder.swift:421:39
 13 [async] [thunk]  0x0000644bea41d810 partial apply for closure #1 in PIFBuilder.constructPIF(buildParameters:) in swift-build at //<compiler-generated>
 14 [async]          0x0000644bea411250 memoize<A>(to:build:) in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PIFBuilder.swift:32
 15 [async]          0x0000644bea4135c0 PIFBuilder.constructPIF(buildParameters:) in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PIFBuilder.swift:245
 16 [async]          0x0000644bea412540 PIFBuilder.generatePIF(prettyPrint:preservePIFModelStructure:printPIFManifestGraphviz:buildParameters:) in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/PIFBuilder.swift:178
 17 [async]          0x0000644bea4b9ea0 SwiftBuildSystem.writePIF(buildParameters:) in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/SwiftBuildSystem.swift:893
 18 [async]          0x0000644bea4b98d0 SwiftBuildSystem.build(subset:buildOutputs:) in swift-build at /workspace/swift-package-manager/Sources/SwiftBuildSupport/SwiftBuildSystem.swift:352
 19 [async] [thunk]  0x0000644bea4cb820 protocol witness for BuildSystem.build(subset:buildOutputs:) in conformance SwiftBuildSystem in swift-build at //<compiler-generated>
 20 [async]          0x0000644be82fb2c0 SwiftBuildCommand.build(_:subset:productsBuildParameters:toolsBuildParameters:) in swift-build at /workspace/swift-package-manager/Sources/Commands/SwiftBuildCommand.swift:200
 21 [async]          0x0000644be82f9b30 SwiftBuildCommand.run(_:) in swift-build at /workspace/swift-package-manager/Sources/Commands/SwiftBuildCommand.swift:173
 22 [async] [thunk]  0x0000644be83006a0 protocol witness for AsyncSwiftCommand.run(_:) in conformance SwiftBuildCommand in swift-build at //<compiler-generated>
 23 [async]          0x0000644be8534930 AsyncSwiftCommand.run() in swift-build at /workspace/swift-package-manager/Sources/CoreCommands/SwiftCommandState.swift:175
 24 [async] [thunk]  0x0000644be83007a0 protocol witness for AsyncParsableCommand.run() in conformance SwiftBuildCommand in swift-build at //<compiler-generated>
 25 [async]          0x0000644be79951c0 static AsyncParsableCommand.main(_:) in swift-build at /workspace/swift-package-manager/.build/checkouts/swift-argument-parser/Sources/ArgumentParser/Parsable Types/AsyncParsableCommand.swift:41
 26 [async]          0x0000644be7995550 static AsyncParsableCommand.main() in swift-build at /workspace/swift-package-manager/.build/checkouts/swift-argument-parser/Sources/ArgumentParser/Parsable Types/AsyncParsableCommand.swift:61
 27 [async]          0x0000644bebc3d950 static Entrypoint.main() in swift-build at /workspace/swift-package-manager/Sources/swift-build/Entrypoint.swift:18
 28 [async] [system] 0x0000644bebc3da50 static Entrypoint.$main() in swift-build at //<compiler-generated>
 29 [async] [system] 0x0000644bebc3db60 async_MainTQ0_ in swift-build at //<compiler-generated>
 30 [async] [thunk]  0x0000644bebc3dbf0 thunk for @escaping @convention(thin) @async () -> () in swift-build at //<compiler-generated>
 31 [async] [thunk]  0x0000644bebc3dce0 partial apply for thunk for @escaping @convention(thin) @async () -> () in swift-build at //<compiler-generated>
 32 [async] [system] 0x0000782dfb590e10 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) in libswift_Concurrency.so
...

Expected behavior

Does not crash

Actual behavior

Crashes

Steps to reproduce

git clone https://github.com/123flo321/pogoprotos-swift
swift build --build-system=swiftbuild

Swift Package Manager version/commit hash

No response

Swift & OS version (output of swift --version ; uname -a)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbuild systemChanges to interactions with build systemsswift buildChanges impacting `swift build`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions