rhx / SwiftGtk

A Swift wrapper around gtk-3.x and gtk-4.x that is largely auto-generated from gobject-introspection
https://rhx.github.io/SwiftGtk/
BSD 2-Clause "Simplified" License
325 stars 26 forks source link

Not building with Swift 5.2 on Linux #31

Closed lschmierer closed 4 years ago

lschmierer commented 4 years ago

My project stopped working. I am getting a bunch of the following errors:

/GLibObject/GObject-2.0-unions.swift:378:45: error: value of tuple type 'Void' has no member 'v_int'
            let rv: Int = cast(_ptr.pointee.v_int)
swift --version
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.5.0

Edit: On Ubuntu 18.04 I am getting:

GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
Dadoum commented 4 years ago

same here:

/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
/home/dadoum/Téléchargements/SwiftHelloGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-unions.swift:1094:30: error: cannot convert value of type 'Int' to specified type 'UInt64'
            let rv: UInt64 = cast(_ptr.pointee.v_int64)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                             UInt64(                   )
lschmierer commented 4 years ago

The latest commits fixed this on macOS. Thanks a lot, great work!

On Linux, it is still not wokring Different Errors are thrown, mostly

.../.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:96:77: error: use of unresolved identifier 'cast'
    g_logv(nil, level.value, msg, CVaListPointer(_fromUnsafeMutablePointer: cast(msg)))

and

.../.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-BookmarkFile.swift:631:47: error: cannot convert value of type 'UnsafeMutablePointer<UnsafeMutablePointer<gchar>?>?' (aka 'Optional<UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>>') to expected argument type 'UnsafeMutablePointer<UnsafePointer<gchar>?>?' (aka 'Optional<UnsafeMutablePointer<Optional<UnsafePointer<Int8>>>>')
        g_bookmark_file_set_groups(_ptr, uri, groups, gsize(length))
rhx commented 4 years ago

Should work on Linux now (tested with Ubuntu 18.04 and 20.04). Can you try

./distclean.sh
git pull
./build.sh

and see if this works for you now?

lschmierer commented 4 years ago

Great, works 👍

rhx commented 4 years ago

👍