mam prostą aplikację PyGObject:cx_freeze aplikacja PyGObject Linux
from gi.repository import Gtk
class Window(Gtk.Window):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.set_border_width(5)
self.button = Gtk.Button('Test')
self.box = Gtk.Box()
self.box.pack_start(self.button, True, True, 0)
self.add(self.box)
self.connect('delete-event', Gtk.main_quit)
self.show_all()
win = Window()
Gtk.main()
próbuję zamrozić go za pomocą cx_freeze na systemie Linux za pomocą poniższego setup.py
skrypt:
from cx_Freeze import setup, Executable
setup(name="GUI Test",
description="GUITest",
version="0.1",
options={"build_exe": {"build_exe": "Bin/pygobject",
"create_shared_zip": False,
}},
executables=[Executable(script="hello_pygobject.py",
targetName="hello",
appendScriptToExe=True,
)]
)
I używam go jak to: python3 setup_pygobject.py build
Gdy próbuję uruchomić zamrożoną aplikację, pojawia się następujący komunikat o błędzie:
(process:22538): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
Segmentation fault (core dumped)
Prawdopodobnie brakuje mi garstki bibliotek w katalogu, takich jak they have explained for Windows. Wypróbowałem pmap
, aby znaleźć brakujące biblioteki. W ostateczności próbowałem również skopiować wszystkie biblioteki z /usr/lib64/
(+ niektóre inne, których nie pamiętam) do katalogu roboczego.
Czy istnieje dobry sposób, aby znaleźć potrzebne biblioteki lub lepszy sposób na ich usunięcie?
pokrewne pytanie, ale dla systemu Windows:Python3 + PyGobject + GTK3 and cx_freeze missing DLLs
EDIT:
Próbowałem użyć dbg
zbadanie zrzutu. Mam to:
...
Core was generated by `./hello'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fd3d009d4ef in _gtk_settings_get_style_cascade() from /lib64/libgtk-3.so.0
Kiedy zainstalowane oddzielne debuginfos mam to:
...
Core was generated by `./hello'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 _gtk_settings_get_style_cascade (settings=0x0, [email protected]=1) at gtksettings.c:1764
1764 GtkSettingsPrivate *priv = settings->priv;
Po uruchomieniu aplikacji przez gdb
mam to:
...
(process:21699): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
Program received signal SIGSEGV, Segmentation fault.
_gtk_settings_get_style_cascade (settings=0x0, [email protected]=1) at gtksettings.c:1764
1764 GtkSettingsPrivate *priv = settings->priv;
Ślad stosu:
(gdb) backtrace
#0 0x00007fffed62c4ef in _gtk_settings_get_style_cascade (settings=0x0, [email protected]=1) at gtksettings.c:1764
#1 0x00007fffed6422d0 in gtk_style_context_init (style_context=0x904080 [GtkStyleContext]) at gtkstylecontext.c:425
#2 0x00007fffef86556b in g_type_create_instance (type=9442240) at gtype.c:1870
#3 0x00007fffef8480ab in g_object_new_internal ([email protected]=0x901490, [email protected]=0x0, [email protected]=0) at gobject.c:1774
#4 0x00007fffef849991 in g_object_newv ([email protected]=9442240, [email protected]=0, [email protected]=0x0) at gobject.c:1921
#5 0x00007fffef84a2c4 in g_object_new (object_type=9442240, [email protected]=0x0) at gobject.c:1614
#6 0x00007fffed63f709 in gtk_style_context_new() at gtkstylecontext.c:994
#7 0x00007fffed46086f in _gtk_style_new_for_path (screen=0x0, [email protected]=0x83dd70) at deprecated/gtkstyle.c:853
#8 0x00007fffed4608ee in gtk_style_new() at deprecated/gtkstyle.c:887
#9 0x00007fffed463569 in gtk_widget_get_default_style() at deprecated/gtkstyle.c:4057
#10 0x00007fffed6dfde5 in gtk_widget_init (widget=<optimized out>) at gtkwidget.c:4510
#11 0x00007fffef865527 in g_type_create_instance (type=9319840) at gtype.c:1864
#12 0x00007fffef8480ab in g_object_new_internal ([email protected]=0x900b90, [email protected]=0x0, [email protected]=0) at gobject.c:1774
#13 0x00007fffef849991 in g_object_newv (object_type=9319840, n_parameters=0, parameters=0x0) at gobject.c:1921
#14 0x00007fffefece19c in pygobject_constructv() at /home/skontar/Python/Examples/GUI/Bin/pygobject/gi._gi.so
#15 0x00007fffefed57c1 in pygobject_init() at /home/skontar/Python/Examples/GUI/Bin/pygobject/gi._gi.so
#16 0x00007ffff79fec4c in wrap_init() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#17 0x00007ffff79adf31 in PyObject_Call() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#18 0x00007ffff7a60a9f in PyEval_EvalFrameEx() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#19 0x00007ffff7a65de6 in PyEval_EvalCodeEx() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#20 0x00007ffff79d65f8 in function_call() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#21 0x00007ffff79adf31 in PyObject_Call() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#22 0x00007ffff79c3344 in method_call() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#23 0x00007ffff79adf31 in PyObject_Call() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#24 0x00007ffff7a057e0 in slot_tp_init() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#25 0x00007ffff7a03276 in type_call() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#26 0x00007ffff79adf31 in PyObject_Call() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#27 0x00007ffff7a5de0a in PyEval_EvalFrameEx() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#28 0x00007ffff7a65de6 in PyEval_EvalCodeEx() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#29 0x00007ffff7a65e8b in PyEval_EvalCode() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#30 0x00007ffff7a5936a in builtin_exec() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#31 0x00007ffff7a64f1f in PyEval_EvalFrameEx() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#32 0x00007ffff7a65de6 in PyEval_EvalCodeEx() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#33 0x00007ffff7a65e8b in PyEval_EvalCode() at /home/skontar/Python/Examples/GUI/Bin/pygobject/libpython3.4m.so.1.0
#34 0x000000000040192c in ()
#35 0x00007ffff738f700 in __libc_start_main (main=0x4011e0, argc=1, argv=0x7fffffffe598, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe588)
at libc-start.c:289
#36 0x0000000000401c69 in ()
EDIT 2:
Odpowiednie pakiety:
python3.x86_64 3.4.2-6.fc22
python3-gobject.x86_64 3.16.2-1.fc22
cx-Freeze (4.3.4)
Można spróbować uruchomić go za pomocą '' gdb'', aby uzyskać więcej szczegółów na temat charakteru winy segmentacji (lub sprawdzić zrzut z gdb). – proycon
@proycon Próbowałem (nigdy wcześniej tego nie robiłem). Ale nie wydaje mi się, żeby dane wyjściowe były przydatne. – Fenikso
To prawda, chociaż przynajmniej teraz wiesz, że segfault jest spowodowany przez zerowy wskaźnik w bibliotece gtk3 ('' settings == NULL'', więc '' settings-> priv'' segfaults). Niestety nie jestem zaznajomiony z cx_Freeze. To może być trudne do złamania. – proycon