# Using PackageCompiler.jl with Gtk.jl

**URL:** <https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017>\
**Category:** General Usage\
**Tags:** package-compiler\
**Created:** [June 25, 2020, 12:41am UTC](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017 "2020-06-25T00:41:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charlie\_Ping](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charlie_ping/32/8033_2.png) [@Charlie\_Ping](https://discourse.julialang.org/u/Charlie_Ping)\
**Post date:** [June 25, 2020, 12:41am UTC](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017/1 "2020-06-25T00:41:32Z")

</div>

Hi, I’m trying to build a gui using julia.  
I am running this on ubuntu 20.04

I have a module called TEST  
TEST/src/TEST.jl code:

```julia
module TEST
using Gtk

export real_main, julia_main

const win = Ref{GtkWindow}()
const img = Ref{GtkImage}()

function julia_main()::Cint
    try
        real_main()
    catch
        Base.invokelatest(Base.display_error, Base.catch_stack())
        return 1
    end
    return 0
end

function real_main()
    cd(@ __DIR__ )
    println(abspath("../data/logo.png"))

    win[] = GtkWindow("Crystal Chess", 800, 800)
    img[] = GtkImage(abspath("../data/logo.png"))

    push!(win[], img[])
    showall(win[])

    readline()
end
end # module

```

I got this error after running the compiled file

```julia
(TEST:15355): Gtk-WARNING **: 20:36:36.922: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/Yaru/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3)

signal (6): Aborted
in expression starting at none:0
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
g_assertion_message at /workspace/srcdir/glib-2.59.0/glib/gtestutils.c:2878
g_assertion_message_error at /workspace/srcdir/glib-2.59.0/glib/gtestutils.c:2993
ensure_surface_for_gicon at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkiconhelper.c:494
gtk_icon_helper_load_surface at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkiconhelper.c:566
gtk_icon_helper_ensure_surface at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkiconhelper.c:603
gtk_icon_helper_ensure_surface at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkiconhelper.c:647 [inlined]
_gtk_icon_helper_get_size at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkiconhelper.c:662
gtk_image_get_content_size at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkimage.c:1716
gtk_css_custom_gadget_get_preferred_size at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkcsscustomgadget.c:124
gtk_css_gadget_get_preferred_size at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkcssgadget.c:683
gtk_image_get_preferred_height_and_baseline_for_width at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkimage.c:1948
gtk_widget_query_size_for_orientation at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtksizerequest.c:215
gtk_widget_compute_size_for_orientation at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtksizerequest.c:399
gtk_widget_get_preferred_height at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtksizerequest.c:527
gtk_window_get_preferred_height at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkwindow.c:8969
gtk_widget_query_size_for_orientation at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtksizerequest.c:219
gtk_widget_compute_size_for_orientation at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtksizerequest.c:399
gtk_widget_get_preferred_height_and_baseline_for_width at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtksizerequest.c:642
_gtk_widget_get_preferred_size_and_baseline at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtksizerequest.c:703
gtk_window_compute_hints at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkwindow.c:10286 [inlined]
gtk_window_compute_configure_request at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkwindow.c:9598
gtk_window_move_resize at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkwindow.c:9807
_g_closure_invoke_va at /workspace/srcdir/glib-2.59.0/gobject/gclosure.c:873
g_signal_emit_valist at /workspace/srcdir/glib-2.59.0/gobject/gsignal.c:3300
g_signal_emit at /workspace/srcdir/glib-2.59.0/gobject/gsignal.c:3447
gtk_container_idle_sizer at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkcontainer.c:2065
_g_closure_invoke_va at /workspace/srcdir/glib-2.59.0/gobject/gclosure.c:873
g_signal_emit_valist at /workspace/srcdir/glib-2.59.0/gobject/gsignal.c:3300
g_signal_emit at /workspace/srcdir/glib-2.59.0/gobject/gsignal.c:3447
gdk_frame_clock_paint_idle at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gdk/gdkframeclockidle.c:428
gdk_threads_dispatch at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gdk/gdk.c:777
g_timeout_dispatch at /workspace/srcdir/glib-2.59.0/glib/gmain.c:4680
g_main_dispatch at /workspace/srcdir/glib-2.59.0/glib/gmain.c:3191 [inlined]
g_main_context_dispatch at /workspace/srcdir/glib-2.59.0/glib/gmain.c:3856
g_main_context_iterate at /workspace/srcdir/glib-2.59.0/glib/gmain.c:3929
g_main_loop_run at /workspace/srcdir/glib-2.59.0/glib/gmain.c:4125
gtk_main at /workspace/srcdir/gtk+-3.24.11/build-gtk/../gtk/gtkmain.c:1323
#237 at /home/charlie/.julia/packages/Gtk/X7HfN/src/events.jl:2
unknown function (ip: 0x7f13ba8ffffc)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2159 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2323
g_sigatom at /home/charlie/.julia/packages/Gtk/X7HfN/src/GLib/signals.jl:176
gtk_main at /home/charlie/.julia/packages/Gtk/X7HfN/src/events.jl:1
jfptr_gtk_main_15635 at /home/charlie/OneDrive/CrystalChessPackage/TESTCompiled/bin/TEST.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2145 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2323
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1700 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:687
unknown function (ip: (nil))
Allocations: 21704548 (Pool: 21698794; Big: 5754); GC: 24
Aborted (core dumped)

```

---

<div class="post-metadata">

**Author:** ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Post date:** [June 26, 2020, 6:47am UTC](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017/2 "2020-06-26T06:47:43Z")

</div>

This should be reported as an issue at some of the packages. What do you think @giordano is that a PackageCompiler.jl issue, a Gtk.jl issue or an issue with BB?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [June 26, 2020, 9:45pm UTC](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017/3 "2020-06-26T21:45:39Z")

</div>

I’d first try to asses whether this works without PackageCompiler.

---

<div class="post-metadata">

**Author:** ![Charlie\_Ping](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charlie_ping/32/8033_2.png) [@Charlie\_Ping](https://discourse.julialang.org/u/Charlie_Ping)\
**Post date:** [June 27, 2020, 1:13am UTC](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017/4 "2020-06-27T01:13:01Z")

</div>

Sorry for replying so late!  
I forgot to add that I get this warning no matter if I compiled it or not:

```julia
Gtk-Message: 21:10:46.965: Failed to load module "canberra-gtk-module"
Gtk-Message: 21:10:46.968: Failed to load module "canberra-gtk-module"

```

This works when not compiled but doesn’t work when it is.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [June 27, 2020, 1:16am UTC](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017/5 "2020-06-27T01:16:11Z")

</div>

> [@Charlie\_Ping](#):
>
> I forgot to add that I get this warning no matter if I compiled it or not:

Those warnings are totally harmless, you can ignore them

> [@Charlie\_Ping](#):
>
> This works when not compiled but doesn’t work when it is.

Maybe @kristoffer.carlsson has some ideas?

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [June 27, 2020, 1:29pm UTC](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017/6 "2020-06-27T13:29:37Z")

</div>

Those are harmless but still annoying. If you search it online you’ll see how to fix it. It just means you are missing some gtk pieces that it wants.

---

<div class="post-metadata">

**Author:** ![tknopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tknopp/32/3569_2.png) [@tknopp](https://discourse.julialang.org/u/tknopp)\
**Post date:** [June 27, 2020, 3:38pm UTC](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017/7 "2020-06-27T15:38:36Z")

</div>

Can you tell us how to fix the warnings? That would be awesome, there is also an issue open in Gtk.jl

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [July 1, 2020, 3:05pm UTC](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017/8 "2020-07-01T15:05:50Z")

</div>

Like I said, I just googled the error message. For the error message above, it seems that doing

```bash
sudo apt install libcanberra-gtk-module libcanberra-gtk3-module

```

might fix the issue. When I got the error messages, it was actually complaining about a different module, so I think there must be something related to the system installation which likely differs across distros.
