Simple GTK3 application in Nim?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Simple GTK3 application in Nim?

Gtk+ - Apps Dev mailing list
Hi guys,

I have a very simple application written in the Nim programming language, which transpiles to C and is then compiled with GCC on Linux.
The application is very simple and uses the IUP shared library which underneath uses GTK3. Here is the code, just for reference:
import os
import iup

iup.open(nil, nil)
var font_dialog = fontDlg()
font_dialog.popup(IUP_CURRENT, IUP_CURRENT)
font_dialog.destroy()
iup.close()

When running the application, this error is thrown:
$ ./test

(test:6635): Gtk-WARNING **: Unknown type PangoFontFamily specified in treemodel model

(test:6635): Gtk-WARNING **: Unknown type PangoFontFace specified in treemodel model

(test:6635): Gtk-WARNING **: /home/pi/gtk+3.0-3.22.11/./gtk/gtkliststore.c:516: Invalid type (null)

(test:6635): Gtk-WARNING **: /home/pi/gtk+3.0-3.22.11/./gtk/gtkliststore.c:516: Invalid type (null)

(test:6635): GLib-GObject-CRITICAL **: g_value_type_transformable: assertion 'G_TYPE_IS_VALUE (src_type)' failed

(shutdown:6635): GLib-GObject-CRITICAL **: g_value_type_transformable: assertion 'G_TYPE_IS_VALUE (src_type)' failed

(test:6635): GLib-GObject-WARNING **: /build/glib2.0-F5w919/glib2.0-2.50.3/./gobject/gtype.c:4264: type id '0' is invalid

(test:6635): GLib-GObject-WARNING **: can't peek value table for type '<invalid>' which is not currently referenced
Traceback (most recent call last)
test.nim(7)         test
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Now the problem, as far as I can guess, is that Nim behind the scenes uses the dlopen function to link to the IUP shared library, which messes up something with GTK.
I may be completely wrong on this, I drew this conclusion from this wxWidgets issue: https://trac.wxwidgets.org/ticket/16820#no1

Can someone point me in a direction of how this can be fixed, because I do not have enough experience with this subject?

Thank you,
Matic
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: Simple GTK3 application in Nim?

Gtk+ - Apps Dev mailing list
Found the problem.
To solve it the Nim application needs to load it's shared libraries with dlopen(RTLD_GLOBAL).

Regards,
Matic
________________________________
From: gtk-app-devel-list <[hidden email]> on behalf of Matic Kukovec via gtk-app-devel-list <[hidden email]>
Sent: Thursday, June 28, 2018 8:34 PM
To: [hidden email]
Subject: Simple GTK3 application in Nim?

Hi guys,

I have a very simple application written in the Nim programming language, which transpiles to C and is then compiled with GCC on Linux.
The application is very simple and uses the IUP shared library which underneath uses GTK3. Here is the code, just for reference:
import os
import iup

iup.open(nil, nil)
var font_dialog = fontDlg()
font_dialog.popup(IUP_CURRENT, IUP_CURRENT)
font_dialog.destroy()
iup.close()

When running the application, this error is thrown:
$ ./test

(test:6635): Gtk-WARNING **: Unknown type PangoFontFamily specified in treemodel model

(test:6635): Gtk-WARNING **: Unknown type PangoFontFace specified in treemodel model

(test:6635): Gtk-WARNING **: /home/pi/gtk+3.0-3.22.11/./gtk/gtkliststore.c:516: Invalid type (null)

(test:6635): Gtk-WARNING **: /home/pi/gtk+3.0-3.22.11/./gtk/gtkliststore.c:516: Invalid type (null)

(test:6635): GLib-GObject-CRITICAL **: g_value_type_transformable: assertion 'G_TYPE_IS_VALUE (src_type)' failed

(shutdown:6635): GLib-GObject-CRITICAL **: g_value_type_transformable: assertion 'G_TYPE_IS_VALUE (src_type)' failed

