RxSwift: Build fails on Linux with Swift 5.0

On Linux with Swift 5.0 release and RxSwift at cce95dd704bc08cd3d69c087a05a6fc3118e2722, doing a swift build fails:

/home/keith/dev/RxSwift/Sources/RxSwift/Platform.Linux.swift:26:27: error: cannot assign to property: 'threadDictionary' setter is inaccessible
            currentThread.threadDictionary = threadDictionary
            ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 35 (35 by maintainers)

Most upvoted comments

Okay, I’ve uncovered an unfortunate roadblock to Swift 5 on Linux. The patch to open-source Foundation has another backward-incompatible side-effect in addition to the compilation problem: Thread.threadDictionary now rejects values it can’t convert to NSObject. Why does that matter? Well, one of the values that ends up in there is of the type RxMutableBox<Queue<ScheduledItemType>> and it is very not convertible to NSObject. So code that leads down this path just crashes on Linux + Swift 5 now with this error:

Could not cast value of type 'RxSwift.RxMutableBox<RxSwift.Queue<RxSwift.ScheduledItemType>>' (0x55f49961f930) to 'Foundation.NSObject' (0x7f8bcf936c48).

@freak4pc Yes, we are keeping 4.0 support for CocoaPods and Carthage. I’ve only removed it for swift package manager.

We are using Xcode 10.2 for CI: https://github.com/ReactiveX/RxSwift/blob/83fee4e3234a04d28b93cbb293d88bfdba537789/.travis.yml#L36-L38

Is there some problem that you see in the develop branch? I’m not sure I understand.

It’s reported here because the cause is the same as the original compile-time issue Keith encountered.