Gtk.jl
Gtk.jl copied to clipboard
PackageCompiler.create_app() with Gtk creates an executable that segfaults
Using an existing minimal example intended to demonstrate Gtk based Julia apps: https://github.com/andrewkerr9000/GUIAppExample.jl/tree/master/example/CountClick
I don't know whether this issue would belong with Gtk, one of its dependencies, or PackageCompiler.
create_app does work as expected with Julia 1.4.2+0.x64 (and PackageCompiler 1.4.1, Gtk 3.24.29)
create_app creates a segfaulting app using Julia 1.8.0+0.x64 on Linux, installed via juliaup 1.7.22
Dependencies have been updated from original using ]update
. Those dependencies are PackageCompiler
(to 2.0.9) and Gtk
(to 3.24.31). See log.
Running the app from source works as expected. i.e.:
cd here
julia --project
using CountClick
CountClick.julia_main()
However, creating an app from that directory:
using PackageCompiler
create_app("","target")
creates an app that segfaults when run:
Gtk-Message: 16:38:10.784: Failed to load module "canberra-gtk-module"
Gtk-Message: 16:38:10.803: Failed to load module "colorreload-gtk-module"
Gtk-Message: 16:38:10.803: Failed to load module "window-decorations-gtk-module"
(CountClick:32093): GLib-GObject-CRITICAL **: 16:38:10.853: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
(CountClick:32093): GLib-CRITICAL **: 16:38:10.853: g_once_init_leave: assertion 'result != 0' failed
(CountClick:32093): GLib-GObject-CRITICAL **: 16:38:10.853: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
(CountClick:32093): GLib-CRITICAL **: 16:38:10.853: g_once_init_leave: assertion 'result != 0' failed
(CountClick:32093): GLib-GObject-CRITICAL **: 16:38:10.854: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
(CountClick:32093): GLib-CRITICAL **: 16:38:10.854: g_once_init_leave: assertion 'result != 0' failed
signal (11): Segmentation fault
in expression starting at none:1
ijl_subtype_env at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/subtype.c:1857
gc_ref at /home/<username>/.julia/packages/Gtk/OyCvN/src/GLib/gtype.jl:351
gc_ref_closure at /home/<username>/.julia/packages/Gtk/OyCvN/src/GLib/gtype.jl:371 [inlined]
_signal_connect at /home/<username>/.julia/packages/Gtk/OyCvN/src/GLib/signals.jl:42
signal_connect at /home/<username>/.julia/packages/Gtk/OyCvN/src/GLib/signals.jl:27 [inlined]
signal_connect at /home/<username>/.julia/packages/Gtk/OyCvN/src/GLib/signals.jl:27 [inlined]
handle_auto_idle at /home/<username>/.julia/packages/Gtk/OyCvN/src/base.jl:26 [inlined]
showall at /home/<username>/.julia/packages/Gtk/OyCvN/src/base.jl:51 [inlined]
julia_main at /home/<username>/code/GUIAppExample.jl/example/CountClick/Compile/CountClick/src/CountClick.jl:24
jfptr_julia_main_47207.clone_1 at /home/<username>/code/GUIAppExample.jl/example/CountClick/Compile/CountClick/target/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:2549
jl_apply at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/julia.h:1838 [inlined]
do_call at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/interpreter.c:126
eval_value at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/interpreter.c:215
eval_stmt_value at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/interpreter.c:166 [inlined]
eval_body at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/interpreter.c:612
jl_interpret_toplevel_thunk at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/interpreter.c:750
jl_toplevel_eval_flex at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/toplevel.c:906
jl_toplevel_eval_flex at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/toplevel.c:850
ijl_toplevel_eval_in at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/toplevel.c:965
ijl_eval_string at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/jlapi.c:115
checked_eval_string at ./target/bin/CountClick (unknown line)
main at ./target/bin/CountClick (unknown line)
__libc_start_call_main at /lib64/libc.so.6 (unknown line)
__libc_start_main at /lib64/libc.so.6 (unknown line)
unknown function (ip: 0x402464)
Allocations: 874600 (Pool: 874115; Big: 485); GC: 1
Segmentation fault (core dumped)
Have you tried this with earlier Julia versions?
I got the same error on 1.6 and 1.8.
@KristofferC
It seems like Gtk.jl's auto-idle should work fine with PackageCompiler, but if I run the CountClick
executable with GTK_AUTO_IDLE=false
, it gets a little farther before crashing. I'm on Linux, Julia 1.8.2.
It shows the window. The first time the button is clicked it outputs:
(CountClick:174331): GLib-GObject-CRITICAL **: 09:15:10.510: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
(CountClick:174331): GLib-CRITICAL **: 09:15:10.510: g_once_init_leave: assertion 'result != 0' failed
(CountClick:174331): GLib-GObject-CRITICAL **: 09:15:10.511: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
(CountClick:174331): GLib-CRITICAL **: 09:15:10.511: g_once_init_leave: assertion 'result != 0' failed
(CountClick:174331): GLib-GObject-CRITICAL **: 09:15:10.512: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
(CountClick:174331): GLib-CRITICAL **: 09:15:10.512: g_once_init_leave: assertion 'result != 0' failed
The application freezes when the button is clicked a second time. If I close the window without clicking on the button, it crashes with:
(CountClick:174119): GLib-GObject-CRITICAL **: 09:08:51.442: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
(CountClick:174119): GLib-CRITICAL **: 09:08:51.442: g_once_init_leave: assertion 'result != 0' failed
(CountClick:174119): GLib-GObject-CRITICAL **: 09:08:51.443: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
(CountClick:174119): GLib-CRITICAL **: 09:08:51.443: g_once_init_leave: assertion 'result != 0' failed
(CountClick:174119): GLib-GObject-CRITICAL **: 09:08:51.444: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
(CountClick:174119): GLib-CRITICAL **: 09:08:51.444: g_once_init_leave: assertion 'result != 0' failed
signal (11): Segmentation fault
in expression starting at none:1
ijl_subtype_env at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/subtype.c:1854
gc_unref at /home/wahlstrj/.julia/packages/Gtk/OyCvN/src/GLib/gtype.jl:361
jfptr_gc_unref_45583.clone_1 at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/gf.c:2549
_gc_unref at /home/wahlstrj/.julia/packages/Gtk/OyCvN/src/GLib/gtype.jl:370
jfptr__gc_unref_45204.clone_1 at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/gf.c:2549
jlcapi__gc_unref_45298.clone_1 at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/lib/julia/sys.so (unknown line)
g_closure_invalidate at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
g_closure_unref at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
g_signal_handlers_destroy at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
g_object_real_dispose at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
g_object_run_dispose at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
gtk_box_forall at /workspace/srcdir/gtk/build-gtk/../gtk/gtkbox.c:2678
gtk_container_destroy at /workspace/srcdir/gtk/build-gtk/../gtk/gtkcontainer.c:1702
g_closure_invoke at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
signal_emit_unlocked_R at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
g_signal_emit_valist at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
g_signal_emit at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
gtk_widget_dispose at /workspace/srcdir/gtk/build-gtk/../gtk/gtkwidget.c:12166
g_object_run_dispose at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
gtk_window_forall at /workspace/srcdir/gtk/build-gtk/../gtk/gtkwindow.c:8597
gtk_container_destroy at /workspace/srcdir/gtk/build-gtk/../gtk/gtkcontainer.c:1702
g_closure_invoke at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
signal_emit_unlocked_R at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
g_signal_emit_valist at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
g_signal_emit at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
gtk_widget_dispose at /workspace/srcdir/gtk/build-gtk/../gtk/gtkwidget.c:12166
gtk_window_dispose at /workspace/srcdir/gtk/build-gtk/../gtk/gtkwindow.c:3167
g_object_run_dispose at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libgobject-2.0.so.0 (unknown line)
gtk_main_do_event at /workspace/srcdir/gtk/build-gtk/../gtk/gtkmain.c:1837
_gdk_event_emit at /workspace/srcdir/gtk/build-gtk/../gdk/gdkevents.c:73
gdk_event_source_dispatch at /workspace/srcdir/gtk/build-gtk/../gdk/x11/gdkeventsource.c:367
g_main_context_dispatch at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libglib-2.0.so.0 (unknown line)
g_main_context_iterate.isra.22 at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libglib-2.0.so.0 (unknown line)
g_main_loop_run at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/share/julia/artifacts/b069ad81d556658ea64a543367e128e535fab269/lib/libglib-2.0.so.0 (unknown line)
gtk_main at /workspace/srcdir/gtk/build-gtk/../gtk/gtkmain.c:1329
#253 at /home/wahlstrj/.julia/packages/Gtk/OyCvN/src/events.jl:2
unknown function (ip: 0x7efe5e70518f)
_jl_invoke at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/gf.c:2549
g_sigatom at /home/wahlstrj/.julia/packages/Gtk/OyCvN/src/GLib/signals.jl:176
unknown function (ip: 0x7efe5e703cc2)
gtk_main at /home/wahlstrj/.julia/packages/Gtk/OyCvN/src/events.jl:1
jfptr_gtk_main_45846.clone_1 at /home/wahlstrj/GUIAppExample.jl/example/CountClick/Compile/CountClick/target5/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/gf.c:2549
jl_apply at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/julia.h:1839 [inlined]
start_task at /cache/build/default-amdci4-6/julialang/julia-release-1-dot-8/src/task.c:931
Allocations: 879766 (Pool: 879271; Big: 495); GC: 1
Segmentation fault (core dumped)
I get very similar GLib-GObject-CRITICAL
errors from Gtk.jl
on Julia 1.9.0-rc3 (on Windows) and 1.8.4 (on a Mac) after using GTK_AUTO_IDLE = false
and the include_transitive_dependencies = false
option for create_app
(to avoid a failing download of MKL). Did someone in the meantime find a solution to it? @jwahlstrand Could switching to Gtk4.jl
be an option to work smoother with PackageCompiler
?
I wonder if #687 fixes it -- I don't have time to check. But yes, Gtk4.jl
does seem to work OK with PackageCompiler
.
Thanks @jwahlstrand, I will give it a try with a slight preference towards switching to Gtk4.jl
- thanks for your work on Gtk4
b.t.w!