(test:6635): GLib-GObject-WARNING **: /build/glib2.0-F5w919/glib2.0-2.50.3/./gobject/gtype.c:4264: type id '0' is invalid

(test:6635): GLib-GObject-WARNING **: can't peek value table for type '<invalid>' which is not currently referenced
Traceback (most recent call last)
test.nim(7)         test
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Now the problem, as far as I can guess, is that Nim behind the scenes uses the dlopen function to link to the IUP shared library, which messes up something with GTK.
I may be completely wrong on this, I drew this conclusion from this wxWidgets issue: https://trac.wxwidgets.org/ticket/16820#no1

Can someone point me in a direction of how this can be fixed, because I do not have enough experience with this subject?

Thank you,
Matic
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: Simple GTK3 application in Nim?

Gtk+ - Apps Dev mailing list
Nice job, sorry I don't use the Nim programming language.

On Wed, Jul 4, 2018 at 1:12 AM, Matic Kukovec via gtk-app-devel-list <
[hidden email]> wrote:

> Found the problem.
> To solve it the Nim application needs to load it's shared libraries with
> dlopen(RTLD_GLOBAL).
>
> Regards,
> Matic
> ________________________________
> From: gtk-app-devel-list <[hidden email]> on behalf
> of Matic Kukovec via gtk-app-devel-list <[hidden email]>
> Sent: Thursday, June 28, 2018 8:34 PM
> To: [hidden email]
> Subject: Simple GTK3 application in Nim?
>
> Hi guys,
>
> I have a very simple application written in the Nim programming language,
> which transpiles to C and is then compiled with GCC on Linux.
> The application is very simple and uses the IUP shared library which
> underneath uses GTK3. Here is the code, just for reference:
> import os
> import iup
>
> iup.open(nil, nil)
> var font_dialog = fontDlg()
> font_dialog.popup(IUP_CURRENT, IUP_CURRENT)
> font_dialog.destroy()
> iup.close()
>
> When running the application, this error is thrown:
> $ ./test
>
> (test:6635): Gtk-WARNING **: Unknown type PangoFontFamily specified in
> treemodel model
>
> (test:6635): Gtk-WARNING **: Unknown type PangoFontFace specified in
> treemodel model
>
> (test:6635): Gtk-WARNING **: /home/pi/gtk+3.0-3.22.11/./gtk/gtkliststore.c:516:
> Invalid type (null)
>
> (test:6635): Gtk-WARNING **: /home/pi/gtk+3.0-3.22.11/./gtk/gtkliststore.c:516:
> Invalid type (null)
>
> (test:6635): GLib-GObject-CRITICAL **: g_value_type_transformable:
> assertion 'G_TYPE_IS_VALUE (src_type)' failed
>
> (shutdown:6635): GLib-GObject-CRITICAL **: g_value_type_transformable:
> assertion 'G_TYPE_IS_VALUE (src_type)' failed
>
> (test:6635): GLib-GObject-WARNING **: /build/glib2.0-F5w919/glib2.0-2.50.3/./gobject/gtype.c:4264:
> type id '0' is invalid
>
> (test:6635): GLib-GObject-WARNING **: can't peek value table for type
> '<invalid>' which is not currently referenced
> Traceback (most recent call last)
> test.nim(7)         test
> SIGSEGV: Illegal storage access. (Attempt to read from nil?)
>
> Now the problem, as far as I can guess, is that Nim behind the scenes uses
> the dlopen function to link to the IUP shared library, which messes up
> something with GTK.
> I may be completely wrong on this, I drew this conclusion from this
> wxWidgets issue: https://trac.wxwidgets.org/ticket/16820#no1
>
> Can someone point me in a direction of how this can be fixed, because I do
> not have enough experience with this subject?
>
> Thank you,
> Matic
> _______________________________________________
> gtk-app-devel-list mailing list
> [hidden email]
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> _______________________________________________
> gtk-app-devel-list mailing list
> [hidden email]
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list