rhx / SwiftGtk

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

Unable to finish compile on Ubuntu 18.04 LTS with Swift 5.1 #13

Closed ksubryan closed 4 years ago

ksubryan commented 5 years ago

Failed to reconstruct type for $sSo13va_list_tagVmD Original type: (metatype_type (struct_type decl=ObjC.(file).__va_list_tag)) Stack dump:

  1. Program arguments: /usr/share/swift/usr/bin/swift -frontend -c /home/kri
rhx commented 5 years ago

Yes, this seems to be a bug in the 5.1 prerelease on Linux (as of 5.1-DEVELOPMENT-SNAPSHOT-2019-08-12-a). It works fine for me under Swift 5.0.2 (as well as 5.1 under macOS).

ksubryan commented 5 years ago

Actually it is something else. I resolved all issues regarding Swift 5.1 use on Linux in VSCode. I can build and debug all my projects. To test I installed 5.0.2 on Ubuntu 18.04 and results were the same. SwiftGTK compiles without issues until it reaches GTKHelpers. In my case, reconstruction failure results from inability of the compiler to located <gtk/gtk.h>. (it is in the usual location and is found by other projects). The first error crops up for .build/checkouts/SwiftGTK/Sources/GTKHelpers/gtk_dialog.c when preprocessors is unable to located #include <gtk/gtk.h> in gtk_dialog.h. "missing" file is located in /usr/include inspecting flags passed compiler revels -Xcc -I/usr/include/gtk-3.0

Exact same behaviour with Swift 5.0.2 & 5.1.

Also it would be nice to understand why warnings happen around " Generate Swift Wrapper for SwiftPango warning: you may be able to install glib-2.0 gio-unix-2.0 using your system-packager: "

msenol86 commented 5 years ago

Actually it is something else. I resolved all issues regarding Swift 5.1 use on Linux in VSCode. I can build and debug all my projects. To test I installed 5.0.2 on Ubuntu 18.04 and results were the same. SwiftGTK compiles without issues until it reaches GTKHelpers. In my case, reconstruction failure results from inability of the compiler to located <gtk/gtk.h>. (it is in the usual location and is found by other projects). The first error crops up for .build/checkouts/SwiftGTK/Sources/GTKHelpers/gtk_dialog.c when preprocessors is unable to located #include <gtk/gtk.h> in gtk_dialog.h. "missing" file is located in /usr/include inspecting flags passed compiler revels -Xcc -I/usr/include/gtk-3.0

Exact same behaviour with Swift 5.0.2 & 5.1.

Also it would be nice to understand why warnings happen around " Generate Swift Wrapper for SwiftPango warning: you may be able to install glib-2.0 gio-unix-2.0 using your system-packager: "

Generate Swift Wrapper for SwiftGModule
Generate Swift Wrapper for SwiftGdkPixbuf
Generate Swift Wrapper for SwiftPango
Generate Swift Wrapper for SwiftCairo
Generate Swift Wrapper for SwiftGdk
Error Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist."
Generate Swift Wrapper for SwiftGObject
Generate Swift Wrapper for SwiftAtk
Generate Swift Wrapper for SwiftGIO
Generate Swift Wrapper for SwiftGLib
Generate Swift Wrapper for SwiftGtk
warning: you may be able to install gtk-3.0 gdk-3.0 pangocairo pangoft2 pango gio-unix-2.0 glib-2.0 using your system-packager:
     apt-get install libgtk-3-dev libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev

warning: you may be able to install glib-2.0 gio-unix-2.0 using your system-packager:
     apt-get install libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev

warning: you may be able to install cairo glib-2.0 gio-unix-2.0 using your system-packager:
     apt-get install libgdk-pixbuf2.0-dev libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev

warning: you may be able to install atk glib-2.0 gio-unix-2.0 using your system-packager:
     apt-get install libatk1.0-dev libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev

warning: you may be able to install cairo glib-2.0 gio-unix-2.0 using your system-packager:
     apt-get install libcairo2-dev libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev

warning: you may be able to install gdk-3.0 pangocairo pangoft2 pango gio-unix-2.0 glib-2. using your system-packager:
     apt-get install libgtk-3-dev libglib2.0-dev glib-networking gobject-introspection libgirepository1.0-dev

In file included from /media/msenol/ONETB/GTKTEST/SwiftHelloGtk/.build/checkouts/SwiftGtk/Sources/GtkCHelpers/gtk_dialog.c:1:
/media/msenol/ONETB/GTKTEST/SwiftHelloGtk/.build/checkouts/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/45] Compiling GtkCHelpers gtk_dialog.c

I have the same issue. How can I fix that?

After adding these lines to config.sh I managed to solve some compile issues but there are still errors.

