Closed KenJean closed 2 years ago
Got same error with GTK 4 hello world and gintro#head branch( Im not sure that this is somehow related to arch linux @KenJean better change issue name
I will try to investigate this, but have currently no idea.
When you are new to GTK, my general advice is just to use one of the other 20 Nim GUI toolkits when possible. Learning GTK is hard, using it from within C is ugly, and using it from other languages is difficult. Mr. Bassi is becoming more and more unfriendly, see https://discourse.gnome.org/t/code-of-conduct/11162. And there are few other devs with some knowledge of GTK internals left.
When you still should intend to use gintro, then use "nimble install gintro@#head" for now. As latest version is already 0.9.9, we publish currently no new releases, as stated in the README. And of course you should try to use GTK4 now, GTK3 is legacy, and GTK4 has some serious improvements. The fate of gintro is unclear. The number of users is currently very close to zero, so maybe it is a good time to remove gintro from github soon? At least I do not intent to spent much more time on it, more than 1600 hours was really a lot for such a tiny numbers of users.
I will inform you when I will be able to reproduce your issue, maybe I have to wait until next GTK update arrives at my Gentoo box. Or, you may learn some Nim and search for the issue yourself -- finding such issues is generally easy, when they occur on the local box. Fixing may be difficult in rare cases, but most often it is not that hard. Fixing this issue may take some time for me, as I am busy as always, and my current GTK related work with highest priority is adding sections about ListViews to the GTK book, before I forget all the details again. As you may have seen, I recently added the DND sections, which still suffer from this bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/5265#note_1575294
Thank you so much for your detailed response and advice. Yes, I've approached GTK from the C side and the Python side as well over the years and can certainly understand what you say about it being difficult and "ugly."
Came across Nim as a programming language a few months ago and am really enjoying it. So I've been shopping around for a GUI toolkit and have played around with the likes of nimx and Nigui. In the case of the former, I am hampered by there being practically no documentation and the later is missing a lot of the features that I need.
And yes, I definitely was planning on going to GTK4. It was just that I already had GTK3 installed and was testing things out.
Yes, I am frantically still trying to track down the problem myself and post a solution, but just thought I'd see whether better minds could point me in the right direction.
Sorry to hear you're thinking of pulling gintro - but in light of what you say, this is very understandable.
Anyway, I'll keep plugging at it, and will post if I find anything useful.
Best of luck on your endeavours, and just know that at least I, for one, appreciate all the work you've put into this project.
⇒ KJ
Thanks for your reply, it shows me that you are a real person and not a bot that tries to generate as many issues as possible to block productive work. Some of the older gintro issues look like that -- like people requesting new packages or features, and then disappearing.
I initially regarded your actual error message as useless, as on my box line 5599 of gtk.nim may be very different. But actually it makes some sense:
proc newApplication*(applicationId: cstring = nil; flags: gio.ApplicationFlags = {}): Application =
May it be related to your Nim compiler version? I am using always latest devel.
Well, my feeling is that the issue is the default {} empty set parameter. But I wonder why it had worked for the last eight years? The upcomming Nim 2.0 is one more issue for gintro of course, as it may break a lot, and I have the impression that he does it by intent. As you may know, he does not like me and my book that much :-)
Makes still no sense to me:
Error: type mismatch: got 'set[empty]' for '{}' but expected 'ApplicationFlags = enum'
grep ApplicationFlags ~/.nimble/pkgs/gintro-#head/gintro/gio.nim
ApplicationFlags* {.size: sizeof(cint).} = set[ApplicationFlag]
So at least at my box, gio.ApplicationFlags is a set, and not a enum. And it always was.
When it is actually different on your box, then I wonder why the generator script gen.nim may have generated that differently.
Have to do some work now, bye.
Aha, the plot thickens.
As I mentioned in my original post, I have the luxury of having two different computers: one where it's working, the other not. I shall endeavour to make a detailed comparison tomorrow (it's the middle of the night here right now) of the two machines and see if I can find anything.
⇒ KJ
Here is what we find:
On both machines:
So the set-up is identical, except that I had installed gintro on the working machine a good month ago.
Worse still, I did a nimble uninstall gintro
and then nimble install gintro@#head
(in order for it to pick-up gtk4) on the working machine and now it joins the other in not working.
So perhaps I should revert back one or two versions of gintro to see if that's where the problem lies for my Arch Linux set-up.
⇒ KJ
Reverted back to version 0.9.8.
Now I get this error instead:
~/.nimble/pkgs/gintro-0.9.8/gintro/harfbuzz.nim(2239, 35) Error: expression cannot be cast to Face00=object
I have no idea what this all means, but I hope this is useful information.
⇒ KJ
I have still no idea and so can not really help you. When you intend to further use Nim and gintro, then maybe it is the best advice for you to learn some basic Nim, then it should be very easy to see the actual problem.
I have too gtk3: version 3.24.34, and now installed latest gtk-4.8.1, which makes no real difference. For gtk-4.8.1 I just discovered a tiny unrelated issue -- the devs have renamed a few function parameter names to "object". Not a real problem, as such conflicting names are stprpped as object
, but in some macros like mconnect() I am using currently a too simple name construction, which may result in invalid variable names like object
1. I will fix that in the next days.
But that is not related to your actual issue. Unfortunately no one, or at least no one with some basic Nim knowledge seems to use gintro with Arch Linux. I may install Arch myself, my current box has some void partitions. But that is some effort, I would have to learn basic Arch usage, install Nim and gcc and some more tools. And as I said initially, I have a lot other work to do.
For your last comment: Unfortunately going back to older gintro versions will not help, gintro is fine, last #head is best. Problem is somewhere else, maybe GTK. So just learn some Nim, error messages of compiler are not always great, but generally enable one to see the real issue at one. And remember, your error reports with source file line numbers are not that useful for me, as the modules are generated during install, so my local files are generally different from yours.
I was afraid of that, but it is as I figured. OK, then thanks a lot for your help in any case. I shall keep plugging at it.
Incidentally, is there any way I can "buy you a beer" or something ? I feel a little guilty for taking up your time when I am such a rank amateur.
⇒ KJ
buy you a beer
You are welcome :-) I had some guys, for which I had to spend up to 50 hours due to special requests. One was the author of the famous Bacon paper, that guy requested webkitgtk and then vanished soon, Or others requested libnice and gstreamer support. GStreamer was hard, as the related modules are really low level. But I think that guy really produced something for his windows 8.1 before he vanished.
Generally, issues get fixed sooner or later, so be patient. I will inform you when we have good news. Maybe read the book of Mr Rumpf, then you can tell us if it is worth the 62 dollar.
My feeling is, that the reason for the error may be dev-libs/glib-2.74. I assume you already have it?
Actually I was not aware that glib is a separate package for my Gentoo Linux, I regulary just install GTK, which then pulls in all needed dependencies. For gentoo we have
https://packages.gentoo.org/packages/dev-libs/glib
I have default 2.72 still. Installing unstable 2.74 is not easy for me, as I would have to unmask some more packages. All that is some work, and of course it may break my box, so I have to do some backups before.
The GApplication flags are from glib/gio, and 2.74 is a very recent version, so I guess that it may be the reason. I have no idea what they may have changed, but it is my only idea currently. Note that our gintro modules are built from so called GIR files, actually not directly from the GIR file, but from a compiled version of it, by gobject-introspection. And maybe they changed or broke something for 2.74.
Are you able to downgrade to 2.72?
Well, actually updating dev-libs/glib-2.74 does not updated the GIR files for me, so that can not help for the bindings:
ls -lt /usr/share/gir-1.0/
total 123248
-rw-r--r-- 1 root root 7455073 Oct 18 11:19 Gtk-4.0.gir
-rw-r--r-- 1 root root 321753 Oct 18 11:19 Gsk-4.0.gir
-rw-r--r-- 1 root root 103658 Oct 18 11:19 GdkX11-4.0.gir
-rw-r--r-- 1 root root 42155 Oct 18 11:19 GdkWayland-4.0.gir
-rw-r--r-- 1 root root 1371684 Oct 18 11:19 Gdk-4.0.gir
-rw-r--r-- 1 root root 7584275 Oct 15 14:34 Gtk-2.0.gir
-rw-r--r-- 1 root root 1726191 Oct 15 14:34 Gdk-2.0.gir
-rw-r--r-- 1 root root 64762 Oct 15 14:34 GdkX11-2.0.gir
-rw-r--r-- 1 root root 10125677 Oct 15 14:33 Gtk-3.0.gir
-rw-r--r-- 1 root root 1813904 Oct 15 14:33 Gdk-3.0.gir
-rw-r--r-- 1 root root 122021 Oct 15 14:33 GdkX11-3.0.gir
-rw-r--r-- 1 root root 141040 Oct 9 10:53 Rsvg-2.0.gir
-rw-r--r-- 1 root root 1144213 Oct 9 10:52 HarfBuzz-0.0.gir
-rw-r--r-- 1 root root 145099 Oct 2 11:50 EDataServerUI-1.2.gir
-rw-r--r-- 1 root root 681642 Oct 2 11:50 EDataCal-2.0.gir
-rw-r--r-- 1 root root 924526 Oct 2 11:50 ECal-2.0.gir
-rw-r--r-- 1 root root 276139 Oct 2 11:50 EBook-1.2.gir
-rw-r--r-- 1 root root 762098 Oct 2 11:50 EDataBook-1.2.gir
-rw-r--r-- 1 root root 581785 Oct 2 11:50 EBackend-1.2.gir
-rw-r--r-- 1 root root 346757 Oct 2 11:49 EBookContacts-1.2.gir
-rw-r--r-- 1 root root 2031716 Oct 2 11:49 EDataServer-1.2.gir
-rw-r--r-- 1 root root 3009083 Oct 2 11:49 Camel-1.2.gir
-rw-r--r-- 1 root root 2792444 Oct 2 11:49 GData-0.0.gir
-rw-r--r-- 1 root root 143213 Oct 2 11:48 NMA-1.0.gir
-rw-r--r-- 1 root root 143634 Oct 2 11:48 NMA4-1.0.gir
-rw-r--r-- 1 root root 156616 Sep 30 12:04 GWeather-4.0.gir
-rw-r--r-- 1 root root 1777056 Sep 19 13:53 WebKit2-4.0.gir
-rw-r--r-- 1 root root 2467442 Sep 19 13:53 WebKit2WebExtension-4.0.gir
-rw-r--r-- 1 root root 272304 Sep 19 13:30 JavaScriptCore-4.0.gir
-rw-r--r-- 1 root root 37000 Sep 17 11:37 GnomeBluetooth-3.0.gir
-rw-r--r-- 1 root root 182283 Sep 17 11:34 GcrUi-3.gir
-rw-r--r-- 1 root root 491963 Sep 17 11:34 Gcr-3.gir
-rw-r--r-- 1 root root 515486 Sep 17 11:34 Gck-1.gir
-rw-r--r-- 1 root root 15340 Sep 17 11:34 GrlPls-0.3.gir
-rw-r--r-- 1 root root 650745 Sep 17 11:34 Grl-0.3.gir
-rw-r--r-- 1 root root 24901 Sep 17 11:34 GrlNet-0.3.gir
-rw-r--r-- 1 root root 102751 Sep 17 11:33 GnomeRR-4.0.gir
-rw-r--r-- 1 root root 38602 Sep 17 11:33 GnomeBG-4.0.gir
-rw-r--r-- 1 root root 105458 Sep 17 11:33 GnomeDesktop-4.0.gir
-rw-r--r-- 1 root root 3396160 Sep 17 11:32 NM-1.0.gir
-rw-r--r-- 1 root root 170800 Sep 17 11:29 GstPlayer-1.0.gir
-rw-r--r-- 1 root root 330049 Sep 17 11:29 GstCodecs-1.0.gir
-rw-r--r-- 1 root root 86180 Sep 17 11:29 GstWebRTC-1.0.gir
-rw-r--r-- 1 root root 398308 Sep 17 11:29 GstMpegts-1.0.gir
-rw-r--r-- 1 root root 209082 Sep 17 11:29 GstPlay-1.0.gir
-rw-r--r-- 1 root root 58822 Sep 17 11:29 GstTranscoder-1.0.gir
-rw-r--r-- 1 root root 27309 Sep 17 11:29 GstInsertBin-1.0.gir
-rw-r--r-- 1 root root 90020 Sep 17 11:29 GstBadAudio-1.0.gir
-rw-r--r-- 1 root root 246888 Sep 17 10:16 GnomeDesktop-3.0.gir
-rw-r--r-- 1 root root 865029 Sep 17 10:16 AppStreamGlib-1.0.gir
-rw-r--r-- 1 root root 53369 Sep 17 10:16 GstGLEGL-1.0.gir
-rw-r--r-- 1 root root 7861 Sep 17 10:16 GstGLWayland-1.0.gir
-rw-r--r-- 1 root root 7372 Sep 17 10:16 GstGLX11-1.0.gir
-rw-r--r-- 1 root root 359113 Sep 17 10:16 GstRtsp-1.0.gir
-rw-r--r-- 1 root root 758619 Sep 17 10:16 GstGL-1.0.gir
-rw-r--r-- 1 root root 309032 Sep 17 10:16 GstSdp-1.0.gir
-rw-r--r-- 1 root root 337821 Sep 17 10:16 GstPbutils-1.0.gir
-rw-r--r-- 1 root root 479415 Sep 17 10:16 GstRtp-1.0.gir
-rw-r--r-- 1 root root 1269396 Sep 17 10:16 GstVideo-1.0.gir
-rw-r--r-- 1 root root 729148 Sep 17 10:16 GstAudio-1.0.gir
-rw-r--r-- 1 root root 152435 Sep 17 10:16 GstApp-1.0.gir
-rw-r--r-- 1 root root 28961 Sep 17 10:16 GstAllocators-1.0.gir
-rw-r--r-- 1 root root 121702 Sep 17 10:16 GstTag-1.0.gir
-rw-r--r-- 1 root root 44071 Sep 17 10:15 PangoXft-1.0.gir
-rw-r--r-- 1 root root 50526 Sep 17 10:15 PangoCairo-1.0.gir
-rw-r--r-- 1 root root 30146 Sep 17 10:15 PangoFT2-1.0.gir
-rw-r--r-- 1 root root 69805 Sep 17 10:15 PangoOT-1.0.gir
-rw-r--r-- 1 root root 54599 Sep 17 10:15 PangoFc-1.0.gir
-rw-r--r-- 1 root root 1005628 Sep 17 10:15 Pango-1.0.gir
-rw-r--r-- 1 root root 705187 Sep 17 10:15 Poppler-0.18.gir
-rw-r--r-- 1 root root 268322 Sep 17 10:14 Tracker-3.0.gir
-rw-r--r-- 1 root root 225032 Sep 17 10:14 GeocodeGlib-1.0.gir
-rw-r--r-- 1 root root 53479 Sep 17 10:13 Notify-0.7.gir
-rw-r--r-- 1 root root 59960 Sep 17 10:13 GstNet-1.0.gir
-rw-r--r-- 1 root root 874512 Sep 17 10:13 GstBase-1.0.gir
-rw-r--r-- 1 root root 246571 Sep 17 10:13 GstCheck-1.0.gir
-rw-r--r-- 1 root root 74025 Sep 17 10:13 GstController-1.0.gir
-rw-r--r-- 1 root root 3552819 Sep 17 10:13 Gst-1.0.gir
-rw-r--r-- 1 root root 2388470 Sep 4 13:30 UDisks-2.0.gir
-rw-r--r-- 1 root root 53938 Sep 4 13:30 PolkitAgent-1.0.gir
-rw-r--r-- 1 root root 254522 Sep 4 13:30 Polkit-1.0.gir
-rw-r--r-- 1 root root 218523 Aug 29 10:57 Devhelp-3.0.gir
-rw-r--r-- 1 root root 94971 Aug 25 16:09 UPowerGlib-1.0.gir
-rw-r--r-- 1 root root 940135 Aug 8 10:23 Adw-1.gir
-rw-r--r-- 1 root root 108617 Aug 8 10:21 Gspell-1.gir
-rw-r--r-- 1 root root 758323 Aug 8 10:21 Handy-1.gir
-rw-r--r-- 1 root root 4223986 Aug 8 10:21 ModemManager-1.0.gir
-rw-r--r-- 1 root root 8291385 Aug 8 10:20 Qmi-1.0.gir
-rw-r--r-- 1 root root 64609 Aug 8 10:19 Qrtr-1.0.gir
-rw-r--r-- 1 root root 893109 Aug 8 10:17 GtkSource-5.gir
-rw-r--r-- 1 root root 84851 Aug 8 10:08 Totem-1.0.gir
-rw-r--r-- 1 root root 64321 Aug 8 10:07 MediaArt-2.0.gir
-rw-r--r-- 1 root root 153889 Aug 8 10:07 Gom-1.0.gir
-rw-r--r-- 1 root root 198934 Jul 18 12:43 EvinceView-3.0.gir
-rw-r--r-- 1 root root 558453 Jul 18 12:43 EvinceDocument-3.0.gir
-rw-r--r-- 1 root root 108482 Jul 7 16:39 Nautilus-3.0.gir
-rw-r--r-- 1 root root 293546 Jul 7 16:34 Geoclue-2.0.gir
-rw-r--r-- 1 root root 1770882 Jul 7 16:32 IBus-1.0.gir
-rw-r--r-- 1 root root 28443 Jul 7 16:27 PeasGtk-1.0.gir
-rw-r--r-- 1 root root 139666 Jul 7 16:27 Peas-1.0.gir
-rw-r--r-- 1 root root 220272 Jul 7 16:24 GExiv2-0.10.gir
-rw-r--r-- 1 root root 5875221 Jul 7 16:23 Gio-2.0.gir
-rw-r--r-- 1 root root 346498 Jul 7 16:23 GIRepository-2.0.gir
-rw-r--r-- 1 root root 1173548 Jul 7 16:23 GObject-2.0.gir
-rw-r--r-- 1 root root 22977 Jul 7 16:23 GModule-2.0.gir
-rw-r--r-- 1 root root 3557073 Jul 7 16:23 GLib-2.0.gir
-rw-r--r-- 1 root root 23723 Jul 7 16:23 cairo-1.0.gir
-rw-r--r-- 1 root root 57115 Jun 25 11:10 Cally-1.0.gir
-rw-r--r-- 1 root root 4429089 Jun 25 11:10 Clutter-1.0.gir
-rw-r--r-- 1 root root 8680 Jun 25 11:10 ClutterGdk-1.0.gir
-rw-r--r-- 1 root root 54055 Jun 25 11:10 ClutterX11-1.0.gir
-rw-r--r-- 1 root root 936277 Jun 25 11:09 GtkSource-3.0.gir
-rw-r--r-- 1 root root 21478 Jun 25 11:09 CoglPango-1.0.gir
-rw-r--r-- 1 root root 21473 Jun 25 11:09 CoglPango-2.0.gir
-rw-r--r-- 1 root root 526495 Jun 25 11:09 Cogl-1.0.gir
-rw-r--r-- 1 root root 1275378 Jun 25 11:09 Cogl-2.0.gir
-rw-r--r-- 1 root root 42408 Jun 25 11:09 RestExtras-0.7.gir
-rw-r--r-- 1 root root 207554 Jun 25 11:09 Rest-0.7.gir
-rw-r--r-- 1 root root 43952 Jun 25 11:02 GMenu-3.0.gir
-rw-r--r-- 1 root root 336287 Jun 10 14:35 Vte-2.91.gir
-rw-r--r-- 1 root root 2804916 Jun 3 07:34 TelepathyGLib-0.12.gir
-rw-r--r-- 1 root root 945985 Jun 2 19:39 GtkSource-4.gir
-rw-r--r-- 1 root root 1239273 Jun 1 09:55 ICalGLib-3.0.gir
-rw-r--r-- 1 root root 734946 Jun 1 09:55 ICal-3.0.gir
-rw-r--r-- 1 root root 358172 Jun 1 08:15 Gdm-1.0.gir
-rw-r--r-- 1 root root 1173654 Jun 1 08:11 Goa-1.0.gir
-rw-r--r-- 1 root root 644284 May 31 21:10 Libosinfo-1.0.gir
-rw-r--r-- 1 root root 216140 May 31 21:09 Grss-0.7.gir
-rw-r--r-- 1 root root 1428962 May 31 21:09 Soup-2.4.gir
-rw-r--r-- 1 root root 28838 May 31 21:08 ColordGtk-1.0.gir
-rw-r--r-- 1 root root 263572 May 31 21:04 Colorhug-1.0.gir
-rw-r--r-- 1 root root 731098 May 31 21:04 Colord-1.0.gir
-rw-r--r-- 1 root root 143249 May 31 21:03 GUsb-1.0.gir
-rw-r--r-- 1 root root 549894 May 31 21:03 Secret-1.gir
-rw-r--r-- 1 root root 57517 May 31 21:01 GSound-1.0.gir
-rw-r--r-- 1 root root 95937 May 31 21:00 Gkbd-3.0.gir
-rw-r--r-- 1 root root 7880 May 31 20:59 GnomeAutoarGtk-0.1.gir
-rw-r--r-- 1 root root 97796 May 31 20:59 GnomeAutoar-0.1.gir
-rw-r--r-- 1 root root 131176 May 31 20:52 Xkl-1.0.gir
-rw-r--r-- 1 root root 243891 May 31 20:52 GTop-2.0.gir
-rw-r--r-- 1 root root 97726 May 31 20:52 TotemPlParser-1.0.gir
-rw-r--r-- 1 root root 1074253 May 31 20:50 Mbim-1.0.gir
-rw-r--r-- 1 root root 605117 May 31 20:48 Atspi-2.0.gir
-rw-r--r-- 1 root root 119077 May 31 20:48 AccountsService-1.0.gir
-rw-r--r-- 1 root root 606636 May 31 20:47 Graphene-1.0.gir
-rw-r--r-- 1 root root 377709 May 31 20:47 Json-1.0.gir
-rw-r--r-- 1 root root 101505 May 31 20:47 GUdev-1.0.gir
-rw-r--r-- 1 root root 21147 May 31 20:47 GDesktopEnums-3.0.gir
-rw-r--r-- 1 root root 1095163 May 31 20:46 Atk-1.0.gir
-rw-r--r-- 1 root root 21104 May 31 20:46 GdkPixdata-2.0.gir
-rw-r--r-- 1 root root 330443 May 31 20:46 GdkPixbuf-2.0.gir
-rw-r--r-- 1 root root 1185 Mar 18 2022 DBus-1.0.gir
-rw-r--r-- 1 root root 797 Mar 18 2022 DBusGLib-1.0.gir
-rw-r--r-- 1 root root 620 Mar 18 2022 fontconfig-2.0.gir
-rw-r--r-- 1 root root 768 Mar 18 2022 freetype2-2.0.gir
-rw-r--r-- 1 root root 29925 Mar 18 2022 gir-1.2.rnc
-rw-r--r-- 1 root root 1122 Mar 18 2022 GL-1.0.gir
-rw-r--r-- 1 root root 938 Mar 18 2022 libxml2-2.0.gir
-rw-r--r-- 1 root root 65349 Mar 18 2022 Vulkan-1.0.gir
-rw-r--r-- 1 root root 611 Mar 18 2022 win32-1.0.gir
-rw-r--r-- 1 root root 361 Mar 18 2022 xfixes-4.0.gir
-rw-r--r-- 1 root root 745 Mar 18 2022 xft-2.0.gir
-rw-r--r-- 1 root root 2325 Mar 18 2022 xlib-2.0.gir
-rw-r--r-- 1 root root 808 Mar 18 2022 xrandr-1.3.gir
Well, finally I was able to break my box too!
Upgraded to gobject-introspection 1.74, see https://packages.gentoo.org/packages/dev-libs/gobject-introspection
Now I have
ls -lt /usr/share/gir-1.0/Gio-2.0.gir
-rw-r--r-- 1 root root 5929545 Oct 18 22:03 /usr/share/gir-1.0/Gio-2.0.gir
No idea why and how this works internally.
But now a faked nimble install gintro gives a corrupted gio.nim file:
diff nim_gi/gio.nim ~/.nimble/pkgs/gintro-#head/gintro/gio.nim
< ApplicationFlags* {.size: sizeof(cint), pure.} = enum
< defaultFlags = 0
< isService = 1
< isLauncher = 2
< handlesOpen = 4
< handlesCommandLine = 8
< sendEnvironment = 16
< nonUnique = 32
< canOverrideAppId = 64
< allowReplacement = 128
< replace = 256
---
> ApplicationFlag* {.size: sizeof(cint), pure.} = enum
> isService = 0
> isLauncher = 1
> handlesOpen = 2
> handlesCommandLine = 3
> sendEnvironment = 4
> nonUnique = 5
> canOverrideAppId = 6
> allowReplacement = 7
> replace = 8
>
> ApplicationFlags* {.size: sizeof(cint).} = set[ApplicationFlag]
Now we have to investigate what causes this error. Maybe some work, but should be not that difficult. Of course, when it is a GTK error, we may have to create an issue. Maybe you can downgrade glib and gobject-introspection, then it may work for you.
Will try to further investigate this in the next days.
And I think I have found the issue: In the new Gio.gir file we have two times value zero in the ApplicationFlags bitfield. And the logic in gen.nim generator script may assume that a bitfield with two identical values can not be a bitset... Should be easy to fix.
/tmp $ cat /tmp/b.txt
<bitfield name="ApplicationFlags"
version="2.28"
glib:type-name="GApplicationFlags"
glib:get-type="g_application_flags_get_type"
c:type="GApplicationFlags">
<doc xml:space="preserve"
filename="gioenums.h"
line="1488">Flags used to define the behaviour of a #GApplication.</doc>
<member name="flags_none"
value="0"
c:identifier="G_APPLICATION_FLAGS_NONE"
glib:nick="flags-none"
glib:name="G_APPLICATION_FLAGS_NONE">
<doc xml:space="preserve"
filename="gioenums.h"
line="1490">Default. Deprecated in 2.74, use
%G_APPLICATION_DEFAULT_FLAGS instead</doc>
</member>
<member name="default_flags"
value="0"
c:identifier="G_APPLICATION_DEFAULT_FLAGS"
glib:nick="default-flags"
glib:name="G_APPLICATION_DEFAULT_FLAGS">
<doc xml:space="preserve"
filename="gioenums.h"
line="1492">Default flags. Since: 2.74</doc>
</member>
<member name="is_service"
value="1"
c:identifier="G_APPLICATION_IS_SERVICE"
glib:nick="is-service"
glib:name="G_APPLICATION_IS_SERVICE">
<doc xml:space="preserve"
filename="gioenums.h"
line="1493">Run as a service. In this mode, registration
fails if the service is already running, and the application
will initially wait up to 10 seconds for an initial activation
message to arrive.</doc>
</member>
<member name="is_launcher"
value="2"
c:identifier="G_APPLICATION_IS_LAUNCHER"
glib:nick="is-launcher"
glib:name="G_APPLICATION_IS_LAUNCHER">
<doc xml:space="preserve"
filename="gioenums.h"
line="1497">Don't try to become the primary instance.</doc>
</member>
<member name="handles_open"
value="4"
c:identifier="G_APPLICATION_HANDLES_OPEN"
glib:nick="handles-open"
glib:name="G_APPLICATION_HANDLES_OPEN">
<doc xml:space="preserve"
filename="gioenums.h"
line="1498">This application handles opening files (in
the primary instance). Note that this flag only affects the default
implementation of local_command_line(), and has no effect if
%G_APPLICATION_HANDLES_COMMAND_LINE is given.
See g_application_run() for details.</doc>
</member>
<member name="handles_command_line"
value="8"
c:identifier="G_APPLICATION_HANDLES_COMMAND_LINE"
glib:nick="handles-command-line"
glib:name="G_APPLICATION_HANDLES_COMMAND_LINE">
<doc xml:space="preserve"
filename="gioenums.h"
line="1503">This application handles command line
arguments (in the primary instance). Note that this flag only affect
the default implementation of local_command_line().
See g_application_run() for details.</doc>
</member>
<member name="send_environment"
value="16"
c:identifier="G_APPLICATION_SEND_ENVIRONMENT"
glib:nick="send-environment"
glib:name="G_APPLICATION_SEND_ENVIRONMENT">
<doc xml:space="preserve"
filename="gioenums.h"
line="1507">Send the environment of the
launching process to the primary instance. Set this flag if your
application is expected to behave differently depending on certain
environment variables. For instance, an editor might be expected
to use the `GIT_COMMITTER_NAME` environment variable
when editing a git commit message. The environment is available
to the #GApplication::command-line signal handler, via
g_application_command_line_getenv().</doc>
</member>
<member name="non_unique"
value="32"
c:identifier="G_APPLICATION_NON_UNIQUE"
glib:nick="non-unique"
glib:name="G_APPLICATION_NON_UNIQUE">
<doc xml:space="preserve"
filename="gioenums.h"
line="1515">Make no attempts to do any of the typical
single-instance application negotiation, even if the application
ID is given. The application neither attempts to become the
owner of the application ID nor does it check if an existing
owner already exists. Everything occurs in the local process.
Since: 2.30.</doc>
</member>
<member name="can_override_app_id"
value="64"
c:identifier="G_APPLICATION_CAN_OVERRIDE_APP_ID"
glib:nick="can-override-app-id"
glib:name="G_APPLICATION_CAN_OVERRIDE_APP_ID">
<doc xml:space="preserve"
filename="gioenums.h"
line="1521">Allow users to override the
application ID from the command line with `--gapplication-app-id`.
Since: 2.48</doc>
</member>
<member name="allow_replacement"
value="128"
c:identifier="G_APPLICATION_ALLOW_REPLACEMENT"
glib:nick="allow-replacement"
glib:name="G_APPLICATION_ALLOW_REPLACEMENT">
<doc xml:space="preserve"
filename="gioenums.h"
line="1524">Allow another instance to take over
the bus name. Since: 2.60</doc>
</member>
<member name="replace"
value="256"
c:identifier="G_APPLICATION_REPLACE"
glib:nick="replace"
glib:name="G_APPLICATION_REPLACE">
<doc xml:space="preserve"
filename="gioenums.h"
line="1526">Take over from another instance. This flag is
usually set by passing `--gapplication-replace` on the commandline.
Since: 2.60</doc>
</member>
</bitfield>
/tmp $ cat /tmp/aorg.txt
<bitfield name="ApplicationFlags"
version="2.28"
glib:type-name="GApplicationFlags"
glib:get-type="g_application_flags_get_type"
c:type="GApplicationFlags">
<doc xml:space="preserve"
filename="gioenums.h"
line="1477">Flags used to define the behaviour of a #GApplication.</doc>
<member name="flags_none"
value="0"
c:identifier="G_APPLICATION_FLAGS_NONE"
glib:nick="flags-none"
glib:name="G_APPLICATION_FLAGS_NONE">
<doc xml:space="preserve"
filename="gioenums.h"
line="1479">Default</doc>
</member>
<member name="is_service"
value="1"
c:identifier="G_APPLICATION_IS_SERVICE"
glib:nick="is-service"
glib:name="G_APPLICATION_IS_SERVICE">
<doc xml:space="preserve"
filename="gioenums.h"
line="1480">Run as a service. In this mode, registration
fails if the service is already running, and the application
will initially wait up to 10 seconds for an initial activation
message to arrive.</doc>
</member>
<member name="is_launcher"
value="2"
c:identifier="G_APPLICATION_IS_LAUNCHER"
glib:nick="is-launcher"
glib:name="G_APPLICATION_IS_LAUNCHER">
<doc xml:space="preserve"
filename="gioenums.h"
line="1484">Don't try to become the primary instance.</doc>
</member>
<member name="handles_open"
value="4"
c:identifier="G_APPLICATION_HANDLES_OPEN"
glib:nick="handles-open"
glib:name="G_APPLICATION_HANDLES_OPEN">
<doc xml:space="preserve"
filename="gioenums.h"
line="1485">This application handles opening files (in
the primary instance). Note that this flag only affects the default
implementation of local_command_line(), and has no effect if
%G_APPLICATION_HANDLES_COMMAND_LINE is given.
See g_application_run() for details.</doc>
</member>
<member name="handles_command_line"
value="8"
c:identifier="G_APPLICATION_HANDLES_COMMAND_LINE"
glib:nick="handles-command-line"
glib:name="G_APPLICATION_HANDLES_COMMAND_LINE">
<doc xml:space="preserve"
filename="gioenums.h"
line="1490">This application handles command line
arguments (in the primary instance). Note that this flag only affect
the default implementation of local_command_line().
See g_application_run() for details.</doc>
</member>
<member name="send_environment"
value="16"
c:identifier="G_APPLICATION_SEND_ENVIRONMENT"
glib:nick="send-environment"
glib:name="G_APPLICATION_SEND_ENVIRONMENT">
<doc xml:space="preserve"
filename="gioenums.h"
line="1494">Send the environment of the
launching process to the primary instance. Set this flag if your
application is expected to behave differently depending on certain
environment variables. For instance, an editor might be expected
to use the `GIT_COMMITTER_NAME` environment variable
when editing a git commit message. The environment is available
to the #GApplication::command-line signal handler, via
g_application_command_line_getenv().</doc>
</member>
<member name="non_unique"
value="32"
c:identifier="G_APPLICATION_NON_UNIQUE"
glib:nick="non-unique"
glib:name="G_APPLICATION_NON_UNIQUE">
<doc xml:space="preserve"
filename="gioenums.h"
line="1502">Make no attempts to do any of the typical
single-instance application negotiation, even if the application
ID is given. The application neither attempts to become the
owner of the application ID nor does it check if an existing
owner already exists. Everything occurs in the local process.
Since: 2.30.</doc>
</member>
<member name="can_override_app_id"
value="64"
c:identifier="G_APPLICATION_CAN_OVERRIDE_APP_ID"
glib:nick="can-override-app-id"
glib:name="G_APPLICATION_CAN_OVERRIDE_APP_ID">
<doc xml:space="preserve"
filename="gioenums.h"
line="1508">Allow users to override the
application ID from the command line with `--gapplication-app-id`.
Since: 2.48</doc>
</member>
<member name="allow_replacement"
value="128"
c:identifier="G_APPLICATION_ALLOW_REPLACEMENT"
glib:nick="allow-replacement"
glib:name="G_APPLICATION_ALLOW_REPLACEMENT">
<doc xml:space="preserve"
filename="gioenums.h"
line="1511">Allow another instance to take over
the bus name. Since: 2.60</doc>
</member>
<member name="replace"
value="256"
c:identifier="G_APPLICATION_REPLACE"
glib:nick="replace"
glib:name="G_APPLICATION_REPLACE">
<doc xml:space="preserve"
filename="gioenums.h"
line="1513">Take over from another instance. This flag is
usually set by passing `--gapplication-replace` on the commandline.
Since: 2.60</doc>
</member>
</bitfield>
You da man !!!! (But sorry it broke your box too.)
I just went out for some groceries and returned to find this treasure trove of missives.
I shall now fire up a virtual machine and start playing around with upgrading/downgrading the packages you mentioned Let's see if I can find the magic formula - at least for this current installation of Arch Linux.
I mean ... "it used to work around here ..." (famous last words ...)
⇒ KJ
I shall now fire up a virtual machine and start playing around with upgrading/downgrading
Downgrading glib to 2.72 should solve the issue, when that replaces the gio.gir file as well. And a new "nimble install gintro@#head".
But actually you should just do nothing, now that we know the bug, it is very easy to fix. I hope that I can ship the fix in the next 12 hours, or at least tomorrow. Unfortunately I just have again discovered that gobject-introspection library is not very smart: In the GIR files enums are marked as bitfields or enumerations. The bitfield tag is for enums used as flags. But unfortunately gobject-introspection gives us for our bindings currently only enums, so we have to use our own logic to test if it are only plain value enums, or enums used as bit flags. Our current logic was not good enough, that resulted in the issue. (You may see proc writeEnum() in /gintro/test/gen.nim, actually the statement "if j == 0 and s[j].v == 0: continue" which will not work as intended when there is a value zero more than one time.
Thanks for pointing out the nitty-gritty. I see what you're saying now. Shall sit back and wait for your fix. Many thanks for being so efficient.
⇒ KJ
Unfortunately there seems to be a new error, with latest Nim compiler version and nimble install:
/tmp/gintrosalewski/maxby.nim(113, 6) Error: 'minValueBy' can have side effects
> /tmp/gintrosalewski/maxby.nim(125, 13) Hint: 'minValueBy' calls routine via hidden pointer indirection
stack trace: (most recent call last)
/tmp/nimblecache-3916255446/nimscriptapi_2369601797.nim(199, 29)
/tmp/nimble_16322/githubcom_stefansalewskigintro_#head/gintro.nimble(77, 7) installBefore
/tmp/nimble_16322/githubcom_stefansalewskigintro_#head/gintro.nimble(62, 7) prep
/home/salewski/Nim/lib/system/nimscript.nim(264, 7) exec
/home/salewski/Nim/lib/system/nimscript.nim(264, 7) Error: unhandled exception: FAILED: nim c gen.nim [OSError]
Tip: 3 messages have been suppressed, use --verbose to show them.
Error: Exception raised during nimble script execution
I will investigate this, hope I can fix it soon.
OK, now you can test with:
nimble uninstall gintro
nimble install gintro@#head
With latest compiler, glib 2.74 and GTK 4.8 it seems to work. I can only hope that it will work still with older releases.
Happy !! Happy !! Joy !! Joy !! We have lift-off.
Now I can get down to actually trying to write some code to learn how to use all of this properly.
For the record, on Arch Linux at least, merely downgrading glib2 to version 2.72 doesn't do the trick.
You are a gentleman and a scholar. Many, many thanks for your work.
⇒ KJ
Hello there, I am on Arch Linux and have GTK3 installed. Just nimble-installed gintro, and when I attempt to compile any of the examples I get this error
One more clue: I installed gintro into a virtual machine running Arch Linux with identical configurations about a month ago and everything works fine there. In fact, everything still works fine on that computer, despite having gone through identical number of updates.
... so it must be something I did to this present host computer that has borked something.
Hope someone has a clue ...
== KJ