-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Yes, we know, and it is not a real gintro issue this time :-)
For the Nim compiler, the issue is related to
import macros
macro m1(s: string): untyped =
var ProcID {.compileTime, global.}: int
inc(ProcID)
echo s, ProcID
proc main =
echo "calling macro m1"
m1("Macro argument")
m1("Macro argument")
m1("Macro argument")
nim c m.nim
Hint: used config file '/home/salewski/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/salewski/Nim/config/config.nims' [Conf]
Hint: used config file '/home/salewski/.config/nim/nim.cfg' [Conf]
.......................................................................
.
Macro argument1
Macro argument1
Macro argument1
CC: m.nim
Desired output would be
Macro argument1
Macro argument2
Macro argument3We don't know if they did it by intent. {.compileTime, global.} is used in gintro for the mconnect macro and at a few other locations. Using module global variables may fix it, but that is ugly and may lead to name conflicts for a lot of compile-time macro variables. Using a compiler version 1.9.1 with git hash from beginning of 2023 seems to fix it for now, we will see how Nim 2.0 may behave. Maybe Nim 1.6.12 still works?
The other issue seems to be related to latest GTK 4.10. The example from https://ssalewski.de/gtkprogramming.html#_filechooserdialog does not work any more, we get a lot of
(filechooserdialog:11122): Gtk-CRITICAL **: 21:59:32.837: Error building template for list item: .:0:0 Invalid object type 'GtkFileChooserCell'
Converting that Nim example back to plain C leads to a working program. So debugging took us again a full day, with the funny result that compiling with
nim c --passL="-lgtk-4" filechooserdialog.nim
makes it working. Was not easy to guess, but the gcc compile command
gcc -Wall t.c -o t `pkg-config --cflags --libs gtk4`
with
pkg-config --cflags --libs gtk4
-I/usr/include/gtk-4.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib64/libffi/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/graphene-1.0 -I/usr/lib64/graphene-1.0/include -mfpmath=sse -msse -msse2 -pthread -lgtk-4 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgraphene-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
gave a hint. We still have to investigate the actual reason, maybe some resources have to be included by the linker.