-
Notifications
You must be signed in to change notification settings - Fork 187
Description
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:
- Create a Swift package that depends on swift-async-algorithms.
- Open the package in Xcode and verify that it builds successfully.
- 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
- 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.