How to solve the gtk problem when compiling with PackageCompiler?

I have used Gtk in my program. When running by source code, it works normally.

module testGTK

using Gtk

function julia_main()
    infilename = open_dialog_native("Select input file...", GtkNullContainer(), String[])


end # module

However, after compiled with PackageCompiler and run the output program again, it showed the following message. (The Gtk package have been added to Project.toml)

(testGTK.exe:28996): GLib-GObject-WARNING **: 19:53:13.685: cannot register existing type 'GtkWidget'

(testGTK.exe:28996): GLib-GObject-WARNING **: 19:53:13.686: cannot add class private field to invalid type '<invalid>'

(testGTK.exe:28996): GLib-GObject-WARNING **: 19:53:13.686: cannot add private field to invalid (non-instantiatable) type '<invalid>'

(testGTK.exe:28996): GLib-GObject-CRITICAL **: 19:53:13.686: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(testGTK.exe:28996): GLib-GObject-WARNING **: 19:53:13.687: cannot register existing type 'GtkBuildable'

(testGTK.exe:28996): GLib-GObject-CRITICAL **: 19:53:13.687: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed

(testGTK.exe:28996): GLib-CRITICAL **: 19:53:13.687: g_once_init_leave: assertion 'result != 0' failed

(testGTK.exe:28996): GLib-GObject-CRITICAL **: 19:53:13.687: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(testGTK.exe:28996): GLib-GObject-CRITICAL **: 19:53:13.688: g_type_register_static: assertion 'parent_type > 0' failed

(testGTK.exe:28996): GLib-GObject-WARNING **: 19:53:13.688: cannot add private field to invalid (non-instantiatable) type '<invalid>'

Is there any way to solve this problem?

1 Like

To clarify, does the program run or does it fail because of these messages?

The open_file dialog did not appear, and I could not select file. The program stopped with these messages in the console, and did not respond to my other operations (such as and commands)

The last time I tried this, I vaguely recall running into issues with 1.7. Julia 1.6 worked.