SwiftyJSON icon indicating copy to clipboard operation
SwiftyJSON copied to clipboard

Compilation breaks in Swift 5.1 Ubuntu 16.04

Open moshegottlieb opened this issue 4 years ago • 4 comments

What did you do?

Build a program that uses SwiftyJSON 5.0.0 as a dependency on Ubuntu 16.04

What did you expect to happen?

Compile cleanly

What actually happened instead?

Compilation failed:

.build/checkouts/SwiftyJSON/Source/SwiftyJSON/SwiftyJSON.swift:1215:51: error: ambiguous use of operator '<'
    case (.number, .number): return lhs.rawNumber < rhs.rawNumber
                                                  ^
.build/checkouts/SwiftyJSON/Source/SwiftyJSON/SwiftyJSON.swift:1251:6: note: found this candidate
func < (lhs: NSNumber, rhs: NSNumber) -> Bool {
     ^
Foundation.NSNumber:2:24: note: found this candidate
    public static func < (lhs: NSNumber, rhs: NSNumber) -> Bool
                       ^

Environment

List the software versions you're using:

  • SwiftyJSON: 5.0.0
  • Linux Version: Ubuntu 16.04.6 LTS
  • Swift Version: Swift version 5.1 (swift-5.1-RELEASE) Target: x86_64-unknown-linux-gnu

Please also mention which package manager you used and its version. Delete the other package managers in this list:

  • Swift Package Manager: Swift Package Manager - Swift 5.1.0 (790a0c9)

moshegottlieb avatar Sep 23 '19 07:09 moshegottlieb

I am facing the same issue... except my Linux distro is OpenSuse Leap 15.1 but Swift and SwiftyJSON versions are the same.

rssole avatar Jan 17 '20 21:01 rssole

Also an issue on Ubuntu 18.04.4, Swift 5.2.3, and SwiftyJSON 5.0

DarylWM avatar Jun 25 '20 10:06 DarylWM

This is still an issue in Ubuntu 21.04

Duplicate issue of #1087

GregHilston avatar Dec 23 '21 14:12 GregHilston

I just ran across this issue as well, and commented on it here: #1091

My conclusion is that Foundation on linux has NSNumber conforming to Comparator, while Foundation on apple platforms does not. Seems like a simple #if os(Linux) and possibly os(Windows) can fix this problem.

bhirt avatar Aug 22 '23 04:08 bhirt