export CPATH=$CPATH:/usr/include/gtk-3.0
export CPATH=$CPATH:/usr/include/glib-2.0/
export CPATH=$CPATH:/usr/include/pango-1.0/
export CPATH=$CPATH:/usr/include/cairo/
export CPATH=$CPATH:/usr/include/gdk-pixbuf-2.0/
export CPATH=$CPATH:/usr/include/atk-1.0/
rhx commented 5 years ago

Can you try running

./distclean.sh
bash -x ./build.sh

and post the output?

[Edit: added distclean]

msenol86 commented 5 years ago

Can you try running

./distclean.sh
bash -x ./build.sh

and post the output?

[Edit: added distclean]

My Swift Version (I get the same result with version 4.2.4):

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

I have also restored config.sh to original form.

Output of bash -x ./build.sh: swiftgtk.log Output of bash -x ./test.sh: swiftgtk_test.log

ksubryan commented 5 years ago

I have seen this issue with VSCode with C. I could not find it now but I saww some comments on this issue in VSCode issues.

Mucahit, would you be kind and post your configuration for VSCode? I had hard time making it to work.

Rene,

My latest attempt to build with swift 5.1 post from October 4th produced this error.

/home/kristof/Development/SwiftProjects/Swift+GTK/SwiftHelloGtk-master/.build/checkouts/SwiftGLib/Sources/GLib/GLib.swift:22:23: error: use of unresolved identifier 'getVaList'         let va_list = getVaList(varargs)

It is repeated many items and eventually results in a crash for swift.

To the best of my knowledge, Apple identified issue with the crash but the internal bug is not assigned and no work was done to address the issue. The crash is attributed to an assert in the compiler and "owner" of the assert is identified as well.

Attempt to build on OSX with 5.0.1 compiled correctly with no issues, other than warning about need to change protocol for hashable but when attempt to run produced core dump. I have not had time to look into fixing as I more interested in Ubuntu version.

On 2019-10-06 11:41 a.m., Mucahit Senol wrote:

Actually it is something else.
I resolved all issues regarding Swift 5.1 use on Linux in VSCode.
I can build and debug all my projects.
To test I installed 5.0.2 on Ubuntu 18.04 and results were the same.
SwiftGTK compiles without issues until it reaches GTKHelpers.
In my case, reconstruction failure results from inability of the
compiler to located <gtk/gtk.h>. (it is in the usual location and
is found by other projects).
The first error crops up for
.build/checkouts/SwiftGTK/Sources/GTKHelpers/gtk_dialog.c
when preprocessors is unable to located #include <gtk/gtk.h> in
gtk_dialog.h.
"missing" file is located in /usr/include
inspecting flags passed compiler revels -Xcc -I/usr/include/gtk-3.0

Exact same behaviour with Swift 5.0.2 & 5.1.

Also it would be nice to understand why warnings happen around
" Generate Swift Wrapper for SwiftPango
warning: you may be able to install glib-2.0 gio-unix-2.0 using
your system-packager: "

I have the same issue. How can I fix that?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rhx/SwiftGtk/issues/13?email_source=notifications&email_token=ADBCKSWBR7IXIUO353UWPQDQNIWO5A5CNFSM4IK5EOM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAOQ7IQ#issuecomment-538775458, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBCKSUYXUSIDSE3NHHRPTLQNIWO5ANCNFSM4IK5EOMQ.

rhx commented 4 years ago

Yes, this is a bit unfortunate. I have committed a workaround that fixes the getVaList() compilation problem for GLib now, but compiling SwiftGtk under Linux (with either 5.0.3 or 5.1) still yields Failed to reconstruct type for $sSo13__va_list_tagVmD

rhx commented 4 years ago

@msenol86: This should be working again under Linux using Swift 4.2.4 (you need to git pull and ./distclean.sh to ensure the latest versions are downloaded).

msenol86 commented 4 years ago

@rhx Thanks it compiled on 4.2.4 . Thank you very much.

smumriak commented 4 years ago

Hey @rhx i'm hitting the same issue on swift 5.1.3

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

Any chance you could point me to the direction of the issue you were looking back in October?

rhx commented 4 years ago

I have investigated some more, and it appears the bug only occurs when va_lists are created from within glib functions. I have committed a workaround for SwiftGLib. Can you do a ./distclean.sh and check if this compiles with 5.1.3 for you now?

smumriak commented 4 years ago

Thanks @rhx, now compiler does not crash because of va_lists. Tho i've been trying to build 'SwiftHelloGTK' right now and it fails with

Gio-2.0-callbacks.swift:166:45: error: use of undeclared type 'GDesktopAppLaunchCallback'
public typealias DesktopAppLaunchCallback = GDesktopAppLaunchCallback

But I guess this is completely different topic.

rhx commented 4 years ago

Which version of glib do you have installed?

rhx commented 4 years ago

Okay, I have pushed a workaround for versions of glib that no longer define GDesktopAppLaunchCallback but still have it in their .gir files. Can you pull, do another ./distclean.sh, and see if this works for you now?