1 Reply
      Latest reply on Sep 22, 2016 1:45 AM by eskimo
      mpuza Level 1 Level 1 (0 points)



        I'm having troubles archiving my App using WeakArray (https://github.com/zaubara/WeakArray) that's included in a different framework. It looks a little like this:



             Crashlytics etc.

             Library (framework)








        I'd like to use WeakArray in Library and the App as well, and however I include the framework, the app builds and runs fine; archiving however throws this seg fault:

        1. While running pass #4733 SILModuleTransform "Mandatory Inlining".
        2. While deserializing decl #900 (XREF)
        3. Cross-reference to module 'WeakArray'
          ... WeakArray
          ... items


        I updated the framework only crudely to Swift 3, but it seems to run fine. The likely offending code:

        public struct WeakArray<T: AnyObject>: Sequence, CustomDebugStringConvertible, ExpressibleByArrayLiteral {
          // MARK: Private
          fileprivate typealias WeakObject = Weak<T>
          fileprivate var items = [WeakObject]()


        I can use WeakArray in MyPrivateFramework just fine, however reusing it in the Library or the App - no matter how I try and link or embed it again - doesn't seem to work. I had no issues in XC7.

        Maybe some compiler bug relating to generics? Thanks!

        • Re: XC8: Segmentation fault 11 while archiving
          eskimo Apple Staff Apple Staff (13,925 points)

          First things first, you should file a bug about this.  Regardless of whether your code is correct or incorrect (I suspect the former), the compiler shouldn’t crash.  Please post your bug number, just for the record.

          Do you use WeakArray in the interface to your framework?  If not, the easiest solution might be to have two copies of it, one in the app and one in the framework.  It’s a pretty small chunk of code aftar all.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"