Skip to content

Archive Fails When Building XCFramework from Swift Package when using swift-async-algorithms #376

@KrishnaKishore1992

Description

@KrishnaKishore1992

We have a Swift package that consumes the swift-async-algorithms package, and it works as expected in Xcode. We are trying to generate an XCFramework(Swift Package) for Objective-C bridging. While the build process in Xcode works without issues, the archive process via xcodebuild fails with multiple errors.

Steps to Reproduce:

  1. Create a Swift package that depends on swift-async-algorithms.
  2. Open the package in Xcode and verify that it builds successfully.
  3. Run the following xcodebuild command to archive and create an XCFramework:

xcodebuild -project "Library.xcodeproj" archive \ -scheme "Library" \ -configuration Release \ -archivePath "build/Library-ios.xcarchive" \ -destination "generic/platform=iOS" \ -derivedDataPath "build" \ -IDECustomBuildProductsPath="" \ -IDECustomBuildIntermediatesPath="" \ ENABLE_BITCODE=NO \ SKIP_INSTALL=NO \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES

  1. Observe the errors during the xcodebuild archive step.

Expected Behavior:

The Swift package should be successfully archived, allowing us to generate the XCFramework for use in Objective-C projects.

Actual Behavior:

The following errors occur during the archive step:

`EmitSwiftModule normal arm64 (in target 'InternalCollectionsUtilities' from project 'swift-collections')
cd ....

/....Sources/InternalCollectionsUtilities/autogenerated/LifetimeOverride.swift:107:6: error: a function cannot return a ~Escapable result
) -> T {
^
/....Sources/InternalCollectionsUtilities/autogenerated/LifetimeOverride.swift:104:2: error: '@_lifetime' attribute is only valid when experimental feature Lifetimes is enabled
@_lifetime(immortal)
^
/....Sources/InternalCollectionsUtilities/autogenerated/LifetimeOverride.swift:125:6: error: a function cannot return a ~Escapable result
) -> T {
^
/....Sources/InternalCollectionsUtilities/autogenerated/LifetimeOverride.swift:120:2: error: '@_lifetime' attribute is only valid when experimental feature Lifetimes is enabled
@_lifetime(borrow source)
^
/....Sources/InternalCollectionsUtilities/autogenerated/LifetimeOverride.swift:143:6: error: a function cannot return a ~Escapable result
) -> T {
^
/....Sources/InternalCollectionsUtilities/autogenerated/LifetimeOverride.swift:138:2: error: '@_lifetime' attribute is only valid when experimental feature Lifetimes is enabled
@_lifetime(copy source)
^
/....Sources/InternalCollectionsUtilities/autogenerated/LifetimeOverride.swift:163:6: error: a function cannot return a ~Escapable result
) -> T {
^
/....Sources/InternalCollectionsUtilities/autogenerated/LifetimeOverride.swift:162:12: error: a function cannot have a ~Escapable 'inout' parameter 'source' in addition to other ~Escapable parameters
mutating source: inout U
^
/....Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:412:49: error: 'Span' is only available in iOS 12.2 or newer
public func _initializePrefix(copying source: Span) -> Int {
^
/....Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:412:15: note: add '@available' attribute to enclosing instance method
public func _initializePrefix(copying source: Span) -> Int {
^
/....Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:374:1: note: add '@available' attribute to enclosing extension
extension UnsafeMutableBufferPointer {
^
/....Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:442:63: error: 'Span' is only available in iOS 12.2 or newer
public mutating func _initializeAndDropPrefix(copying span: Span) {
^
/....Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:442:24: note: add '@available' attribute to enclosing instance method
public mutating func _initializeAndDropPrefix(copying span: Span) {
^
/....Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:374:1: note: add '@available' attribute to enclosing extension
extension UnsafeMutableBufferPointer {
^
/....Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:413:12: error: 'withUnsafeBufferPointer' is only available in iOS 12.2 or newer
source.withUnsafeBufferPointer { self._initializePrefix(copying: $0) }
^
/....Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:413:12: note: add 'if #available' version check
source.withUnsafeBufferPointer { self._initializePrefix(copying: $0) }
^
/....Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:412:15: note: add '@available' attribute to enclosing instance method
public func _initializePrefix(copying source: Span) -> Int {
^
/....Sources/InternalCollectionsUtilities/autogenerated/UnsafeMutableBufferPointer+Extras.swift:374:1: note: add '@available' attribute to enclosing extension
extension UnsafeMutableBufferPointer {
`

Environment:
Xcode version: 26.x
Swift version: 5, 6
Platform(s): iOS
swift-async-algorithms version: latest
Additional Context:
We need to archive this package into an XCFramework for Objective-C bridging. The issue only occurs during the archive step and not during the build process within Xcode.

Can you please help us ASAP. 😊

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions