# How to solve the gtk problem when compiling with PackageCompiler?

**URL:** <https://discourse.julialang.org/t/how-to-solve-the-gtk-problem-when-compiling-with-packagecompiler/84309>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [July 16, 2022, 11:53am UTC](https://discourse.julialang.org/t/how-to-solve-the-gtk-problem-when-compiling-with-packagecompiler/84309 "2022-07-16T11:53:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Supernova](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/supernova/32/37999_2.png) [@Supernova](https://discourse.julialang.org/u/Supernova)\
**Post date:** [July 16, 2022, 11:53am UTC](https://discourse.julialang.org/t/how-to-solve-the-gtk-problem-when-compiling-with-packagecompiler/84309/1 "2022-07-16T11:53:49Z")

</div>

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

```julia
module testGTK

using Gtk

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

julia_main()

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`)

```julia
(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?

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [July 16, 2022, 6:29pm UTC](https://discourse.julialang.org/t/how-to-solve-the-gtk-problem-when-compiling-with-packagecompiler/84309/2 "2022-07-16T18:29:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Supernova](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/supernova/32/37999_2.png) [@Supernova](https://discourse.julialang.org/u/Supernova)\
**Post date:** [July 17, 2022, 8:13am UTC](https://discourse.julialang.org/t/how-to-solve-the-gtk-problem-when-compiling-with-packagecompiler/84309/3 "2022-07-17T08:13:09Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [July 17, 2022, 4:43pm UTC](https://discourse.julialang.org/t/how-to-solve-the-gtk-problem-when-compiling-with-packagecompiler/84309/4 "2022-07-17T16:43:10Z")

</div>

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

> <https://github.com/mkitti/GaussianBeamLens/blob/main/src/GtkGUI.jl>

[![](https://global.discourse-cdn.com/julialang/original/3X/3/4/3487c752da56fbe130a90e8a2ede6432eff19996.jpeg "How to... compile your Julia code ahead of time - Mark Kittisopikul") ](https://www.youtube.com/watch?v=VNxLldbALow)
