Code Monkey home page Code Monkey logo

swifthellogtk's Introduction

SwiftHelloGtk

A simple 'hello-world' app using SwiftGtk

<<<<<<< HEAD macOS 11 build macOS 10.15 build macOS gtk4 build Ubuntu 20.04 build Ubuntu 18.04 build

Building and Running

Make sure you have all the prerequisites installed (see below). After that, you can simply clone this repository and build the command line executable (be patient, this will download all the required dependencies and take a while to compile) using

git clone https://github.com/rhx/SwiftHelloGtk.git
cd SwiftHelloGtk
swift run

Alternatively, you can just build the program and run manually using

swift build
.build/debug/HelloGtk

On macOS you can also create an App bundle that you can move to your /Applications folder and double-click by running the following script:

./app-bundle.sh

This will create a HelloGtk.app inside the .build/app/ folder.

macOS

Please note that on macOS, due to a bug currently in the Swift Package Manager, you need to pass in the build flags manually, i.e. instead of swift build and swift run you can run

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

Under macOS, you can also create an Application bundle that you can copy to the /Applications folder by using

./app-bundle.sh

Xcode

On macOS, you can build the project using Xcode instead. To do this, you need to create an Xcode project first, then open the project in the Xcode IDE:

./xcodegen.sh
open HelloGtk.xcodeproj

After that, select the executable target (not the Bundle/Framework target with the same name as the executable) and use the (usual) Build and Run buttons to build/run your project.

What is new?

Support for gtk 4.x

There now is a gtk4 branch supporting the latest version of gtk.

The current version introduces a new build system and signal generation code contributed by Mikoláš Stuchlík (see the Building and Running Section above).

Other notable changes

Version 11 introduces a new type system into gir2swift, to ensure it has a representation of the underlying types. This is necessary for Swift 5.3 onwards, which requires more stringent casts. As a consequence, accessors can accept and return idiomatic Swift rather than underlying types or pointers. This means that a lot of the changes will be source-breaking for code that was compiled against libraries built with earlier versions of gir2swift.

  • Requires Swift 5.6 or later
  • Wrapper code is now @inlinable to enable the compiler to optimise away most of the wrappers
  • Parameters and return types use more idiomatic Swift (e.g. Ref wrappers instead of pointers, Int instead of gint, etc.)
  • Functions that take or return records now are templated instead of using the type-erased Protocol
  • ErrorType has been renamed GLibError to ensure it neither clashes with Swift.Error nor the GLib.ErrorType scanner enum
  • Parameters or return types for records/classes now use the corresponding, lightweight Swift Ref wrapper instead of the underlying pointer

Prerequisites

Swift

Building should work with at least Swift 5.6. You can download Swift from https://swift.org/download/ -- if you are using macOS, make sure you have the command line tools installed as well (install them using xcode-select --install). Test that your compiler works using swift --version, which should give you something like

$ swift --version
swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0

on macOS, or on Linux you should get something like:

$ swift --version
Swift version 5.8.1 (swift-5.8.1-RELEASE)
Target: x86_64-unknown-linux-gnu

Gtk 3.22 or higher

The Swift wrappers have been tested with glib-2.56, 2.58, 2.60, 2.62, 2.64, 2.66, 2.68, 2.70 and 2.72, and gdk/gtk 3.22 and 3.24, as well as 4.0, 4.2, 4.4 and 4.6 on the gtk4 branch. They should work with higher versions, but YMMV. Also make sure you have gobject-introspection and its .gir files installed.

Linux

Ubuntu

On Ubuntu 18.04 and 16.04 you can use the gtk that comes with the distribution. Just install with the apt package manager:

sudo apt update
sudo apt install libgtk-3-dev gir1.2-gtksource-3.0 gobject-introspection libgirepository1.0-dev libxml2-dev
Fedora

On Fedora 29, you can use the gtk that comes with the distribution. Just install with the dnf package manager:

sudo dnf install gtk3-devel pango-devel cairo-devel cairo-gobject-devel glib2-devel gobject-introspection-devel libxml2-devel

macOS

