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
317 stars 26 forks source link

Cant compile Gtk on Swift 4.2.1 (Ubuntu 16 and macOS) #11

Closed ChiellieNL closed 5 years ago

ChiellieNL commented 5 years ago

Your framework sounds very interesting, so tried to clone and build it (by using ./build.sh). During compilation it always fails on Gtk:

Sources/Gtk/Gtk-3.0-ScaleAccessiblePrivate-TableChild.swift:1469:62: error: cannot convert value of type 'UnsafeMutablePointer<guchar>' (aka 'UnsafeMutablePointer<UInt8>') to expected argument type 'UnsafeMutablePointer<_>'

Tried it both on Ubuntu 16 as macOS 10.14.2 (both Swift 4.2.1). Not sure which gtk version on ubuntu, on my Mac it's 3.22.30

rhx commented 5 years ago

Yes, this was a regression in the code generated by gir2swift in preparation for Swift 5. Can you pull and try again, and let me know, please? - Things should work again now, but make sure you run ./distclean.sh first (to ensure the new version of gir2swift gets used).

ChiellieNL commented 5 years ago

Now it fails on compiling GLib

Compile Swift Module 'GLib' (6 sources)
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "glib_bridging.h"
        ^
glib_bridging.h:196:10: error: 'glib-unix.h' file not found
#include <glib-unix.h>
         ^
Sources/GLib/Error.swift:14:8: error: could not build Objective-C module 'CGLib'
import CGLib
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "glib_bridging.h"
        ^
glib_bridging.h:196:10: error: 'glib-unix.h' file not found
#include <glib-unix.h>
         ^
Sources/GLib/Error.swift:14:8: error: could not build Objective-C module 'CGLib'
import CGLib
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "glib_bridging.h"
        ^
glib_bridging.h:196:10: error: 'glib-unix.h' file not found
#include <glib-unix.h>
         ^
Sources/GLib/Error.swift:14:8: error: could not build Objective-C module 'CGLib'
import CGLib
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "glib_bridging.h"
        ^
glib_bridging.h:196:10: error: 'glib-unix.h' file not found
#include <glib-unix.h>
         ^
Sources/GLib/Error.swift:14:8: error: could not build Objective-C module 'CGLib'
import CGLib
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "glib_bridging.h"
        ^
glib_bridging.h:196:10: error: 'glib-unix.h' file not found
#include <glib-unix.h>
         ^
Sources/GLib/Error.swift:14:8: error: could not build Objective-C module 'CGLib'
import CGLib
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "glib_bridging.h"
        ^
glib_bridging.h:196:10: error: 'glib-unix.h' file not found
#include <glib-unix.h>
         ^
Sources/GLib/Error.swift:14:8: error: could not build Objective-C module 'CGLib'
import CGLib
       ^
rpinz commented 5 years ago

If you can be a little patient, I have been meaning to submit PRs that fix building with Swift 4.2+. Or you can take a look at my forks: SwiftGtk.

@rhx The changes affect every repository getting the manifests up to date, with minor code changes along the way for some. Because of the way the project is broken up into many repositories, testing of each component is difficult to conduct in isolation (I have had to use forked repository URLs in manifests for instance). If we could coordinate the process, I suspect it may go smoother than just receiving PRs for the nearly 30 repositories.

rhx commented 5 years ago

I just tried reproducing this under both Ubuntu 16.04 and macOS, but it's working fine for me. It almost looks like the development files for glib and glib-networking are not installed on your system. Can you try:

sudo apt install libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev libxml2-dev

on Ubuntu and

brew install glib glib-networking gobject-introspection

on macOS, then do a

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

again?

rhx commented 5 years ago

@rpinz Yes, happy to coordinate! However, the manifests now use the Swift 4 package format and work with both Swift 4.2.1 and Swift 5. What are the issues you are having?