Eureka: Segmentation Fault: 11 when build with Xcode 12

When building my project with Xcode 12, Eureka fails to build with a Segmentation Fault: 11 error. The error log begings like this:

1.	Apple Swift version 5.3 (swiftlang-1200.0.16.13 clang-1200.0.22.25)
2.	While evaluating request TypeCheckSourceFileRequest(source_file "<omitted>/Pods/Eureka/Source/Core/SelectableSection.swift")
3.	While evaluating request TypeCheckFunctionBodyUntilRequest(Eureka.(file).SelectableSectionType extension.selectedRows()@<omitted>/Pods/Eureka/Source/Core/SelectableSection.swift:76:17, )
4.	While type-checking statement at [<omitted>/Pods/Eureka/Source/Core/SelectableSection.swift:76:51 - line:79:5] RangeText="{
        let selectedRows: [BaseRow] = self.filter { $0 is SelectableRow && $0.baseValue != nil }
        return selectedRows.map { $0 as! SelectableRow }
    "
5.	While type-checking declaration 0x7fd43d09ab50 (at <omitted>/Pods/Eureka/Source/Core/SelectableSection.swift:77:9)
6.	While type-checking expression at [<omitted>/Pods/Eureka/Source/Core/SelectableSection.swift:77:39 - line:77:96] RangeText="self.filter { $0 is SelectableRow && $0.baseValue != nil "

Seems llvm is having trouble understanding this part in SelectableSection.swift:

     /**
     Returns the selected rows of this section. Should be used if selectionType is MultipleSelection
     */
    public func selectedRows() -> [SelectableRow] {
        let selectedRows: [BaseRow] = self.filter { $0 is SelectableRow && $0.baseValue != nil }
        return selectedRows.map { $0 as! SelectableRow }
    }

I tried rewrite it with compactMap or if let but no luck.

Did anyone succeed building Eureka with Xcode 12? Thanks!

Environment: Eureka 5.2.1 Xcode 12 beta 2 macOS 10.15.5

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 42 (15 by maintainers)

Most upvoted comments

Eureka 5.3.0 released!

I’ve submitted a workaround PR for this issue, if anyone’s interested:

https://github.com/xmartlabs/Eureka/pull/2061

FYI - still an issue in today’s Beta 5 release.

Hey all, #2061 has been merged into an xcode12 branch. The error is fixed there. If Apple doesn’t fix this error then we will merge this into master

so for this moment, podfile should be

pod 'Eureka', :git => 'https://github.com/xmartlabs/Eureka.git', :branch => 'xcode12'

It seems the issue will be there in the stable release so I will merge and try to create a release today. That being said, I still don’t know more details about the issue @jlcvp mentioned above and whether this is something we can fix with another workaround.

Still having the error on Beta 5. Clean build + Clean derived data

For me it works with Xcode 12 beta 5 when I use the xcode12 branch

The problem is also present on Xcode 11.6 released on 15-jul

Works for me in 11.6 (11E708), just not 12 b2.

@ShoaibPathan You should use version 5.3.0. Also try doing a clean and build

Hi @mats-claassen, I fully understand all the moving parts here, and that this may be an unreasonable question! But given the announcement that iOS 14 will be released tomorrow, could you please share your thoughts on the timing of this fix? Do you plan to have a compatible release ASAP, or do you plan to hold off until there is more clarity on reported issues, such as @jlcvp’s? That information would help me, and hopefully others, who plan to release iOS 14 updates for their apps ASAP. Thank you!

There is a bug report for this issue here: https://bugs.swift.org/browse/SR-13170. You can vote it up so that it might get more attention.


@jlcvp can you share the stacktrace and error message for your issue?

@mats-claassen I have a func that constructs a custom Row depending on the type received. This func uses generics in a fairly complex way, like this:

func myCustomRow<ACell: Cell<myCellViewModel>, ARow: Row<ACell>> (obj: ARow.Type, value: CustomCellValue, section: Section) where ARow: RowType, ACell: CellType {

branch xcode12 worked partially. It messes up when extending with generics because of the new “AnyObject” protocol on that branch

Xcode 12 Beta 6, same error. Any updates on it?

Hey all, #2061 has been merged into an xcode12 branch. The error is fixed there. If Apple doesn’t fix this error then we will merge this into master

Still an issue in Beta 6 😢

Still having the error on Beta 5. Clean build + Clean derived data

same

Thanks for reporting

I also see this crash in Xcode 12 beta 2. I hope this gets fixed in the next Xcode release if we all file a bug report to Apple.

Using allRows as mentioned by @daviwiki avoids the crash. However it is not the same behavior as before: currently only visible rows are filtered when doing a self.filter. For most cases that should be fine though. Hoping for Apple to fix the compiler.

@xiao99xiao lol, i’m so sorry, my bad. I was checking some combination and copy the wrong one 😅, this code probably generate and infinite recursion.

I want to write something like this:

public func selectedRows() -> [SelectableRow] {
   let selectedRows: [BaseRow] = self.allRows.filter { $0 is SelectableRow && $0.baseValue != nil }
   return selectedRows.map { $0 as! SelectableRow }
}