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

/build.sh creating errors #18

Closed anthcp closed 4 years ago

anthcp commented 4 years ago

Hi there, Ran ./build.sh on Mac OSX and got the following errors...

/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:18:18: error: use of undeclared type 'StringRef' public extension StringRef { ^~~~~ /Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:26:27: error: use of undeclared type 'StringType' public class StringClass: StringType { ^~~~~~ /Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:28:21: error: initializer does not override a designated initializer from its superclass override public init(_ op: UnsafeMutablePointer) {


/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:47:23: error: use of undeclared type 'StringRef'
    var g_string_ref: StringRef { return StringRef(self) }
                      ^~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:29:9: error: 'super' members cannot be referenced in a root class
        super.init(UnsafeMutablePointer(g_string_new(op.pointee.str)))
        ^
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:34:9: error: 'super' members cannot be referenced in a root class
        super.init(s.gstring_ptr)
        ^
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/String.swift:39:23: error: use of unresolved identifier 'gstring_ptr'
        g_string_free(gstring_ptr, 1)
                      ^~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:11:18: error: use of undeclared type 'MainContextRef'
public extension MainContextRef {
                 ^~~~~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:25:18: error: use of undeclared type 'MainContext'
public extension MainContext {
                 ^~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:40:18: error: use of undeclared type 'MainLoopRef'
public extension MainLoopRef {
                 ^~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:50:18: error: use of undeclared type 'MainLoop'
public extension MainLoop {
                 ^~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:18:37: error: use of undeclared type 'MainContextRef'
    static func defaultContext() -> MainContextRef {
                                    ^~~~~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/MainLoop.swift:32:37: error: use of undeclared type 'MainContext'
    static func defaultContext() -> MainContext {
                                    ^~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:19:45: error: use of undeclared type 'LogLevelFlags'
public func g_log(_ message: String, level: LogLevelFlags = .level_debug) {
                                            ^~~~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:35:61: error: use of undeclared type 'LogLevelFlags'
public func g_log(domain: String, _ message: String, level: LogLevelFlags = .level_debug) {
                                                            ^~~~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:88:14: error: extraneous argument labels 'domain:level:' in call
        g_log(domain: d, message, level: .level_warning)
             ^~~~~~~~~            ~~~~~~~

/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:88:26: error: cannot convert value of type 'String' to expected argument type 'GLogLevelFlags'
        g_log(domain: d, message, level: .level_warning)
                         ^
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:88:43: error: type 'UnsafePointer<gchar>?' (aka 'Optional<UnsafePointer<Int8>>') has no member 'level_warning'
        g_log(domain: d, message, level: .level_warning)
                                         ~^~~~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:90:14: error: extraneous argument label 'level:' in call
        g_log(message, level: .level_warning)
             ^         ~~~~~~~

/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:90:45: error: missing argument for parameter #3 in call
        g_log(message, level: .level_warning)
                                            ^
                                            , <#UnsafePointer<gchar>?#>
CGLib.g_log:2:13: note: 'g_log' declared here
public func g_log(_ log_domain: UnsafePointer<gchar>!, _ log_level: GLogLevelFlags, _ format: UnsafePointer<gchar>!, _ varargs: Any...)
            ^
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:90:32: error: type 'GLogLevelFlags' has no member 'level_warning'
        g_log(message, level: .level_warning)
                              ~^~~~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/Time.swift:23:47: error: use of unresolved identifier 'SourceFunc'
    let callback = unsafeBitCast(handler, to: SourceFunc.self)
                                              ^~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/Time.swift:24:14: error: use of unresolved identifier 'timeoutAddFull'
    let rv = timeoutAddFull(priority: p, interval: interval, function: callback, data: opaqueHolder) {
             ^~~~~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:17:11: error: use of undeclared type 'ErrorTypeProtocol'
extension ErrorTypeProtocol {
          ^~~~~~~~~~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:29:11: error: use of undeclared type 'ErrorType'
extension ErrorType: CustomStringConvertible {}
          ^~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:30:11: error: use of undeclared type 'ErrorType'
extension ErrorType: CustomDebugStringConvertible {}
          ^~~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:31:11: error: use of undeclared type 'ErrorRef'
extension ErrorRef: CustomStringConvertible {}
          ^~~~~~~~
/Users/anthcp/code/gtk/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:32:11: error: use of undeclared type 'ErrorRef'
extension ErrorRef: CustomDebugStringConvertible {}
          ^~~~~~~~
[7/7] Compiling GLib Memory.swift

The output from "system_profiler SPSoftwareDataType = "
Software:

    System Software Overview:

      System Version: macOS 10.15.3 (19D76)
      Kernel Version: Darwin 19.3.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: 6:13

Swift version is "Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
Target: x86_64-apple-darwin19.3.0"
rhx commented 4 years ago

This sounds like you may not have glib/gtk correctly installed. Try

brew update
brew install gtk+3 glib glib-networking gobject-introspection pkg-config
cd /Users/anthcp/code/gtk/SwiftGtk
./distclean.sh
git pull
./build.sh
anthcp commented 4 years ago

Brew install was ok but the extra "git pull" seems to have fixed the problem.. Many thanks!!!

anthcp commented 4 years ago

Just to let you know, I ran the test.sh script and got the following...

[3/3] Linking GtkPackageTests Test Suite 'All tests' started at 2020-03-29 22:29:30.681 Test Suite 'GtkPackageTests.xctest' started at 2020-03-29 22:29:30.681 Test Suite 'GtkTests' started at 2020-03-29 22:29:30.682 Test Case '-[GtkTests.GtkTests testApp]' started. Test Case '-[GtkTests.GtkTests testApp]' passed (0.611 seconds). Test Case '-[GtkTests.GtkTests testBinaryAge]' started. Test Case '-[GtkTests.GtkTests testBinaryAge]' passed (0.000 seconds). Test Case '-[GtkTests.GtkTests testDialog]' started. Test Case '-[GtkTests.GtkTests testDialog]' passed (0.076 seconds). Test Case '-[GtkTests.GtkTests testFileChooser]' started. Test Case '-[GtkTests.GtkTests testFileChooser]' passed (0.504 seconds). Test Case '-[GtkTests.GtkTests testFileChooserNative]' started. Test Case '-[GtkTests.GtkTests testFileChooserNative]' passed (0.086 seconds). Test Case '-[GtkTests.GtkTests testInterfaceAge]' started. Test Case '-[GtkTests.GtkTests testInterfaceAge]' passed (0.000 seconds). Test Case '-[GtkTests.GtkTests testMajorVersion]' started. Test Case '-[GtkTests.GtkTests testMajorVersion]' passed (0.000 seconds). Test Case '-[GtkTests.GtkTests testMessageDialog]' started. Exited with signal code 11 And then xctest crashed with the following...Process: xctest [22478] Path: /Applications/Xcode.app/Contents/Developer/usr/bin/xctest Identifier: xctest Version: 16091 Code Type: X86-64 (Native) Parent Process: ??? [22397] Responsible: Terminal [375] User ID: 501

Date/Time: 2020-03-29 22:29:32.096 +1030 OS Version: Mac OS X 10.15.3 (19D76) Report Version: 12 Anonymous UUID: BC28E891-39DF-2B3A-6532-DA50A2C6915E

Sleep/Wake UUID: 8F03D1C8-E844-4240-9C11-B2E46AEE4A44

Time Awake Since Boot: 31000 seconds Time Since Wake: 13000 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: EXC_I386_GPFLT Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0

anthcp commented 4 years ago

More info, it crashes at this point... /// Releases the underlying GObject instance using g_object_unref. deinit { g_object_unref(cast(object_ptr)) }

in GObject-2.0-Object.swift on line 181...

rhx commented 4 years ago

Thanks – found and fixed!

If you git pull again, ./test.sh (or anything, for that matter, that uses the MessageDialog convenience initialisers) should no longer crash.

anthcp commented 4 years ago

Great... It now works a treat!!! Thanks for your time here... I'll start coding with it and see where I end up...

regards

Anthony