Skip to content

Build fails if BUILD_LIBRARY_FOR_DISTRIBUTION is set to YES #94

@danieleformichelli

Description

@danieleformichelli

Hello,
At Tuist we cache project's frameworks via xcframeworks and thus we add BUILD_LIBRARY_FOR_DISTRIBUTION=YES to xcodebuild command when building. This has worked fine but it's a problem when a project depends on swift-collections as build fails if we specify the BUILD_LIBRARY_FOR_DISTRIBUTION setting.

How hard would it be to make compilation work also with this flag?

Information

  • Package version: 0.0.7
  • Platform version: macOS 11.5.1
  • Swift version: Apple Swift version 5.4.2 (swiftlang-1205.0.28.2 clang-1205.0.19.57) Target: x86_64-apple-darwin20.6.0

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • I've searched for existing GitHub issues.

Steps to Reproduce

Run swift build -Xswiftc -enable-library-evolution

Expected behavior

Build should work fine

Actual behavior

Build fails with error:

swift build -Xswiftc -enable-library-evolution                                                                                                               15:09:48
/wrkdir/swift-collections/Sources/DequeModule/_DequeBuffer.swift:14:3: error: deinitializer can only be '@inlinable' if the class is '@_fixed_layout'
  @inlinable
  ^~~~~~~~~~

/wrkdir/swift-collections/Sources/DequeModule/_DequeBuffer.swift:14:3: error: deinitializer can only be '@inlinable' if the class is '@_fixed_layout'
  @inlinable
  ^~~~~~~~~~

/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:26:10: error: 'let' property 'first' may not be initialized directly; use "self.init(...)" or "self = ..." instead
    self.first = first
         ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:15:16: note: 'first' declared here
  internal let first: UnsafeBufferPointer<Element>
               ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:27:10: error: 'let' property 'second' may not be initialized directly; use "self.init(...)" or "self = ..." instead
    self.second = second
         ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:18:16: note: 'second' declared here
  internal let second: UnsafeBufferPointer<Element>?
               ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:68:10: error: 'let' property 'first' may not be initialized directly; use "self.init(...)" or "self = ..." instead
    self.first = first
         ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:57:16: note: 'first' declared here
  internal let first: UnsafeMutableBufferPointer<Element>
               ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:69:10: error: 'let' property 'second' may not be initialized directly; use "self.init(...)" or "self = ..." instead
    self.second = second?.count == 0 ? nil : second
         ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:60:16: note: 'second' declared here
  internal let second: UnsafeMutableBufferPointer<Element>?
               ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:26:10: error: 'let' property 'first' may not be initialized directly; use "self.init(...)" or "self = ..." instead
    self.first = first
         ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:15:16: note: 'first' declared here
  internal let first: UnsafeBufferPointer<Element>
               ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:27:10: error: 'let' property 'second' may not be initialized directly; use "self.init(...)" or "self = ..." instead
    self.second = second
         ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:18:16: note: 'second' declared here
  internal let second: UnsafeBufferPointer<Element>?
               ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:68:10: error: 'let' property 'first' may not be initialized directly; use "self.init(...)" or "self = ..." instead
    self.first = first
         ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:57:16: note: 'first' declared here
  internal let first: UnsafeMutableBufferPointer<Element>
               ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:69:10: error: 'let' property 'second' may not be initialized directly; use "self.init(...)" or "self = ..." instead
    self.second = second?.count == 0 ? nil : second
         ^
/wrkdir/swift-collections/Sources/DequeModule/_UnsafeWrappedBuffer.swift:60:16: note: 'second' declared here
  internal let second: UnsafeMutableBufferPointer<Element>?
               ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:31:12: error: 'let' property '_header' may not be initialized directly; use "self.init(...)" or "self = ..." instead
      self._header = header
           ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:16:9: note: '_header' declared here
    let _header: UnsafeMutablePointer<_DequeBufferHeader>
        ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:32:12: error: 'let' property '_elements' may not be initialized directly; use "self.init(...)" or "self = ..." instead
      self._elements = elements
           ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:18:9: note: '_elements' declared here
    let _elements: UnsafeMutablePointer<Element>
        ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:34:12: error: 'let' property '_isMutable' may not be initialized directly; use "self.init(...)" or "self = ..." instead
      self._isMutable = isMutable
           ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:21:9: note: '_isMutable' declared here
    let _isMutable: Bool
        ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:31:12: error: 'let' property '_header' may not be initialized directly; use "self.init(...)" or "self = ..." instead
      self._header = header
           ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:16:9: note: '_header' declared here
    let _header: UnsafeMutablePointer<_DequeBufferHeader>
        ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:32:12: error: 'let' property '_elements' may not be initialized directly; use "self.init(...)" or "self = ..." instead
      self._elements = elements
           ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:18:9: note: '_elements' declared here
    let _elements: UnsafeMutablePointer<Element>
        ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:34:12: error: 'let' property '_isMutable' may not be initialized directly; use "self.init(...)" or "self = ..." instead
      self._isMutable = isMutable
           ^
/wrkdir/swift-collections/Sources/DequeModule/Deque._UnsafeHandle.swift:21:9: note: '_isMutable' declared here
    let _isMutable: Bool
        ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:31:21: error: 'self' used before 'self.init' call or assignment to 'self'
      self._storage = _storage
                    ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:32:22: error: 'self' used before 'self.init' call or assignment to 'self'
      self._nextSlot = start
                     ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:33:21: error: 'self' used before 'self.init' call or assignment to 'self'
      self._endSlot = end
                    ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:34:5: error: 'self.init' isn't called on all paths before returning from initializer
    }
    ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:31:21: error: 'self' used before 'self.init' call or assignment to 'self'
      self._storage = _storage
                    ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:32:22: error: 'self' used before 'self.init' call or assignment to 'self'
      self._nextSlot = start
                     ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:33:21: error: 'self' used before 'self.init' call or assignment to 'self'
      self._endSlot = end
                    ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:34:5: error: 'self.init' isn't called on all paths before returning from initializer
    }
    ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:31:21: error: 'self' used before 'self.init' call or assignment to 'self'
      self._storage = _storage
                    ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:32:22: error: 'self' used before 'self.init' call or assignment to 'self'
      self._nextSlot = start
                     ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:33:21: error: 'self' used before 'self.init' call or assignment to 'self'
      self._endSlot = end
                    ^
/wrkdir/swift-collections/Sources/DequeModule/Deque+Collection.swift:34:5: error: 'self.init' isn't called on all paths before returning from initializer
    }
    ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions