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

Building on Apple Silicon (arm64) and Linux 64-bit ARM (aarch64) fails #45

Closed jt9897253 closed 3 years ago

jt9897253 commented 3 years ago

When trying to build on Apple M1, there are some problems.

Running run-gir2swift.sh does not find the gir files at all.

Output is

Everything is already up-to-date
Girs located at
Generating Swift Wrapper for Atk ... Cannot open '/GLib-2.0.gir': No such file or directory
Cannot open '/GObject-2.0.gir': No such file or directory
Cannot open '/Atk-1.0.gir': No such file or directory
[...]

Note the empty string printed as gir location.

If I manually set the gir path by changing https://github.com/rhx/gir2swift/blob/cdd15b3e0c81470ff1f48e8ec00fbb8e4797f227/gir2swift-generation-driver.sh#L161 from GIR_PATH=$(gir_path_arg-gir-names "$ALL_GIR_NAMES") to GIR_PATH=/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/ the output changes to

Everything is already up-to-date
Girs located at /opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0
Building gir2swift
Generating Swift Wrapper for Atk ... Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Atk-1.0.gir': No such file or directory
/swift-gtk/.build/checkouts/SwiftAtk/gir2swift-manifest.sh: line 21: Sources/Atk/*-*.swift: No such file or directory
mv: rename Sources/Atk/*-*.swift.out to Sources/Atk/*-*.swift: No such file or directory

Generating Swift Wrapper for Cairo ... 
Generating Swift Wrapper for GIO ... 
Generating Swift Wrapper for GLib ... /swift-gtk/.build/checkouts/SwiftGLib/gir2swift-manifest.sh: line 21: ${src}: ambiguous redirect
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
/swift-gtk/.build/checkouts/SwiftGLib/gir2swift-manifest.sh: line 25: ${src}: ambiguous redirect
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory

Generating Swift Wrapper for GModule ... 
Generating Swift Wrapper for GLibObject ... /swift-gtk/.build/checkouts/SwiftGObject/gir2swift-manifest.sh: line 21: ${src}: ambiguous redirect
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory

Generating Swift Wrapper for Gdk ... Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/GdkPixbuf-2.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Pango-1.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/PangoCairo-1.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Gdk-3.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/GdkPixbuf-2.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Pango-1.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/PangoCairo-1.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Gdk-3.0.gir': No such file or directory

Generating Swift Wrapper for GdkPixbuf ... Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/GdkPixbuf-2.0.gir': No such file or directory

Generating Swift Wrapper for Pango ... Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Pango-1.0.gir': No such file or directory
/swift-gtk/.build/checkouts/SwiftPango/gir2swift-manifest.sh: line 21: Sources/Pango/*-*.swift: No such file or directory
mv: rename Sources/Pango/*-*.swift.out to Sources/Pango/*-*.swift: No such file or directory

Generating Swift Wrapper for PangoCairo ... Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Pango-1.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/PangoCairo-1.0.gir': No such file or directory

Generating Swift Wrapper for Gtk ... Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Atk-1.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Gdk-3.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/GdkPixbuf-2.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Pango-1.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/PangoCairo-1.0.gir': No such file or directory
Cannot open '/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Gtk-3.0.gir': No such file or directory
/swift-gtk/gir2swift-manifest.sh: line 30: ${src}: ambiguous redirect
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
Postprocessing Wrapper for *-*.swift Postprocessing Wrapper for Gtk-3.0.swift

meaning that GLib-2.0.gir and GObject-2.0.gir can now be found, but Atk-1.0.gir and others not.

This is correct, as the directory /opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/, where my gir files seem to be located, only contains:

DBus-1.0.gir
DBusGLib-1.0.gir
GIRepository-2.0.gir
GL-1.0.gir
GLib-2.0.gir
GModule-2.0.gir
GObject-2.0.gir
Gio-2.0.gir
Vulkan-1.0.gir
cairo-1.0.gir
fontconfig-2.0.gir
freetype2-2.0.gir
gir-1.2.rnc
libxml2-2.0.gir
win32-1.0.gir
xfixes-4.0.gir
xft-2.0.gir
xlib-2.0.gir
xrandr-1.3.gir

There seem to be some different gir related problems:

  1. gir directory is not detected correctly (should be /opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0)
  2. Some .gir files are not available, although the corresponding brew packages are installed. For example Atk-1.0.gir is missing.

My impression is, that problem 1 is related to the build scripts and problem 2 more a problem of homebrew not generating all gir files on arm64.

mikolasstuchlik commented 3 years ago

Offtopic: There might be another problem on arch arm64. When I attempted to compile SwiftGtk on Raspberry OS 64 beta which is Arm64, compilation failed when compiling GLib due to unavailability of type CLongDouble. The underlying code is not generated properly by gir2swift and is patched in postprocessing. The .gir element in question is marked as introspectable=0. At the first glance, currently gir2swift does not filter out un-introspectable elements which imo should be the case. However implementation of such feature would require major refactoring of gir2swift which I intend to do - my personal goal is late 2021. I have not opened the issue yet, because I would like to do so when I have the time to set up proper Raspberry Pi CI.

jt9897253 commented 3 years ago

I think I found some of the gir files:

% find /opt/homebrew/Cellar -name gir-1.0  
/opt/homebrew/Cellar/gtk+3/3.24.24/share/gir-1.0
/opt/homebrew/Cellar/pango/1.48.1/share/gir-1.0
/opt/homebrew/Cellar/gdk-pixbuf/2.42.2/share/gir-1.0
/opt/homebrew/Cellar/atk/2.36.0/share/gir-1.0
/opt/homebrew/Cellar/harfbuzz/2.7.4/share/gir-1.0
/opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0
/opt/homebrew/Cellar/gsettings-desktop-schemas/3.38.0/share/gir-1.0

For example, looks like the missing atk gir is at /opt/homebrew/Cellar/atk/2.36.0/share/gir-1.0/Atk-1.0.gir

jt9897253 commented 3 years ago

When coping the missing gir files to the location of other gir files with

cp -r /opt/homebrew/Cellar/atk/2.36.0/share/gir-1.0/*.gir /opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/
cp -r /opt/homebrew/Cellar/pango/1.48.1/share/gir-1.0/*.gir /opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/
cp -r /opt/homebrew/Cellar/gdk-pixbuf/2.42.2/share/gir-1.0/*.gir /opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/
cp -r /opt/homebrew/Cellar/gtk+3/3.24.24/share/gir-1.0/*.gir /opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/

Now, the gir files seem to be found I get the following output:

Everything is already up-to-date
Girs located at /opt/homebrew/Cellar/gobject-introspection/1.66.1_1/share/gir-1.0
Building gir2swift
Generating Swift Wrapper for Atk ... 
Generating Swift Wrapper for Cairo ... 
Generating Swift Wrapper for GIO ... 
Generating Swift Wrapper for GLib ... /swift-gtk/.build/checkouts/SwiftGLib/gir2swift-manifest.sh: line 21: ${src}: ambiguous redirect
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
/swift-gtk/.build/checkouts/SwiftGLib/gir2swift-manifest.sh: line 25: ${src}: ambiguous redirect
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory

Generating Swift Wrapper for GModule ... 
Generating Swift Wrapper for GLibObject ... /swift-gtk/.build/checkouts/SwiftGObject/gir2swift-manifest.sh: line 21: ${src}: ambiguous redirect
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory

Generating Swift Wrapper for Gdk ... 
Generating Swift Wrapper for GdkPixbuf ... 
Generating Swift Wrapper for Pango ... 
Generating Swift Wrapper for PangoCairo ... 
Generating Swift Wrapper for Gtk ... /swift-gtk/gir2swift-manifest.sh: line 30: ${src}: ambiguous redirect
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
Postprocessing Wrapper for *-*.swift Gtk-3.0-AboutDialog-Bin.swift Gtk-3.0-AboutDialogClass-BinClass.swift Gtk-3.0-Actionable-Buildable.swift Gtk-3.0-BindingArg-CalendarClass.swift Gtk-3.0-BooleanCellAccessible-Calendar.swift Gtk-3.0-CellAccessible-Dialog.swift Gtk-3.0-CellAccessibleClass-DialogClass.swift Gtk-3.0-CellAccessibleParent-Editable.swift Gtk-3.0-DrawingArea-Entry.swift Gtk-3.0-DrawingAreaClass-EditableInterface.swift Gtk-3.0-EntryAccessible-FileChooserButton.swift Gtk-3.0-EntryAccessibleClass-FileChooserButtonClass.swift Gtk-3.0-FileChooser-Orientable.swift Gtk-3.0-FileChooserDialog-GLArea.swift Gtk-3.0-FileChooserDialogClass-GLAreaClass.swift Gtk-3.0-Gesture-HBox.swift Gtk-3.0-GestureClass-HBoxClass.swift Gtk-3.0-HButtonBox-IMContext.swift Gtk-3.0-HButtonBoxClass-IMContextClass.swift Gtk-3.0-IMContextInfo-LabelAccessibleClass.swift Gtk-3.0-IMContextSimple-Label.swift Gtk-3.0-LabelAccessible-Menu.swift Gtk-3.0-LabelClass-MenuAccessibleClass.swift Gtk-3.0-MenuAccessible-NativeDialog.swift Gtk-3.0-MenuBarClass-NativeDialogClass.swift Gtk-3.0-Notebook-OffscreenWindow.swift Gtk-3.0-NotebookAccessibleClass-OffscreenWindowClass.swift Gtk-3.0-OrientableIface-PadActionEntry.swift Gtk-3.0-Overlay-PadController.swift Gtk-3.0-PadControllerClass-RadioActionClass.swift Gtk-3.0-PageSetup-RadioAction.swift Gtk-3.0-PrintOperationPreview-RecentChooser.swift Gtk-3.0-RadioActionEntry-ScaleAccessibleClass.swift Gtk-3.0-RadioButton-Scale.swift Gtk-3.0-ScaleAccessible-Table.swift Gtk-3.0-ScaleButtonAccessibleClass-TableChild.swift Gtk-3.0-Scrollable-ToolShell.swift Gtk-3.0-TableClass-UIManagerClass.swift Gtk-3.0-TearoffMenuItem-UIManager.swift Gtk-3.0-TreeDragDest-TreeSortable.swift Gtk-3.0-VBox-Widget.swift Gtk-3.0-VBoxClass-WidgetAccessibleClass.swift Gtk-3.0-WidgetAccessible-WindowGroup.swift Gtk-3.0-WidgetClass-_MountOperationHandler.swift Gtk-3.0-_MountOperationHandlerIface-_MountOperationHandlerSkeletonPrivate.swift Gtk-3.0-aliases.swift Gtk-3.0-bitfields.swift Gtk-3.0-callbacks.swift Gtk-3.0-constants.swift Gtk-3.0-enumerations.swift Gtk-3.0-functions.swift Gtk-3.0-unions.swift Gtk-3.0.swift Postprocessing Wrapper for Gtk-3.0-AboutDialog-Bin.swift Postprocessing Wrapper for Gtk-3.0-AboutDialogClass-BinClass.swift Postprocessing Wrapper for Gtk-3.0-Actionable-Buildable.swift Postprocessing Wrapper for Gtk-3.0-BindingArg-CalendarClass.swift Postprocessing Wrapper for Gtk-3.0-BooleanCellAccessible-Calendar.swift Postprocessing Wrapper for Gtk-3.0-CellAccessible-Dialog.swift Postprocessing Wrapper for Gtk-3.0-CellAccessibleClass-DialogClass.swift Postprocessing Wrapper for Gtk-3.0-CellAccessibleParent-Editable.swift Postprocessing Wrapper for Gtk-3.0-DrawingArea-Entry.swift Postprocessing Wrapper for Gtk-3.0-DrawingAreaClass-EditableInterface.swift Postprocessing Wrapper for Gtk-3.0-EntryAccessible-FileChooserButton.swift Postprocessing Wrapper for Gtk-3.0-EntryAccessibleClass-FileChooserButtonClass.swift Postprocessing Wrapper for Gtk-3.0-FileChooser-Orientable.swift Postprocessing Wrapper for Gtk-3.0-FileChooserDialog-GLArea.swift Postprocessing Wrapper for Gtk-3.0-FileChooserDialogClass-GLAreaClass.swift Postprocessing Wrapper for Gtk-3.0-Gesture-HBox.swift Postprocessing Wrapper for Gtk-3.0-GestureClass-HBoxClass.swift Postprocessing Wrapper for Gtk-3.0-HButtonBox-IMContext.swift Postprocessing Wrapper for Gtk-3.0-HButtonBoxClass-IMContextClass.swift Postprocessing Wrapper for Gtk-3.0-IMContextInfo-LabelAccessibleClass.swift Postprocessing Wrapper for Gtk-3.0-IMContextSimple-Label.swift Postprocessing Wrapper for Gtk-3.0-LabelAccessible-Menu.swift Postprocessing Wrapper for Gtk-3.0-LabelClass-MenuAccessibleClass.swift Postprocessing Wrapper for Gtk-3.0-MenuAccessible-NativeDialog.swift Postprocessing Wrapper for Gtk-3.0-MenuBarClass-NativeDialogClass.swift Postprocessing Wrapper for Gtk-3.0-Notebook-OffscreenWindow.swift Postprocessing Wrapper for Gtk-3.0-NotebookAccessibleClass-OffscreenWindowClass.swift Postprocessing Wrapper for Gtk-3.0-OrientableIface-PadActionEntry.swift Postprocessing Wrapper for Gtk-3.0-Overlay-PadController.swift Postprocessing Wrapper for Gtk-3.0-PadControllerClass-RadioActionClass.swift Postprocessing Wrapper for Gtk-3.0-PageSetup-RadioAction.swift Postprocessing Wrapper for Gtk-3.0-PrintOperationPreview-RecentChooser.swift Postprocessing Wrapper for Gtk-3.0-RadioActionEntry-ScaleAccessibleClass.swift Postprocessing Wrapper for Gtk-3.0-RadioButton-Scale.swift Postprocessing Wrapper for Gtk-3.0-ScaleAccessible-Table.swift Postprocessing Wrapper for Gtk-3.0-ScaleButtonAccessibleClass-TableChild.swift Postprocessing Wrapper for Gtk-3.0-Scrollable-ToolShell.swift Postprocessing Wrapper for Gtk-3.0-TableClass-UIManagerClass.swift Postprocessing Wrapper for Gtk-3.0-TearoffMenuItem-UIManager.swift Postprocessing Wrapper for Gtk-3.0-TreeDragDest-TreeSortable.swift Postprocessing Wrapper for Gtk-3.0-VBox-Widget.swift Postprocessing Wrapper for Gtk-3.0-VBoxClass-WidgetAccessibleClass.swift Postprocessing Wrapper for Gtk-3.0-WidgetAccessible-WindowGroup.swift Postprocessing Wrapper for Gtk-3.0-WidgetClass-_MountOperationHandler.swift Postprocessing Wrapper for Gtk-3.0-_MountOperationHandlerIface-_MountOperationHandlerSkeletonPrivate.swift Postprocessing Wrapper for Gtk-3.0-aliases.swift Postprocessing Wrapper for Gtk-3.0-bitfields.swift Postprocessing Wrapper for Gtk-3.0-callbacks.swift Postprocessing Wrapper for Gtk-3.0-constants.swift Postprocessing Wrapper for Gtk-3.0-enumerations.swift Postprocessing Wrapper for Gtk-3.0-functions.swift Postprocessing Wrapper for Gtk-3.0-unions.swift Postprocessing Wrapper for Gtk-3.0.swift

Running build.sh still fails, though:


/swift-gtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-UriParamsIter-Variant.swift:1157:88: error: cannot find type 'va_list' in scope; did you mean to use 'CVaListPointer'?
    @inlinable init(parsed_va format: UnsafePointer<gchar>!, app: UnsafeMutablePointer<va_list>!) {
                                                                                       ^~~~~~~
                                                                                       CVaListPointer
/swift-gtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-UriParamsIter-Variant.swift:1278:147: error: cannot find type 'va_list' in scope; did you mean to use 'CVaListPointer'?
    @inlinable init(va formatString: UnsafePointer<gchar>!, endptr: UnsafeMutablePointer<UnsafePointer<gchar>?>? = nil, app: UnsafeMutablePointer<va_list>!) {
                                                                                                                                                  ^~~~~~~
                                                                                                                                                  CVaListPointer
/swift-gtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-UriParamsIter-Variant.swift:1496:107: error: cannot find type 'va_list' in scope; did you mean to use 'CVaListPointer'?
    @inlinable static func newParsedVa(parsed_va format: UnsafePointer<gchar>!, app: UnsafeMutablePointer<va_list>!) -> VariantRef! {
                                                                                                          ^~~~~~~
                                                                                                          CVaListPointer
/swift-gtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-UriParamsIter-Variant.swift:1617:158: error: cannot find type 'va_list' in scope; did you mean to use 'CVaListPointer'?
    @inlinable static func new(va formatString: UnsafePointer<gchar>!, endptr: UnsafeMutablePointer<UnsafePointer<gchar>?>? = nil, app: UnsafeMutablePointer<va_list>!) -> VariantRef! {
[...]
jt9897253 commented 3 years ago

Offtopic: There might be another problem on arch arm64. When I attempted to compile SwiftGtk on Raspberry OS 64 beta which is Arm64, compilation failed when compiling GLib due to unavailability of type CLongDouble. The underlying code is not generated properly by gir2swift and is patched in postprocessing. The .gir element in question is marked as introspectable=0. At the first glance, currently gir2swift does not filter out un-introspectable elements which imo should be the case. However implementation of such feature would require major refactoring of gir2swift which I intend to do - my personal goal is late 2021. I have not opened the issue yet, because I would like to do so when I have the time to set up proper Raspberry Pi CI.

I can confirm this. On Apple m1, I managed to start an ubuntu VM using vmcli. The resulting Linux kernel identifies itself as

$ uname -a
Linux ubuntu 5.4.0-62-generic #70-Ubuntu SMP Tue Jan 12 12:50:33 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

Here, ./run-gir2swift.sh runs without error but build.sh fails with:

$ ./build.sh 
'CGLib' gio-unix-2.0.pc: warning: non whitelisted flag(s): -pthread
'CGtk' gtk+-3.0.pc: warning: non whitelisted flag(s): -pthread, -pthread, -pthread, -pthread, -pthread, -pthread, -pthread, -pthread
'CGdkPixbuf' gdk-pixbuf-2.0.pc: warning: non whitelisted flag(s): -pthread, -pthread
'CGdk' gdk-3.0.pc: warning: non whitelisted flag(s): -pthread, -pthread, -pthread
/home/username/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-TestConfig-Variant.swift:923:47: error: cannot find type 'CLongDouble' in scope
    @inlinable var nums: UnsafeMutablePointer<CLongDouble>! {
                                              ^~~~~~~~~~~
/home/username/SwiftGtk/.build/checkouts/SwiftGLib/Sources/GLib/GLib-2.0-TestConfig-Variant.swift:923:47: error: cannot find type 'CLongDouble' in scope
    @inlinable var nums: UnsafeMutablePointer<CLongDouble>! {
                                              ^~~~~~~~~~~
[31/33] Compiling GLib GLib-2.0-unions.swift
jt9897253 commented 3 years ago

Another update:

Maybe the problem about the missing gir files was only that hombrew changed its install prefix. If I remember correctly, the prefix used to be /usr/local but may have changed to /opt/homebrew

There's a lot of symlinks to gir files at /opt/homebrew/share/gir-1.0

$ ls -l /opt/homebrew/share/gir-1.0
Atk-1.0.gir -> ../../Cellar/atk/2.36.0/share/gir-1.0/Atk-1.0.gir
DBus-1.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/DBus-1.0.gir
DBusGLib-1.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/DBusGLib-1.0.gir
GDesktopEnums-3.0.gir -> ../../Cellar/gsettings-desktop-schemas/3.38.0/share/gir-1.0/GDesktopEnums-3.0.gir
GIRepository-2.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/GIRepository-2.0.gir
GL-1.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/GL-1.0.gir
GLib-2.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/GLib-2.0.gir
GModule-2.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/GModule-2.0.gir
GObject-2.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/GObject-2.0.gir
Gdk-3.0.gir -> ../../Cellar/gtk+3/3.24.24/share/gir-1.0/Gdk-3.0.gir
GdkPixbuf-2.0.gir -> ../../Cellar/gdk-pixbuf/2.42.2/share/gir-1.0/GdkPixbuf-2.0.gir
GdkPixdata-2.0.gir -> ../../Cellar/gdk-pixbuf/2.42.2/share/gir-1.0/GdkPixdata-2.0.gir
Gio-2.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Gio-2.0.gir
Gtk-3.0.gir -> ../../Cellar/gtk+3/3.24.24/share/gir-1.0/Gtk-3.0.gir
HarfBuzz-0.0.gir -> ../../Cellar/harfbuzz/2.7.4/share/gir-1.0/HarfBuzz-0.0.gir
Pango-1.0.gir -> ../../Cellar/pango/1.48.1/share/gir-1.0/Pango-1.0.gir
PangoCairo-1.0.gir -> ../../Cellar/pango/1.48.1/share/gir-1.0/PangoCairo-1.0.gir
PangoFT2-1.0.gir -> ../../Cellar/pango/1.48.1/share/gir-1.0/PangoFT2-1.0.gir
PangoFc-1.0.gir -> ../../Cellar/pango/1.48.1/share/gir-1.0/PangoFc-1.0.gir
PangoOT-1.0.gir -> ../../Cellar/pango/1.48.1/share/gir-1.0/PangoOT-1.0.gir
Vulkan-1.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/Vulkan-1.0.gir
cairo-1.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/cairo-1.0.gir
fontconfig-2.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/fontconfig-2.0.gir
freetype2-2.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/freetype2-2.0.gir
gir-1.2.rnc -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/gir-1.2.rnc
libxml2-2.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/libxml2-2.0.gir
win32-1.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/win32-1.0.gir
xfixes-4.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/xfixes-4.0.gir
xft-2.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/xft-2.0.gir
xlib-2.0.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/xlib-2.0.gir
xrandr-1.3.gir -> ../../Cellar/gobject-introspection/1.66.1_1/share/gir-1.0/xrandr-1.3.gir

The new prefix seems to be used on apple silicon only, see https://brew.sh/2020/12/01/homebrew-2.6.0

macOS Homebrew running natively on M1/Apple Silicon/ARM has partial functionality. We recommend installing into /opt/homebrew and forbid installing into /usr/local (to avoid clashing with the macOS Intel install and allow their usage side-by-side).

Also, https://github.com/Homebrew/brew/pull/9117 says

Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (/opt/homebrew) and Homebrew on Linux

Using this new path do not resolve the gir2swift-manifest.sh: line 30: ${src}: ambiguous redirect errors seen in the logs above.

mikolasstuchlik commented 3 years ago

My exams are getting closer so I won't have the time to implement solution in the near future. However a significant refactoring of existing build scripts might be upon us.

If the lack of centralized .gir folder is not a bug but intention, we need to provide additional information to the build scripts. We first need to figure out how to get the correct path. We have multiple possibilities.

Brew has the function to print json with package information on the stdout. We might use those data to get the library path in the same manner as with SPM using jq. /or/ We can use something like

`pkg-config --variable=libdir LIBNAME`/../share/gir-1.0/GIRNAME

.

I prefer the second solution.

In both cases we would need to introduce new property to all gir2swift-manifest which would contain the desired pkg-config/brew library name. We can not get this data from the SPM since not all packages that require .gir generation contain also systemLibrary target or import different pkg-config library.

I suggest something like PKG_CONFIG_NAME.

Finally we would need to move creation of GIR path from individual manifests to the driver in order to - a/ have more control over the process of path generation since gir paths are now different b/ have the ability to cache resolved gir paths c/ further shorten the manifest files which is desirable.

My suggestion replacing all "get-gir-name" functions with something like "get-gir-path".

rhx commented 3 years ago

For the moment, I have added /opt/homebrew to the GIR prefix search path, so this should hopefully find the correct gir-1.0 directory for you.

rhx commented 3 years ago

I have pushed a workaround (in the post-processing scripts) to the SwiftGLib development branch. Unfortunately, I don't have access to an m1 or aarch64 Linux at the moment, so I can't test. If you could try the following, and let me know if this works, that'd be great:

git clone https://github.com/rhx/SwiftGLib.git
cd SwiftGLib
git checkout development
./run-gir2swift.sh
swift test -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`

If this works, try SwiftGtk again (on the development branch) -- chances are we might need similar workarounds in other packages.

mikolasstuchlik commented 3 years ago

Build succeeded.

pi@raspberrypi:~/Developer/SwiftGLib $ swift build -j 4 -Xswiftc -suppress-warnings

'CGLib' gio-unix-2.0.pc: warning: non whitelisted flag(s): -pthread
[35/35] Merging module GLib
pi@raspberrypi:~/Developer/SwiftGLib $ 
pi@raspberrypi:~/Developer/SwiftGLib $ uname -a
Linux raspberrypi 5.10.5-v8+ #1392 SMP PREEMPT Sat Jan 9 18:56:30 GMT 2021 aarch64 GNU/Linux
rhx commented 3 years ago

Great -- I have merged this onto the SwiftGLib main branch now. Could you try SwiftGtk as well, please? (There might be similar issues in other packages.)

mikolasstuchlik commented 3 years ago

SwiftGtk compilation was successful :tada:

I will create an issue once my Rapberry is redy as a CI.

rhx commented 3 years ago

That's great news. @jt9897253 if you do get a chance to check if this works for the m1 now as well, that'd be great.

jt9897253 commented 3 years ago

Ok, here's the output for GLib (main branch):

% ./run-gir2swift.sh
Updating https://github.com/rhx/gir2swift.git
Updating https://github.com/rhx/SwiftLibXML.git
Resolving https://github.com/rhx/gir2swift.git at main
Girs located at /opt/homebrew/share/gir-1.0
Building gir2swift
Generating Swift Wrapper for GLib ... 

% swift test -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
warning: you may be able to install gio-unix-2.0 using your system-packager:
    brew install glib glib-networking gobject-introspection

[25/25] Linking GLibPackageTests
Test Suite 'All tests' started at 2021-01-31 17:40:25.213
Test Suite 'GLibPackageTests.xctest' started at 2021-01-31 17:40:25.214
Test Suite 'GLibTests' started at 2021-01-31 17:40:25.214
Test Case '-[GLibTests.GLibTests testDateTime]' started.
Test Case '-[GLibTests.GLibTests testDateTime]' passed (0.052 seconds).
Test Case '-[GLibTests.GLibTests testDateTimeUnixUTC]' started.
Test Case '-[GLibTests.GLibTests testDateTimeUnixUTC]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testDefaultMainContext]' started.
Test Case '-[GLibTests.GLibTests testDefaultMainContext]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testDirOpen]' started.
Test Case '-[GLibTests.GLibTests testDirOpen]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testDoubleIEEE754]' started.
Test Case '-[GLibTests.GLibTests testDoubleIEEE754]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testErrorType]' started.
Test Case '-[GLibTests.GLibTests testErrorType]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testFloatIEEE754]' started.
Test Case '-[GLibTests.GLibTests testFloatIEEE754]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testLog]' started.
Test Case '-[GLibTests.GLibTests testLog]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testLogDomain]' started.
Test Case '-[GLibTests.GLibTests testLogDomain]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testLogDomainLevel]' started.
Test Case '-[GLibTests.GLibTests testLogDomainLevel]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testLogLevel]' started.
Test Case '-[GLibTests.GLibTests testLogLevel]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testMainLoopCreation]' started.
Test Case '-[GLibTests.GLibTests testMainLoopCreation]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testMutex]' started.
Test Case '-[GLibTests.GLibTests testMutex]' passed (0.000 seconds).
Test Case '-[GLibTests.GLibTests testTimeoutAdd]' started.
Test Case '-[GLibTests.GLibTests testTimeoutAdd]' passed (0.189 seconds).
Test Suite 'GLibTests' passed at 2021-01-31 17:40:25.457.
     Executed 14 tests, with 0 failures (0 unexpected) in 0.243 (0.243) seconds
Test Suite 'GLibPackageTests.xctest' passed at 2021-01-31 17:40:25.457.
     Executed 14 tests, with 0 failures (0 unexpected) in 0.243 (0.243) seconds
Test Suite 'All tests' passed at 2021-01-31 17:40:25.457.
     Executed 14 tests, with 0 failures (0 unexpected) in 0.243 (0.244) seconds

SwiftGtk (development branch):

% ./run-gir2swift.sh
Updating https://github.com/rhx/gir2swift.git
Updating https://github.com/rhx/SwiftAtk.git
Updating https://github.com/rhx/SwiftGdk.git
Updating https://github.com/rhx/SwiftLibXML.git
Updating https://github.com/rhx/SwiftGObject.git
Updating https://github.com/rhx/SwiftPangoCairo.git
Updating https://github.com/rhx/SwiftGdkPixbuf.git
Updating https://github.com/rhx/SwiftGLib.git
Updating https://github.com/rhx/SwiftCairo.git
Updating https://github.com/rhx/SwiftPango.git
Updating https://github.com/rhx/SwiftGModule.git
Updating https://github.com/rhx/SwiftGIO.git
Everything is already up-to-date
Girs located at /opt/homebrew/share/gir-1.0
Building gir2swift
Generating Swift Wrapper for Atk ... 
Generating Swift Wrapper for Cairo ... 
Generating Swift Wrapper for GIO ... 
Generating Swift Wrapper for GLib ... 
Generating Swift Wrapper for GModule ... 
Generating Swift Wrapper for GLibObject ... 
Generating Swift Wrapper for Gdk ... 
Generating Swift Wrapper for GdkPixbuf ... 
Generating Swift Wrapper for Pango ... 
Generating Swift Wrapper for PangoCairo ... 
Generating Swift Wrapper for Gtk ... /gir2swift-manifest.sh: line 30: ${src}: ambiguous redirect
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
Postprocessing Wrapper for *-*.swift Gtk-3.0-AboutDialog-Bin.swift Gtk-3.0-AboutDialogClass-BinClass.swift Gtk-3.0-Actionable-Buildable.swift Gtk-3.0-BindingArg-CalendarClass.swift Gtk-3.0-BooleanCellAccessible-Calendar.swift Gtk-3.0-CellAccessible-Dialog.swift Gtk-3.0-CellAccessibleClass-DialogClass.swift Gtk-3.0-CellAccessibleParent-Editable.swift Gtk-3.0-DrawingArea-Entry.swift Gtk-3.0-DrawingAreaClass-EditableInterface.swift Gtk-3.0-EntryAccessible-FileChooserButton.swift Gtk-3.0-EntryAccessibleClass-FileChooserButtonClass.swift Gtk-3.0-FileChooser-Orientable.swift Gtk-3.0-FileChooserDialog-GLArea.swift Gtk-3.0-FileChooserDialogClass-GLAreaClass.swift Gtk-3.0-Gesture-HBox.swift Gtk-3.0-GestureClass-HBoxClass.swift Gtk-3.0-HButtonBox-IMContext.swift Gtk-3.0-HButtonBoxClass-IMContextClass.swift Gtk-3.0-IMContextInfo-LabelAccessibleClass.swift Gtk-3.0-IMContextSimple-Label.swift Gtk-3.0-LabelAccessible-Menu.swift Gtk-3.0-LabelClass-MenuAccessibleClass.swift Gtk-3.0-MenuAccessible-NativeDialog.swift Gtk-3.0-MenuBarClass-NativeDialogClass.swift Gtk-3.0-Notebook-OffscreenWindow.swift Gtk-3.0-NotebookAccessibleClass-OffscreenWindowClass.swift Gtk-3.0-OrientableIface-PadActionEntry.swift Gtk-3.0-Overlay-PadController.swift Gtk-3.0-PadControllerClass-RadioActionClass.swift Gtk-3.0-PageSetup-RadioAction.swift Gtk-3.0-PrintOperationPreview-RecentChooser.swift Gtk-3.0-RadioActionEntry-ScaleAccessibleClass.swift Gtk-3.0-RadioButton-Scale.swift Gtk-3.0-ScaleAccessible-Table.swift Gtk-3.0-ScaleButtonAccessibleClass-TableChild.swift Gtk-3.0-Scrollable-ToolShell.swift Gtk-3.0-TableClass-UIManagerClass.swift Gtk-3.0-TearoffMenuItem-UIManager.swift Gtk-3.0-TreeDragDest-TreeSortable.swift Gtk-3.0-VBox-Widget.swift Gtk-3.0-VBoxClass-WidgetAccessibleClass.swift Gtk-3.0-WidgetAccessible-WindowGroup.swift Gtk-3.0-WidgetClass-_MountOperationHandler.swift Gtk-3.0-_MountOperationHandlerIface-_MountOperationHandlerSkeletonPrivate.swift Gtk-3.0-aliases.swift Gtk-3.0-bitfields.swift Gtk-3.0-callbacks.swift Gtk-3.0-constants.swift Gtk-3.0-enumerations.swift Gtk-3.0-functions.swift Gtk-3.0-unions.swift Gtk-3.0.swift Gtk-4.0.swift Postprocessing Wrapper for Gtk-3.0-AboutDialog-Bin.swift Postprocessing Wrapper for Gtk-3.0-AboutDialogClass-BinClass.swift Postprocessing Wrapper for Gtk-3.0-Actionable-Buildable.swift Postprocessing Wrapper for Gtk-3.0-BindingArg-CalendarClass.swift Postprocessing Wrapper for Gtk-3.0-BooleanCellAccessible-Calendar.swift Postprocessing Wrapper for Gtk-3.0-CellAccessible-Dialog.swift Postprocessing Wrapper for Gtk-3.0-CellAccessibleClass-DialogClass.swift Postprocessing Wrapper for Gtk-3.0-CellAccessibleParent-Editable.swift Postprocessing Wrapper for Gtk-3.0-DrawingArea-Entry.swift Postprocessing Wrapper for Gtk-3.0-DrawingAreaClass-EditableInterface.swift Postprocessing Wrapper for Gtk-3.0-EntryAccessible-FileChooserButton.swift Postprocessing Wrapper for Gtk-3.0-EntryAccessibleClass-FileChooserButtonClass.swift Postprocessing Wrapper for Gtk-3.0-FileChooser-Orientable.swift Postprocessing Wrapper for Gtk-3.0-FileChooserDialog-GLArea.swift Postprocessing Wrapper for Gtk-3.0-FileChooserDialogClass-GLAreaClass.swift Postprocessing Wrapper for Gtk-3.0-Gesture-HBox.swift Postprocessing Wrapper for Gtk-3.0-GestureClass-HBoxClass.swift Postprocessing Wrapper for Gtk-3.0-HButtonBox-IMContext.swift Postprocessing Wrapper for Gtk-3.0-HButtonBoxClass-IMContextClass.swift Postprocessing Wrapper for Gtk-3.0-IMContextInfo-LabelAccessibleClass.swift Postprocessing Wrapper for Gtk-3.0-IMContextSimple-Label.swift Postprocessing Wrapper for Gtk-3.0-LabelAccessible-Menu.swift Postprocessing Wrapper for Gtk-3.0-LabelClass-MenuAccessibleClass.swift Postprocessing Wrapper for Gtk-3.0-MenuAccessible-NativeDialog.swift Postprocessing Wrapper for Gtk-3.0-MenuBarClass-NativeDialogClass.swift Postprocessing Wrapper for Gtk-3.0-Notebook-OffscreenWindow.swift Postprocessing Wrapper for Gtk-3.0-NotebookAccessibleClass-OffscreenWindowClass.swift Postprocessing Wrapper for Gtk-3.0-OrientableIface-PadActionEntry.swift Postprocessing Wrapper for Gtk-3.0-Overlay-PadController.swift Postprocessing Wrapper for Gtk-3.0-PadControllerClass-RadioActionClass.swift Postprocessing Wrapper for Gtk-3.0-PageSetup-RadioAction.swift Postprocessing Wrapper for Gtk-3.0-PrintOperationPreview-RecentChooser.swift Postprocessing Wrapper for Gtk-3.0-RadioActionEntry-ScaleAccessibleClass.swift Postprocessing Wrapper for Gtk-3.0-RadioButton-Scale.swift Postprocessing Wrapper for Gtk-3.0-ScaleAccessible-Table.swift Postprocessing Wrapper for Gtk-3.0-ScaleButtonAccessibleClass-TableChild.swift Postprocessing Wrapper for Gtk-3.0-Scrollable-ToolShell.swift Postprocessing Wrapper for Gtk-3.0-TableClass-UIManagerClass.swift Postprocessing Wrapper for Gtk-3.0-TearoffMenuItem-UIManager.swift Postprocessing Wrapper for Gtk-3.0-TreeDragDest-TreeSortable.swift Postprocessing Wrapper for Gtk-3.0-VBox-Widget.swift Postprocessing Wrapper for Gtk-3.0-VBoxClass-WidgetAccessibleClass.swift Postprocessing Wrapper for Gtk-3.0-WidgetAccessible-WindowGroup.swift Postprocessing Wrapper for Gtk-3.0-WidgetClass-_MountOperationHandler.swift Postprocessing Wrapper for Gtk-3.0-_MountOperationHandlerIface-_MountOperationHandlerSkeletonPrivate.swift Postprocessing Wrapper for Gtk-3.0-aliases.swift Postprocessing Wrapper for Gtk-3.0-bitfields.swift Postprocessing Wrapper for Gtk-3.0-callbacks.swift Postprocessing Wrapper for Gtk-3.0-constants.swift Postprocessing Wrapper for Gtk-3.0-enumerations.swift Postprocessing Wrapper for Gtk-3.0-functions.swift Postprocessing Wrapper for Gtk-3.0-unions.swift Postprocessing Wrapper for Gtk-3.0.swift Postprocessing Wrapper for Gtk-4.0.swift

% swift test -Xswiftc -suppress-warnings `./run-gir2swift.sh flags -noUpdate`
warning: you may be able to install gio-unix-2.0 using your system-packager:
    brew install glib glib-networking gobject-introspection

warning: you may be able to install pangocairo using your system-packager:
    brew install pango glib glib-networking gobject-introspection

warning: you may be able to install cairo using your system-packager:
    brew install cairo glib glib-networking gobject-introspection

warning: you may be able to install gdk-pixbuf-2.0 using your system-packager:
    brew install gdk-pixbuf glib glib-networking gobject-introspection

warning: you may be able to install gdk-3.0 using your system-packager:
    brew install gtk+3 glib glib-networking gobject-introspection

warning: you may be able to install gtk+-3.0 using your system-packager:
    brew install gtk+3 glib glib-networking gobject-introspection

warning: you may be able to install atk using your system-packager:
    brew install atk glib glib-networking gobject-introspection

/SwiftGtk/.build/checkouts/SwiftGObject/Sources/GObjectCHelpers/gobject_helpers.c:7:12: 
    return G_TYPE_FROM_INSTANCE(gobject);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/glib/2.66.4_1/include/glib-2.0/gobject/gtype.h:602:65: note: expanded from macro 'G_TYPE_FROM_INSTANCE'
#define G_TYPE_FROM_INSTANCE(instance)                          (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class))
                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[362/362] Linking GtkPackageTests
Test Suite 'All tests' started at 2021-01-31 18:27:07.065
Test Suite 'GtkPackageTests.xctest' started at 2021-01-31 18:27:07.066
Test Suite 'GtkTests' started at 2021-01-31 18:27:07.066
Test Case '-[GtkTests.GtkTests testApp]' started.
Test Case '-[GtkTests.GtkTests testApp]' passed (0.043 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.024 seconds).
Test Case '-[GtkTests.GtkTests testFileChooser]' started.
Test Case '-[GtkTests.GtkTests testFileChooser]' passed (0.234 seconds).
Test Case '-[GtkTests.GtkTests testFileChooserNative]' started.
Test Case '-[GtkTests.GtkTests testFileChooserNative]' passed (0.045 seconds).
Test Case '-[GtkTests.GtkTests testInitiallyUnowned]' started.

(<unknown>:12050): Gtk-CRITICAL **: 18:27:07.481: New application windows must be added after the GApplication::startup signal has been emitted.
Test Case '-[GtkTests.GtkTests testInitiallyUnowned]' passed (0.006 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.
Test Case '-[GtkTests.GtkTests testMessageDialog]' passed (0.001 seconds).
Test Case '-[GtkTests.GtkTests testMicroVersion]' started.
Test Case '-[GtkTests.GtkTests testMicroVersion]' passed (0.000 seconds).
Test Case '-[GtkTests.GtkTests testMinorVersion]' started.
Test Case '-[GtkTests.GtkTests testMinorVersion]' passed (0.000 seconds).
Test Case '-[GtkTests.GtkTests testScrolledWindow]' started.
Test Case '-[GtkTests.GtkTests testScrolledWindow]' passed (0.001 seconds).
Test Case '-[GtkTests.GtkTests testTextBuffer]' started.
Test Case '-[GtkTests.GtkTests testTextBuffer]' passed (0.000 seconds).
Test Case '-[GtkTests.GtkTests testTreeViewRowActivated]' started.
Test Case '-[GtkTests.GtkTests testTreeViewRowActivated]' passed (0.001 seconds).
Test Suite 'GtkTests' passed at 2021-01-31 18:27:07.486.
     Executed 14 tests, with 0 failures (0 unexpected) in 0.355 (0.419) seconds
Test Suite 'GtkPackageTests.xctest' passed at 2021-01-31 18:27:07.486.
     Executed 14 tests, with 0 failures (0 unexpected) in 0.355 (0.420) seconds
Test Suite 'All tests' passed at 2021-01-31 18:27:07.486.
     Executed 14 tests, with 0 failures (0 unexpected) in 0.355 (0.420) seconds

SwiftGtk:

% swift build
warning: you may be able to install gio-unix-2.0 using your system-packager:
    brew install glib glib-networking gobject-introspection

warning: you may be able to install atk using your system-packager:
    brew install atk glib glib-networking gobject-introspection

warning: you may be able to install pangocairo using your system-packager:
    brew install pango glib glib-networking gobject-introspection

warning: you may be able to install cairo using your system-packager:
    brew install cairo glib glib-networking gobject-introspection

warning: you may be able to install gdk-pixbuf-2.0 using your system-packager:
    brew install gdk-pixbuf glib glib-networking gobject-introspection

warning: you may be able to install gdk-3.0 using your system-packager:
    brew install gtk+3 glib glib-networking gobject-introspection

warning: you may be able to install gtk+-3.0 using your system-packager:
    brew install gtk+3 glib glib-networking gobject-introspection

In file included from /SwiftGtk/Sources/GtkCHelpers/gtk_dialog.c:1:
/SwiftGtk/Sources/GtkCHelpers/include/gtk_dialog.h:2:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^~~~~~~~~~~
1 error generated.
[0/8] Compiling GtkCHelpers gtk_dialog.c

SwiftGtk ./build.sh [a lot of warnings and then:]

[359/359] Merging module Gtk
jt9897253 commented 3 years ago

I just checked SwiftHelloGtk and it compiles and runs using ./build.sh Congratulations!

As before, swift build does not work as it can not find gtk.h

Feel free to close this issue.

rhx commented 3 years ago

That's great news, I'll close the report.

Regarding swift build not working: yes, that's a known issue under macOS at the moment. Apart from running build.sh (which you did), passing in the flags manually into swift build should also work:

swift build `./run-gir2swift.sh flags -noUpdate`