On macOS, you can install gtk using HomeBrew (for setup instructions, see http://brew.sh). Once you have a running HomeBrew installation, you can use it to install a native version of gtk:

brew update
brew install gtk+3 glib glib-networking gobject-introspection pkg-config

Troubleshooting

Here are some common errors you might encounter and how to fix them.

Old Swift toolchain or Xcode

If you get an error such as

$ ./build.sh 
error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-package (No such file or directory)

this probably means that your Swift toolchain is too old. Make sure the latest toolchain is the one that is found when you run the Swift compiler (see above).

If you get an older version, make sure that the right version of the swift compiler is found first in your PATH. On macOS, use xcode-select to select and install the latest version, e.g.:

sudo xcode-select -s /Applications/Xcode.app
xcode-select --install

swifthellogtk's People

Contributors

rhx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

swifthellogtk's Issues

error: Redefinition of module 'FFI'

Hello! I am trying to follow the steps as described on the main page of the repository. Unfortunately it is not building for me with an error "redefinition of module 'FFI'". Is this a known issue? Could you please help? Thanks!

Full log:

➜  mytry pwd
/Users/ihor/projects/mytry
➜  mytry swift --version
swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
Target: arm64-apple-macosx13.0
➜  mytry brew update
Already up-to-date.
➜  mytry brew install gtk+3 glib glib-networking gobject-introspection pkg-config
Warning: gtk+3 3.24.36 is already installed and up-to-date.
To reinstall 3.24.36, run:
  brew reinstall gtk+3
Warning: glib 2.74.6 is already installed and up-to-date.
To reinstall 2.74.6, run:
  brew reinstall glib
Warning: glib-networking 2.74.0 is already installed and up-to-date.
To reinstall 2.74.0, run:
  brew reinstall glib-networking
Warning: gobject-introspection 1.74.0 is already installed and up-to-date.
To reinstall 1.74.0, run:
  brew reinstall gobject-introspection
Warning: pkg-config 0.29.2_3 is already installed and up-to-date.
To reinstall 0.29.2_3, run:
  brew reinstall pkg-config
➜  mytry git clone https://github.com/rhx/SwiftHelloGtk.git
Cloning into 'SwiftHelloGtk'...
remote: Enumerating objects: 278, done.
remote: Counting objects: 100% (114/114), done.
remote: Compressing objects: 100% (63/63), done.
remote: Total 278 (delta 63), reused 86 (delta 42), pack-reused 164
Receiving objects: 100% (278/278), 42.88 KiB | 354.00 KiB/s, done.
Resolving deltas: 100% (156/156), done.
➜  mytry cd SwiftHelloGtk
➜  SwiftHelloGtk git:(main) ./run-gir2swift.sh
Fetching https://github.com/rhx/gir2swift.git from cache
Fetched https://github.com/rhx/gir2swift.git (0.63s)
Fetching https://github.com/rhx/SwiftGtk.git from cache
Fetched https://github.com/rhx/SwiftGtk.git (0.64s)
Fetching https://github.com/rhx/SwiftLibXML.git from cache
Fetched https://github.com/rhx/SwiftLibXML.git (0.64s)
Fetching https://github.com/rhx/SwiftAtk.git from cache
Fetched https://github.com/rhx/SwiftAtk.git (0.64s)
Fetching https://github.com/rhx/SwiftGdk.git from cache
Fetched https://github.com/rhx/SwiftGdk.git (0.66s)
Fetching https://github.com/rhx/SwiftGObject.git from cache
Fetched https://github.com/rhx/SwiftGObject.git (0.74s)
Fetching https://github.com/rhx/SwiftGdkPixbuf.git from cache
Fetched https://github.com/rhx/SwiftGdkPixbuf.git (0.65s)
Fetching https://github.com/rhx/SwiftPangoCairo.git from cache
Fetched https://github.com/rhx/SwiftPangoCairo.git (0.70s)
Fetching https://github.com/rhx/SwiftGLib.git from cache
Fetched https://github.com/rhx/SwiftGLib.git (0.66s)
Fetching https://github.com/rhx/SwiftGIO.git from cache
Fetched https://github.com/rhx/SwiftGIO.git (0.62s)
Fetching https://github.com/rhx/SwiftGModule.git from cache
Fetched https://github.com/rhx/SwiftGModule.git (0.63s)
Fetching https://github.com/rhx/SwiftCairo.git from cache
Fetched https://github.com/rhx/SwiftCairo.git (0.65s)
Fetching https://github.com/rhx/SwiftPango.git from cache
Fetched https://github.com/rhx/SwiftPango.git (0.64s)
Fetching https://github.com/rhx/SwiftHarfBuzz.git from cache
Fetched https://github.com/rhx/SwiftHarfBuzz.git (0.64s)
Fetching https://github.com/apple/swift-argument-parser from cache
Fetching https://github.com/jpsim/Yams.git from cache
Fetched https://github.com/jpsim/Yams.git (0.77s)
Fetched https://github.com/apple/swift-argument-parser (0.77s)
Computing version for https://github.com/jpsim/Yams.git
Computed https://github.com/jpsim/Yams.git at 4.0.6 (0.44s)
Computing version for https://github.com/apple/swift-argument-parser
Computed https://github.com/apple/swift-argument-parser at 1.2.2 (0.45s)
Creating working copy for https://github.com/rhx/SwiftLibXML.git
Working copy of https://github.com/rhx/SwiftLibXML.git resolved at main
Creating working copy for https://github.com/rhx/SwiftPangoCairo.git
Working copy of https://github.com/rhx/SwiftPangoCairo.git resolved at main
Creating working copy for https://github.com/rhx/SwiftGLib.git
Working copy of https://github.com/rhx/SwiftGLib.git resolved at main
Creating working copy for https://github.com/rhx/SwiftGdk.git
Working copy of https://github.com/rhx/SwiftGdk.git resolved at main
Creating working copy for https://github.com/rhx/SwiftAtk.git
Working copy of https://github.com/rhx/SwiftAtk.git resolved at main
Creating working copy for https://github.com/rhx/SwiftGdkPixbuf.git
Working copy of https://github.com/rhx/SwiftGdkPixbuf.git resolved at main
Creating working copy for https://github.com/jpsim/Yams.git
Working copy of https://github.com/jpsim/Yams.git resolved at 4.0.6
Creating working copy for https://github.com/apple/swift-argument-parser
Working copy of https://github.com/apple/swift-argument-parser resolved at 1.2.2
Creating working copy for https://github.com/rhx/SwiftHarfBuzz.git
Working copy of https://github.com/rhx/SwiftHarfBuzz.git resolved at main
Creating working copy for https://github.com/rhx/SwiftCairo.git
Working copy of https://github.com/rhx/SwiftCairo.git resolved at main
Creating working copy for https://github.com/rhx/gir2swift.git
Working copy of https://github.com/rhx/gir2swift.git resolved at main
Creating working copy for https://github.com/rhx/SwiftGIO.git
Working copy of https://github.com/rhx/SwiftGIO.git resolved at main
Creating working copy for https://github.com/rhx/SwiftPango.git
Working copy of https://github.com/rhx/SwiftPango.git resolved at main
Creating working copy for https://github.com/rhx/SwiftGObject.git
Working copy of https://github.com/rhx/SwiftGObject.git resolved at main
Creating working copy for https://github.com/rhx/SwiftGtk.git
Working copy of https://github.com/rhx/SwiftGtk.git resolved at gtk3
Creating working copy for https://github.com/rhx/SwiftGModule.git
Working copy of https://github.com/rhx/SwiftGModule.git resolved at main
Girs located at /opt/homebrew/share/gir-1.0
Building gir2swift
warning: '--build-path' option is deprecated; use '--scratch-path' instead
Fetching https://github.com/rhx/SwiftLibXML.git from cache
Fetched https://github.com/rhx/SwiftLibXML.git (0.65s)
Fetching https://github.com/apple/swift-argument-parser from cache
Fetching https://github.com/jpsim/Yams.git from cache
Fetched https://github.com/jpsim/Yams.git (0.78s)
Fetched https://github.com/apple/swift-argument-parser (0.78s)
Computing version for https://github.com/jpsim/Yams.git
Computed https://github.com/jpsim/Yams.git at 4.0.6 (0.44s)
Computing version for https://github.com/apple/swift-argument-parser
Computed https://github.com/apple/swift-argument-parser at 1.2.2 (0.46s)
Creating working copy for https://github.com/rhx/SwiftLibXML.git
Working copy of https://github.com/rhx/SwiftLibXML.git resolved at main
Creating working copy for https://github.com/jpsim/Yams.git
Working copy of https://github.com/jpsim/Yams.git resolved at 4.0.6
Creating working copy for https://github.com/apple/swift-argument-parser
Working copy of https://github.com/apple/swift-argument-parser resolved at 1.2.2
warning: '--build-path' option is deprecated; use '--scratch-path' instead
➜  SwiftHelloGtk git:(main) swift build `./run-gir2swift.sh flags -noUpdate`
Must specify package names on the command line
Must specify package names on the command line
warning: prohibited flag(s): -Wl,-framework,Cocoa, -Wl,-framework,Carbon, -Wl,-framework,CoreGraphics
warning: prohibited flag(s): -Wl,-framework,Cocoa, -Wl,-framework,Carbon, -Wl,-framework,CoreGraphics
Compiling plugin GenerateManual...
Compiling plugin gir2swift-plugin...
Building for debugging...
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
Warning: duplicate type 'language_from_string' for //gir:function ignored!
Warning: duplicate type 'language_get_default' for //gir:function ignored!
Warning: duplicate type 'shape' for //gir:function ignored!
Warning: duplicate type 'shape_full' for //gir:function ignored!
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/ffi/module.modulemap:1:8: error: redefinition of module 'FFI'
module FFI [system] [extern_c] {
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/ffi/module.modulemap:1:8: note: previously defined here
module FFI [system] [extern_c] {
       ^
[180/186] Converting Gtk Gtk-3.0.gir
➜  SwiftHelloGtk git:(main) 

Cannot build Swift wrappers on Arch Linux

When I run ./run-gir2swift.sh -noUpdate I get the following output:

Girs located at /usr/share/gir-1.0
Building gir2swift
Generating Swift Wrapper for Cairo ... 
Generating Swift Wrapper for Gdk ... 
Generating Swift Wrapper for GdkPixbuf ... 
Generating Swift Wrapper for GIO ... 
Generating Swift Wrapper for GLib ... 
Generating Swift Wrapper for GModule ... 
Generating Swift Wrapper for GLibObject ... 
Generating Swift Wrapper for Gtk ... Warning: duplicate type 'check_version' for //gir:function ignored!
Warning: duplicate type 'test_init' for //gir:function ignored!
/usr/bin/bash: line 1: Sources/Gtk/*-*.swift: ambiguous redirect
mv: target 'Sources/Gtk/Gtk-4.0-WidgetPaintable-WindowHandle.swift' is not a directory
Generating Swift Wrapper for Pango ... 
Generating Swift Wrapper for PangoCairo ... 

My Swift version (installed from here):

Swift version 5.3.1 (swift-5.3.1-RELEASE)
Target: x86_64-unknown-linux-gnu

I can't seem to find the source of the ambiguous redirect error.
Note that I've also modified the gir2swift-manifest.sh scripts in the in checkouts/Swift*/ dirs to try and build the wrappers. It seems like most of the wrappers started to work fine after I:

  • Installed parallel package
  • Wrapped the ${src} and "Sources/*-*.swift" variables in double quotations

Without wrapping the variables, I get this output instead:

Fetching https://github.com/rhx/gir2swift.git
Fetching https://github.com/rhx/SwiftGtk.git
Fetching https://github.com/rhx/SwiftLibXML.git
Fetching https://github.com/rhx/SwiftPangoCairo.git
Fetching https://github.com/rhx/SwiftGdk.git
Fetching https://github.com/rhx/SwiftCairo.git
Fetching https://github.com/rhx/SwiftPango.git
Fetching https://github.com/rhx/SwiftGdkPixbuf.git
Fetching https://github.com/rhx/SwiftGObject.git
Fetching https://github.com/rhx/SwiftGIO.git
Fetching https://github.com/rhx/SwiftGModule.git
Fetching https://github.com/rhx/SwiftGLib.git
Cloning https://github.com/rhx/SwiftCairo.git
Resolving https://github.com/rhx/SwiftCairo.git at main
Cloning https://github.com/rhx/SwiftLibXML.git
Resolving https://github.com/rhx/SwiftLibXML.git at main
Cloning https://github.com/rhx/SwiftPango.git
Resolving https://github.com/rhx/SwiftPango.git at main
Cloning https://github.com/rhx/SwiftGtk.git
Resolving https://github.com/rhx/SwiftGtk.git at gtk4
Cloning https://github.com/rhx/SwiftGIO.git
Resolving https://github.com/rhx/SwiftGIO.git at main
Cloning https://github.com/rhx/SwiftGdkPixbuf.git
Resolving https://github.com/rhx/SwiftGdkPixbuf.git at main
Cloning https://github.com/rhx/SwiftGLib.git
Resolving https://github.com/rhx/SwiftGLib.git at main
Cloning https://github.com/rhx/SwiftGObject.git
Resolving https://github.com/rhx/SwiftGObject.git at main
Cloning https://github.com/rhx/SwiftGModule.git
Resolving https://github.com/rhx/SwiftGModule.git at main
Cloning https://github.com/rhx/gir2swift.git
Resolving https://github.com/rhx/gir2swift.git at main
Cloning https://github.com/rhx/SwiftGdk.git
Resolving https://github.com/rhx/SwiftGdk.git at gtk4
Cloning https://github.com/rhx/SwiftPangoCairo.git
Resolving https://github.com/rhx/SwiftPangoCairo.git at main
Girs located at /usr/share/gir-1.0
Building gir2swift
Generating Swift Wrapper for Cairo ... 
Generating Swift Wrapper for Gdk ... 
Generating Swift Wrapper for GdkPixbuf ... 
Generating Swift Wrapper for GIO ... 
Generating Swift Wrapper for GLib ... 
Generating Swift Wrapper for GModule ... 
Generating Swift Wrapper for GLibObject ... 
Generating Swift Wrapper for Gtk ... Warning: duplicate type 'check_version' for //gir:function ignored!
Warning: duplicate type 'test_init' for //gir:function ignored!
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression
sed: file Gtk-4.0.sed line 4: Invalid preceding regular expression

Generating Swift Wrapper for Pango ... 
Generating Swift Wrapper for PangoCairo ... 

Generated executable file size is too big

When I build the example running ./build.sh, the generated executable .build/debug/HelloGtk is about 230MB in file size, which seems excessive for a simple application that only shows a window containing a text label.

If I strip the executable with $ strip HelloGtk, the file size gets reduced to 161MB, which is still too big.

Why are the binary executables so big? Is there any way to prevent this?

Label widget not displaying on Swift 5.3 on Linux

I have built the project, using ./build.sh It outputs some warnings:

'CGLib' glib-2.0 gio-unix-2.0.pc: warning: couldn't find pc file
'CGdkPixbuf' cairo glib-2.0 gio-unix-2.0.pc: warning: couldn't find pc file
'CPango' pango.pc: warning: non whitelisted flag(s): -pthread
'CCairo' cairo glib-2.0 gio-unix-2.0.pc: warning: couldn't find pc file
'CGdk' gdk-3.0 pangocairo pangoft2 pango gio-unix-2.0 glib-2..pc: warning: couldn't find pc file
'CAtk' atk glib-2.0 gio-unix-2.0.pc: warning: couldn't find pc file
'CGtk' gtk-3.0 gdk-3.0 pangocairo pangoft2 pango gio-unix-2.0 glib-2.0.pc: warning: couldn't find pc file
[3/3] Linking HelloGtk

When i run .build/debug/HelloGtk, a window appears with the title "Hello, world", but no widget or label inside, and I see this error messages on the terminal:

(HelloGtk:47107): GLib-GObject-WARNING **: 16:39:03.712: instance with invalid (NULL) class pointer

(HelloGtk:47107): GLib-GObject-CRITICAL **: 16:39:03.712: g_signal_emit_valist: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(HelloGtk:47107): GLib-GObject-CRITICAL **: 16:39:03.712: g_object_set_qdata: assertion 'G_IS_OBJECT (object)' failed

(HelloGtk:47107): GLib-GObject-WARNING **: 16:39:03.713: instance with invalid (NULL) class pointer

(HelloGtk:47107): GLib-GObject-CRITICAL **: 16:39:03.713: g_signal_handlers_destroy: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(HelloGtk:47107): GLib-GObject-WARNING **: 16:39:03.713: instance with invalid (NULL) class pointer

(HelloGtk:47107): GLib-GObject-CRITICAL **: 16:39:03.713: g_signal_handlers_destroy: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(HelloGtk:47107): GLib-GObject-CRITICAL **: 16:39:03.713: g_object_unref: assertion 'old_ref > 0' failed

Captura de pantalla de 2020-11-12 16-40-19

If I try to add more widgets, like Box or HeaderBar on the source file, I see more error messages like the above, and no widgets on the window.

I'm using Fedora 33 (Linux) x86_64
Gnome 3.38.1

The output of swift --version is:

Swift version 5.3 (swift-5.3-RELEASE)
Target: x86_64-unknown-linux-gnu

I have all the dependencies installed via:
sudo dnf install gtk3-devel pango-devel cairo-devel cairo-gobject-devel glib2-devel gobject-introspection-devel libxml2-devel

Failed to clone https://github.com/rhx/SwiftGtk.git

gavr@arch ~/Д/S/SwiftHelloGtk-master> ./build.sh 
Fetching https://github.com/rhx/SwiftGtk.git
error: Failed to clone https://github.com/rhx/SwiftGtk.git:
    Cloning to a naked repository «/home/gavr/Документы/Swift/SwiftHelloGtk-master/.build/repositories/SwiftGtk-4df43143»…
    error: unable to write file /home/gavr/Документы/Swift/SwiftHelloGtk-master/.build/repositories/SwiftGtk-4df43143/objects/pack/pack-e41a2ee53aa13c8e80cb20fb1b962729bb2852e5.pack: There is no such file or directory
    fatal: failed to save the package file
    fatal: index-pack exit with error

Linux: Arch

Shell scripts giving syntax errors and "No such file or directory" errors

I've installed the required libraries and cloned the repository. Running build.sh gives these messages:

: No such file or directoryg.sh
: No such file or directoryrate-wrapper.sh
; use --help to list available arguments
./build.sh: line 15: syntax error: unexpected end of file

Running config.sh directly:

./config.sh: line 27: syntax error near unexpected token `else'
'/config.sh: line 27: `   else if which gtac >/dev/null ; then

Running distclean.sh:

: No such file or directoryonfig.sh
: No such file or directorylean.sh

I also get these errors when trying to build gir2swift and the other SwiftGtk examples.

I'm running Ubuntu 20.04.1, bash 5.0.17, Swift 5.2.5

Maybe this is a problem with bash?

run-gir2swift.sh fails on ubuntu 18.04

The gir2swift script fails, it says swift is not found, yet the shell finds it:

$ ./run-gir2swift.sh
Updating https://github.com/rhx/gir2swift.git
Updating https://github.com/rhx/SwiftGtk.git
Updating https://github.com/rhx/SwiftLibXML.git
Updating https://github.com/rhx/SwiftAtk.git
Updating https://github.com/rhx/SwiftGdk.git
Updating https://github.com/rhx/SwiftGObject.git
Updating https://github.com/rhx/SwiftGdkPixbuf.git
Updating https://github.com/rhx/SwiftPangoCairo.git
Updating https://github.com/rhx/SwiftGLib.git
Updating https://github.com/rhx/SwiftGIO.git
Updating https://github.com/rhx/SwiftGModule.git
Updating https://github.com/rhx/SwiftCairo.git
Updating https://github.com/rhx/SwiftPango.git
Everything is already up-to-date
Girs located at /opt/homebrew/share/gir-1.0
Building gir2swift
./package.sh: 7: exec: swift: not found
./build.sh: 9: exec: swift: not found

$ swift --version
Swift version 5.5-dev (LLVM 1dbec5689bdaa90, Swift a72070e76a65bc7)
Target: x86_64-unknown-linux-gnu

lots of compile errors on linux

OS: Ubuntu 20.04.2 LTS (Focal Fossa)
Swift version 5.3.2 (swift-5.3.2-RELEASE)

Error Logs:

/home/gery/Downloads/SwiftHelloGtk-main/.build/checkouts/SwiftGLib/Sources/GLib/Time.swift:24:47: error: cannot find 'SourceFunc' in scope
let callback = unsafeBitCast(handler, to: SourceFunc.self)
^~~~~~~~~~
/home/gery/Downloads/SwiftHelloGtk-main/.build/checkouts/SwiftGLib/Sources/GLib/Time.swift:25:14: error: cannot find 'timeoutAddFull' in scope
let rv = timeoutAddFull(priority: p, interval: interval, function: callback, data: opaqueHolder) {
^~~~~~~~~~~~~~
/home/gery/Downloads/SwiftHelloGtk-main/.build/checkouts/SwiftGLib/Sources/GLib/Error.swift:17:33: error: cannot find type 'ErrorRef' in scope
public typealias GLibErrorRef = ErrorRef

And many others......

Compilation fails on Fedora 30

Here are the first error messages

./build.sh
'CAtk' atk gio-unix-2.0 glib-2.0.pc: warning: couldn't find pc file
'CCairo' cairo glib-2.0 gio-unix-2.0.pc: warning: couldn't find pc file
'CGLib' glib-2.0 gio-unix-2.0.pc: warning: couldn't find pc file
'CGdkPixbuf' gdk-pixbuf-2.0 gio-unix-2.0 glib-2.0.pc: warning: couldn't find pc file
'CGdk' gdk-3.0 pangocairo pangoft2 pango gio-unix-2.0 glib-2.0.pc: warning: couldn't find pc file
'CGtk' gtk-3.0 gdk-3.0 pangocairo pangoft2 pango gio-unix-2.0 glib-2.0.pc: warning: couldn't find pc file
/tmp/SwiftHelloGtk/.build/checkouts/SwiftGIO/Sources/GIO/Gio-2.0-callbacks.swift:166:45: error: use of undeclared type 'GDesktopAppLaunchCallback'
public typealias DesktopAppLaunchCallback = GDesktopAppLaunchCallback                                          

I did the dnf installations as described in the README.md file.

Not building

Thanks for the help and for the wrapper!

Still getting errors with this version, any ideas on how to circumvent the error below:

Seems to be related to CPango.

Fetching https://github.com/rhx/SwiftGtk.git
Fetching https://github.com/rhx/CGtk.git
Fetching https://github.com/rhx/SwiftGdk.git
Fetching https://github.com/rhx/SwiftAtk.git
Fetching https://github.com/rhx/CGdk.git
Fetching https://github.com/rhx/SwiftGdkPixbuf.git
Fetching https://github.com/rhx/SwiftPangoCairo.git
Fetching https://github.com/rhx/CGdkPixbuf.git
Fetching https://github.com/rhx/SwiftGIO.git
Fetching https://github.com/rhx/SwiftGModule.git
Fetching https://github.com/rhx/SwiftGObject.git
Fetching https://github.com/rhx/SwiftGLib.git
Fetching https://github.com/rhx/CGLib.git
Fetching https://github.com/rhx/SwiftCairo.git
Fetching https://github.com/rhx/SwiftPango.git
Fetching https://github.com/rhx/CCairo.git
Fetching https://github.com/rhx/CPango.git
Fetching https://github.com/rhx/CAtk.git
Cloning https://github.com/rhx/SwiftPango.git
Resolving https://github.com/rhx/SwiftPango.git at 2.52.0
Cloning https://github.com/rhx/SwiftAtk.git
Resolving https://github.com/rhx/SwiftAtk.git at 2.52.0
Cloning https://github.com/rhx/SwiftGdkPixbuf.git
Resolving https://github.com/rhx/SwiftGdkPixbuf.git at 2.52.0
Cloning https://github.com/rhx/SwiftGtk.git
Resolving https://github.com/rhx/SwiftGtk.git at 3.22.0
Cloning https://github.com/rhx/SwiftGModule.git
Resolving https://github.com/rhx/SwiftGModule.git at 2.52.0
Cloning https://github.com/rhx/SwiftGLib.git
Resolving https://github.com/rhx/SwiftGLib.git at 2.52.0
Cloning https://github.com/rhx/CGdk.git
Resolving https://github.com/rhx/CGdk.git at 1.0.5
Cloning https://github.com/rhx/SwiftCairo.git
Resolving https://github.com/rhx/SwiftCairo.git at 2.52.0
Cloning https://github.com/rhx/CAtk.git
Resolving https://github.com/rhx/CAtk.git at 1.0.0
Cloning https://github.com/rhx/SwiftGIO.git
Resolving https://github.com/rhx/SwiftGIO.git at 2.52.0
Cloning https://github.com/rhx/SwiftGdk.git
Resolving https://github.com/rhx/SwiftGdk.git at 3.22.0
Cloning https://github.com/rhx/SwiftPangoCairo.git
Resolving https://github.com/rhx/SwiftPangoCairo.git at 2.52.0
Cloning https://github.com/rhx/CGtk.git
Resolving https://github.com/rhx/CGtk.git at 1.0.14
Cloning https://github.com/rhx/CPango.git
Resolving https://github.com/rhx/CPango.git at 1.0.2
Cloning https://github.com/rhx/CGLib.git
Resolving https://github.com/rhx/CGLib.git at 1.0.16
Cloning https://github.com/rhx/SwiftGObject.git
Resolving https://github.com/rhx/SwiftGObject.git at 2.52.0
Cloning https://github.com/rhx/CGdkPixbuf.git
Resolving https://github.com/rhx/CGdkPixbuf.git at 1.0.1
Cloning https://github.com/rhx/CCairo.git
Resolving https://github.com/rhx/CCairo.git at 1.0.2
Cloning into 'gir2swift'...
remote: Counting objects: 1280, done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 1280 (delta 13), reused 0 (delta 0), pack-reused 1255
Receiving objects: 100% (1280/1280), 207.49 KiB | 217.00 KiB/s, done.
Resolving deltas: 100% (858/858), done.
Fetching https://github.com/rhx/SwiftLibXML.git
Fetching https://github.com/rhx/CLibXML2.git
Cloning https://github.com/rhx/CLibXML2.git
Resolving https://github.com/rhx/CLibXML2.git at 1.0.1
Cloning https://github.com/rhx/SwiftLibXML.git
Resolving https://github.com/rhx/SwiftLibXML.git at 1.2.0
Compile Swift Module 'SwiftLibXML' (6 sources)
Compile Swift Module 'gir2swift' (14 sources)
Linking ./.build/debug/gir2swift
which: no parallel in (/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/gir2swift/.build/debug:/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/gir2swift/.build/debug:/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/gir2swift/.build/debug:/home/luis/.dropbox-bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
Generate Swift Wrapper for SwiftAtk.git
Generate Swift Wrapper for SwiftCairo.git
Generate Swift Wrapper for SwiftGdk.git
Generate Swift Wrapper for SwiftGdkPixbuf.git
Generate Swift Wrapper for SwiftGIO.git
Generate Swift Wrapper for SwiftGLib.git
Generate Swift Wrapper for SwiftGModule.git
Generate Swift Wrapper for SwiftGObject.git
Generate Swift Wrapper for SwiftGtk.git
Generate Swift Wrapper for SwiftPangoCairo.git
Generate Swift Wrapper for SwiftPango.git
./generate-wrapper.sh: linha 29: ./gir-to-swift.sh: Arquivo ou diretório não encontrado
Compile Swift Module 'GLib' (2 sources)
Compile Swift Module 'GLibObject' (2 sources)
Compile Swift Module 'GModule' (3 sources)
Compile Swift Module 'Pango' (2 sources)
Compile Swift Module 'GIO' (3 sources)
Compile Swift Module 'Atk' (2 sources)
Compile Swift Module 'Cairo' (5 sources)
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "atk_bridging.h"
         ^
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/CAtk.git-802056131302926785/atk_bridging.h:19:10: note: in file included from /home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/CAtk.git-802056131302926785/atk_bridging.h:19:
#include <atk/atk.h>
         ^
/usr/include/atk-1.0/atk/atk.h:25:10: note: in file included from /usr/include/atk-1.0/atk/atk.h:25:
#include <atk/atkobject.h>
         ^
/usr/include/atk-1.0/atk/atkobject.h:27:10: note: in file included from /usr/include/atk-1.0/atk/atkobject.h:27:
#include <glib-object.h>
         ^
/usr/include/glib-2.0/glib-object.h:23:10: note: in file included from /usr/include/glib-2.0/glib-object.h:23:
#include <gobject/gbinding.h>
         ^
/usr/include/glib-2.0/gobject/gbinding.h:28:10: note: in file included from /usr/include/glib-2.0/gobject/gbinding.h:28:
#include <glib.h>
         ^
/usr/include/glib-2.0/glib.h:37:10: note: in file included from /usr/include/glib-2.0/glib.h:37:
#include <glib/gbookmarkfile.h>
         ^
/usr/include/glib-2.0/glib/gbookmarkfile.h:172:11: error: declaration of 'time_t' must be imported from module 'SwiftGlibc.POSIX.sys.types' before it is required
                                                    time_t          stamp,
                                                    ^
/usr/include/bits/types/time_t.h:8:18: note: previous declaration is here
typedef __time_t time_t;
                 ^
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/SwiftAtk.git--9051473419055086158/Sources/Atk-1.0.swift:68:8: error: could not build Objective-C module 'CAtk'
import CAtk
       ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "atk_bridging.h"
         ^
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/CAtk.git-802056131302926785/atk_bridging.h:19:10: note: in file included from /home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/CAtk.git-802056131302926785/atk_bridging.h:19:
#include <atk/atk.h>
         ^
/usr/include/atk-1.0/atk/atk.h:25:10: note: in file included from /usr/include/atk-1.0/atk/atk.h:25:
#include <atk/atkobject.h>
         ^
/usr/include/atk-1.0/atk/atkobject.h:27:10: note: in file included from /usr/include/atk-1.0/atk/atkobject.h:27:
#include <glib-object.h>
         ^
/usr/include/glib-2.0/glib-object.h:23:10: note: in file included from /usr/include/glib-2.0/glib-object.h:23:
#include <gobject/gbinding.h>
         ^
/usr/include/glib-2.0/gobject/gbinding.h:28:10: note: in file included from /usr/include/glib-2.0/gobject/gbinding.h:28:
#include <glib.h>
         ^
/usr/include/glib-2.0/glib.h:37:10: note: in file included from /usr/include/glib-2.0/glib.h:37:
#include <glib/gbookmarkfile.h>
         ^
/usr/include/glib-2.0/glib/gbookmarkfile.h:172:11: error: declaration of 'time_t' must be imported from module 'SwiftGlibc.POSIX.sys.types' before it is required
                                                    time_t          stamp,
                                                    ^
/usr/include/bits/types/time_t.h:8:18: note: previous declaration is here
typedef __time_t time_t;
                 ^
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/SwiftAtk.git--9051473419055086158/Sources/Atk-1.0.swift:68:8: error: could not build Objective-C module 'CAtk'
import CAtk
       ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "pango_bridging.h"
         ^
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/CPango.git-8534786963623224497/pango_bridging.h:30:10: note: in file included from /home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/CPango.git-8534786963623224497/pango_bridging.h:30:
#include <pango/pango.h>
         ^
/usr/include/pango-1.0/pango/pango.h:25:10: note: in file included from /usr/include/pango-1.0/pango/pango.h:25:
#include <pango/pango-attributes.h>
         ^
/usr/include/pango-1.0/pango/pango-attributes.h:25:10: note: in file included from /usr/include/pango-1.0/pango/pango-attributes.h:25:
#include <pango/pango-font.h>
         ^
/usr/include/pango-1.0/pango/pango-font.h:25:10: note: in file included from /usr/include/pango-1.0/pango/pango-font.h:25:
#include <pango/pango-coverage.h>
         ^
/usr/include/pango-1.0/pango/pango-coverage.h:25:10: note: in file included from /usr/include/pango-1.0/pango/pango-coverage.h:25:
#include <glib.h>
         ^
/usr/include/glib-2.0/glib.h:37:10: note: in file included from /usr/include/glib-2.0/glib.h:37:
#include <glib/gbookmarkfile.h>
         ^
/usr/include/glib-2.0/glib/gbookmarkfile.h:172:11: error: declaration of 'time_t' must be imported from module 'SwiftGlibc.POSIX.sys.types' before it is required
                                                    time_t          stamp,
                                                    ^
/usr/include/bits/types/time_t.h:8:18: note: previous declaration is here
typedef __time_t time_t;
                 ^
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/SwiftPango.git-2470057126323549457/Sources/Pango-1.0.swift:68:8: error: could not build Objective-C module 'CPango'
import CPango
       ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "pango_bridging.h"
         ^
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/CPango.git-8534786963623224497/pango_bridging.h:30:10: note: in file included from /home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/CPango.git-8534786963623224497/pango_bridging.h:30:
#include <pango/pango.h>
         ^
/usr/include/pango-1.0/pango/pango.h:25:10: note: in file included from /usr/include/pango-1.0/pango/pango.h:25:
#include <pango/pango-attributes.h>
         ^
/usr/include/pango-1.0/pango/pango-attributes.h:25:10: note: in file included from /usr/include/pango-1.0/pango/pango-attributes.h:25:
#include <pango/pango-font.h>
         ^
/usr/include/pango-1.0/pango/pango-font.h:25:10: note: in file included from /usr/include/pango-1.0/pango/pango-font.h:25:
#include <pango/pango-coverage.h>
         ^
/usr/include/pango-1.0/pango/pango-coverage.h:25:10: note: in file included from /usr/include/pango-1.0/pango/pango-coverage.h:25:
#include <glib.h>
         ^
/usr/include/glib-2.0/glib.h:37:10: note: in file included from /usr/include/glib-2.0/glib.h:37:
#include <glib/gbookmarkfile.h>
         ^
/usr/include/glib-2.0/glib/gbookmarkfile.h:172:11: error: declaration of 'time_t' must be imported from module 'SwiftGlibc.POSIX.sys.types' before it is required
                                                    time_t          stamp,
                                                    ^
/usr/include/bits/types/time_t.h:8:18: note: previous declaration is here
typedef __time_t time_t;
                 ^
/home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/checkouts/SwiftPango.git-2470057126323549457/Sources/Pango-1.0.swift:68:8: error: could not build Objective-C module 'CPango'
import CPango
       ^
<unknown>:0: error: build had 2 command failures
error: exit(1): /usr/bin/swift-build-tool -f /home/luis/Dropbox/Documentos/Coding/Swift/SwiftHelloGtk/.build/debug.yaml

Can't build it

When I execute ./build.sh:

./build.sh 
Cloning https://github.com/rhx/SwiftGtk.git
HEAD is now at 64d5474 Add convenience methods for text views and text buffers
Resolved version: 3.18.0
Cloning https://github.com/rhx/CGtk.git
HEAD is now at 91228fb Add types from gtk+-3.20
Resolved version: 1.0.7
Cloning https://github.com/rhx/SwiftGdk.git
HEAD is now at ba73d61 Run clean.sh from distclean.sh
Resolved version: 3.18.0
Cloning https://github.com/rhx/CGdk.git
HEAD is now at b70871e Link against gdk-3 rather than 3.0
Resolved version: 1.0.2
Cloning https://github.com/rhx/SwiftGdkPixbuf.git
HEAD is now at 26fda9b Ignore signal and property associated types for global type aliases
Resolved version: 2.46.0
Cloning https://github.com/rhx/CGdkPixbuf.git
HEAD is now at 739a1ab Add empty, private structs so they get properly exported to Swift
Resolved version: 1.0.0
Cloning https://github.com/rhx/SwiftGIO.git
HEAD is now at b3105eb Ignore signal and property associated types for global type aliases
Resolved version: 2.46.0
Cloning https://github.com/rhx/SwiftGObject.git
HEAD is now at 666c71a Remove hard-coded PATH
Resolved version: 2.46.0
Cloning https://github.com/rhx/SwiftGLib.git
HEAD is now at 1192855 Remove hard-coded PATH
Resolved version: 2.46.0
Cloning https://github.com/rhx/CGLib.git
HEAD is now at 9c610fd Enable [swift_infer_import_as_member]
Resolved version: 1.0.12
Cloning https://github.com/rhx/SwiftGModule.git
HEAD is now at d2cdf8b Ignore signal and property associated types for global type aliases
Resolved version: 2.46.0
Cloning https://github.com/rhx/SwiftPangoCairo.git
HEAD is now at 81915d0 Run clean.sh from distclean.sh
Resolved version: 2.46.0
Cloning https://github.com/rhx/SwiftCairo.git
HEAD is now at 90d67ce Ignore signal and property associated types for global type aliases
Resolved version: 2.46.0
Cloning https://github.com/rhx/CCairo.git
HEAD is now at bd6ba57 Fix cairo library name
Resolved version: 1.0.2
Cloning https://github.com/rhx/SwiftPango.git
HEAD is now at 737985e Run clean.sh from distclean.sh
Resolved version: 2.46.0
Cloning https://github.com/rhx/CPango.git
HEAD is now at 803b906 Fix cairo library name
Resolved version: 1.0.2
Cloning https://github.com/rhx/SwiftAtk.git
HEAD is now at 8bcd126 Run clean.sh from distclean.sh
Resolved version: 2.46.0
Cloning https://github.com/rhx/CAtk.git
HEAD is now at 694cbaa Add private structs so that public types get exported to Swift
Resolved version: 1.0.0
Generate Swift Wrapper for Atk-2.46.0
./gir-to-swift.sh: 24: ./gir-to-swift.sh: gir2swift: not found
Generate Swift Wrapper for Cairo-2.46.0
***  does not exist!
Make sure libgirepository1.0-dev is installed
and can be found in /usr /usr/local or by pkg-config!
Generate Swift Wrapper for GIO-2.46.0
***  does not exist!
Make sure libgirepository1.0-dev is installed
and can be found in /usr /usr/local or by pkg-config!
Generate Swift Wrapper for GLib-2.46.0
***  does not exist!
Make sure libgirepository1.0-dev is installed
and can be found in /usr /usr/local or by pkg-config!
Generate Swift Wrapper for GModule-2.46.0
***  does not exist!
Make sure libgirepository1.0-dev is installed
and can be found in /usr /usr/local or by pkg-config!
Generate Swift Wrapper for GObject-2.46.0
***  does not exist!
Make sure libgirepository1.0-dev is installed
and can be found in /usr /usr/local or by pkg-config!
Generate Swift Wrapper for Gdk-3.18.0
./gir-to-swift.sh: 24: ./gir-to-swift.sh: gir2swift: not found
Generate Swift Wrapper for GdkPixbuf-2.46.0
./gir-to-swift.sh: 24: ./gir-to-swift.sh: gir2swift: not found
Generate Swift Wrapper for Gtk-3.18.0
./gir-to-swift.sh: 24: ./gir-to-swift.sh: gir2swift: not found
Generate Swift Wrapper for Pango-2.46.0
./gir-to-swift.sh: 24: ./gir-to-swift.sh: gir2swift: not found
Generate Swift Wrapper for PangoCairo-2.46.0
./gir-to-swift.sh: 24: ./gir-to-swift.sh: gir2swift: not found
error: noModules(GModule)

Ubuntu 16.04 with Swift 3.0 Preview 2, libgtk-3-dev is installed, maybe I miss something else?

Thanks!

Building on Ubuntu 20.04 produces no executable

Local Config

  • Ubuntu 20.04
  • Swift Version 5.2.5
  • All dependencies installed via README.md instructions to enable SwiftGtk

Issues

  • I am following all of the instructions in the README.
  • The product builds and runs as expected using Xcode on macOS 10.15
  • Cloning the same repo in the Ubuntu env, installing all deps and running ./build.sh starts the build process. However, once it is finished, there is no output application as there was in macOS.

Potential Resolutions / Suggestions

  • It could be that I don't understand something here. There is a folder named "x86_64-unknown-linux-gnu" under .build/, but no executable
    • If I am missing something here, could you please update the README?
  • Potentially, this latest version does not product an executable for Ubuntu 20.04 machines.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.