bohonghuang / cl-gtk4

GTK4/Libadwaita/WebKit2 bindings for Common Lisp.
GNU Lesser General Public License v3.0
216 stars 9 forks source link

Issue running simple example: cannot register existing type GApplication #1

Closed timmydo closed 2 years ago

timmydo commented 2 years ago

Sorry I'm fairly new to common lisp/gtk/etc--I was wondering if you could take a quick look and point me in the right direction. The simple counter window did not pop up when I tried it. Thanks!

 guix package --list-installed|grep -E '(^gtk|^gobject)'
gtk                     4.6.6                   out                 /gnu/store/ivwgqpd70pz4i28xs39dwza9mpjsshfy-gtk-4.6.6
gobject-introspection   1.66.1                  out                 /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1
GI_TYPELIB_PATH=~/.guix-profile/lib/girepository-1.0  LD_LIBRARY_PATH="$LIBRARY_PATH" sbcl  
This is SBCL 2.2.6, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (ql:quickload :cl-gtk4/example)
To load "cl-gtk4/example":
  Load 1 ASDF system:
    cl-gtk4/example
; Loading "cl-gtk4/example"
...................
(:CL-GTK4/EXAMPLE)
* (gtk4.example:simple)

(process:4632): GLib-GObject-WARNING **: 21:45:59.712: cannot register existing type 'GApplication'

(process:4632): GLib-GObject-WARNING **: 21:45:59.713: cannot add private field to invalid (non-instantiatable) type '<invalid>'

(process:4632): GLib-GObject-WARNING **: 21:45:59.713: cannot register existing type 'GActionGroup'

(process:4632): GLib-GObject-CRITICAL **: 21:45:59.713: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed

(process:4632): GLib-CRITICAL **: 21:45:59.713: g_once_init_leave: assertion 'result != 0' failed

(process:4632): GLib-GObject-CRITICAL **: 21:45:59.713: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:4632): GLib-GObject-WARNING **: 21:45:59.713: cannot register existing type 'GActionMap'

(process:4632): GLib-GObject-CRITICAL **: 21:45:59.713: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed

(process:4632): GLib-CRITICAL **: 21:45:59.713: g_once_init_leave: assertion 'result != 0' failed

(process:4632): GLib-GObject-CRITICAL **: 21:45:59.713: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:4632): GLib-CRITICAL **: 21:45:59.713: g_once_init_leave: assertion 'result != 0' failed

(process:4632): GLib-GIO-CRITICAL **: 21:45:59.713: g_application_run: assertion 'G_IS_APPLICATION (application)' failed
1
* 
bohonghuang commented 2 years ago

It seems that the binding to GLib has been generated successfully, but the function from GIR cannot be called at runtime. Can you have gtk4-demo running in your system? Can you show the content in /usr/lib/girepository-1.0/ ?

timmydo commented 2 years ago

Where can I find gtk4-demo? I'm running on the Guix distribution so there isn't a /usr directory. I set GI_TYPELIB_PATH to this directory:

ls -l ~/.guix-profile/lib/girepository-1.0                                             
total 232
lrwxrwxrwx 1 root root 111 Dec 31  1969 cairo-1.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/cairo-1.0.typelib
lrwxrwxrwx 1 root root 110 Dec 31  1969 DBus-1.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/DBus-1.0.typelib
lrwxrwxrwx 1 root root 114 Dec 31  1969 DBusGLib-1.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/DBusGLib-1.0.typelib
lrwxrwxrwx 1 root root 103 Dec 31  1969 EvinceDocument-3.0.typelib -> /gnu/store/f25vsda3rsj01y3cdxrkjh7gp5wqg289-evince-40.2/lib/girepository-1.0/EvinceDocument-3.0.typelib
lrwxrwxrwx 1 root root  99 Dec 31  1969 EvinceView-3.0.typelib -> /gnu/store/f25vsda3rsj01y3cdxrkjh7gp5wqg289-evince-40.2/lib/girepository-1.0/EvinceView-3.0.typelib
lrwxrwxrwx 1 root root  99 Dec 31  1969 Flatpak-1.0.typelib -> /gnu/store/2zlgaq9ddw0pjcjpgg1hgmjp3kv71sv1-flatpak-1.12.7/lib/girepository-1.0/Flatpak-1.0.typelib
lrwxrwxrwx 1 root root 116 Dec 31  1969 fontconfig-2.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/fontconfig-2.0.typelib
lrwxrwxrwx 1 root root 115 Dec 31  1969 freetype2-2.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/freetype2-2.0.typelib
lrwxrwxrwx 1 root root 121 Dec 31  1969 GDesktopEnums-3.0.typelib -> /gnu/store/5nqkzrcgwbbk9lnfz73g1nidfp57szlm-gsettings-desktop-schemas-41.0/lib/girepository-1.0/GDesktopEnums-3.0.typelib
lrwxrwxrwx 1 root root  90 Dec 31  1969 Gdk-4.0.typelib -> /gnu/store/ivwgqpd70pz4i28xs39dwza9mpjsshfy-gtk-4.6.6/lib/girepository-1.0/Gdk-4.0.typelib
lrwxrwxrwx 1 root root 104 Dec 31  1969 GdkPixbuf-2.0.typelib -> /gnu/store/ccg1jgy7gxnf2qvc6r9l76bd6pacyn97-gdk-pixbuf-2.42.4/lib/girepository-1.0/GdkPixbuf-2.0.typelib
lrwxrwxrwx 1 root root 105 Dec 31  1969 GdkPixdata-2.0.typelib -> /gnu/store/ccg1jgy7gxnf2qvc6r9l76bd6pacyn97-gdk-pixbuf-2.42.4/lib/girepository-1.0/GdkPixdata-2.0.typelib
lrwxrwxrwx 1 root root  97 Dec 31  1969 GdkWayland-4.0.typelib -> /gnu/store/ivwgqpd70pz4i28xs39dwza9mpjsshfy-gtk-4.6.6/lib/girepository-1.0/GdkWayland-4.0.typelib
lrwxrwxrwx 1 root root  93 Dec 31  1969 GdkX11-4.0.typelib -> /gnu/store/ivwgqpd70pz4i28xs39dwza9mpjsshfy-gtk-4.6.6/lib/girepository-1.0/GdkX11-4.0.typelib
lrwxrwxrwx 1 root root 109 Dec 31  1969 Gio-2.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/Gio-2.0.typelib
lrwxrwxrwx 1 root root 118 Dec 31  1969 GIRepository-2.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/GIRepository-2.0.typelib
lrwxrwxrwx 1 root root 108 Dec 31  1969 GL-1.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/GL-1.0.typelib
lrwxrwxrwx 1 root root 110 Dec 31  1969 GLib-2.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/GLib-2.0.typelib
lrwxrwxrwx 1 root root 113 Dec 31  1969 GModule-2.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/GModule-2.0.typelib
lrwxrwxrwx 1 root root 113 Dec 31  1969 GObject-2.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/GObject-2.0.typelib
lrwxrwxrwx 1 root root 101 Dec 31  1969 Graphene-1.0.typelib -> /gnu/store/13a4n3400i38mqmxcqf5yba6r32iy1r8-graphene-1.10.6/lib/girepository-1.0/Graphene-1.0.typelib
lrwxrwxrwx 1 root root  90 Dec 31  1969 Gsk-4.0.typelib -> /gnu/store/ivwgqpd70pz4i28xs39dwza9mpjsshfy-gtk-4.6.6/lib/girepository-1.0/Gsk-4.0.typelib
lrwxrwxrwx 1 root root  97 Dec 31  1969 Gst-1.0.typelib -> /gnu/store/6axvbxx14lrb5bynn0jfkbz5638w5wcg-gstreamer-1.18.5/lib/girepository-1.0/Gst-1.0.typelib
lrwxrwxrwx 1 root root 114 Dec 31  1969 GstAllocators-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstAllocators-1.0.typelib
lrwxrwxrwx 1 root root 107 Dec 31  1969 GstApp-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstApp-1.0.typelib
lrwxrwxrwx 1 root root 109 Dec 31  1969 GstAudio-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstAudio-1.0.typelib
lrwxrwxrwx 1 root root 101 Dec 31  1969 GstBase-1.0.typelib -> /gnu/store/6axvbxx14lrb5bynn0jfkbz5638w5wcg-gstreamer-1.18.5/lib/girepository-1.0/GstBase-1.0.typelib
lrwxrwxrwx 1 root root 102 Dec 31  1969 GstCheck-1.0.typelib -> /gnu/store/6axvbxx14lrb5bynn0jfkbz5638w5wcg-gstreamer-1.18.5/lib/girepository-1.0/GstCheck-1.0.typelib
lrwxrwxrwx 1 root root 107 Dec 31  1969 GstController-1.0.typelib -> /gnu/store/6axvbxx14lrb5bynn0jfkbz5638w5wcg-gstreamer-1.18.5/lib/girepository-1.0/GstController-1.0.typelib
lrwxrwxrwx 1 root root 106 Dec 31  1969 GstGL-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstGL-1.0.typelib
lrwxrwxrwx 1 root root 109 Dec 31  1969 GstGLEGL-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstGLEGL-1.0.typelib
lrwxrwxrwx 1 root root 113 Dec 31  1969 GstGLWayland-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstGLWayland-1.0.typelib
lrwxrwxrwx 1 root root 109 Dec 31  1969 GstGLX11-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstGLX11-1.0.typelib
lrwxrwxrwx 1 root root 100 Dec 31  1969 GstNet-1.0.typelib -> /gnu/store/6axvbxx14lrb5bynn0jfkbz5638w5wcg-gstreamer-1.18.5/lib/girepository-1.0/GstNet-1.0.typelib
lrwxrwxrwx 1 root root 111 Dec 31  1969 GstPbutils-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstPbutils-1.0.typelib
lrwxrwxrwx 1 root root 107 Dec 31  1969 GstRtp-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstRtp-1.0.typelib
lrwxrwxrwx 1 root root 108 Dec 31  1969 GstRtsp-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstRtsp-1.0.typelib
lrwxrwxrwx 1 root root 107 Dec 31  1969 GstSdp-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstSdp-1.0.typelib
lrwxrwxrwx 1 root root 107 Dec 31  1969 GstTag-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstTag-1.0.typelib
lrwxrwxrwx 1 root root 109 Dec 31  1969 GstVideo-1.0.typelib -> /gnu/store/rgmhl4a92lj420mwp12bnfp19pacgk0h-gst-plugins-base-1.18.5/lib/girepository-1.0/GstVideo-1.0.typelib
lrwxrwxrwx 1 root root  90 Dec 31  1969 Gtk-4.0.typelib -> /gnu/store/ivwgqpd70pz4i28xs39dwza9mpjsshfy-gtk-4.6.6/lib/girepository-1.0/Gtk-4.0.typelib
lrwxrwxrwx 1 root root 100 Dec 31  1969 HarfBuzz-0.0.typelib -> /gnu/store/wsz6ahiahlgc5wn2wrbmpid5kqkg93mf-harfbuzz-2.8.2/lib/girepository-1.0/HarfBuzz-0.0.typelib
lrwxrwxrwx 1 root root 113 Dec 31  1969 libxml2-2.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/libxml2-2.0.typelib
lrwxrwxrwx 1 root root  97 Dec 31  1969 MPID-3.0.typelib -> /gnu/store/a3n3an3rffas0k8a86j4ga5gyy9m8jmq-rhythmbox-3.4.4/lib/girepository-1.0/MPID-3.0.typelib
lrwxrwxrwx 1 root root  95 Dec 31  1969 Pango-1.0.typelib -> /gnu/store/68ry1kas1m0k1llka28g1k5g8wjj87d0-pango-1.50.4/lib/girepository-1.0/Pango-1.0.typelib
lrwxrwxrwx 1 root root 100 Dec 31  1969 PangoCairo-1.0.typelib -> /gnu/store/68ry1kas1m0k1llka28g1k5g8wjj87d0-pango-1.50.4/lib/girepository-1.0/PangoCairo-1.0.typelib
lrwxrwxrwx 1 root root  97 Dec 31  1969 PangoFc-1.0.typelib -> /gnu/store/68ry1kas1m0k1llka28g1k5g8wjj87d0-pango-1.50.4/lib/girepository-1.0/PangoFc-1.0.typelib
lrwxrwxrwx 1 root root  98 Dec 31  1969 PangoFT2-1.0.typelib -> /gnu/store/68ry1kas1m0k1llka28g1k5g8wjj87d0-pango-1.50.4/lib/girepository-1.0/PangoFT2-1.0.typelib
lrwxrwxrwx 1 root root  97 Dec 31  1969 PangoOT-1.0.typelib -> /gnu/store/68ry1kas1m0k1llka28g1k5g8wjj87d0-pango-1.50.4/lib/girepository-1.0/PangoOT-1.0.typelib
lrwxrwxrwx 1 root root  98 Dec 31  1969 PangoXft-1.0.typelib -> /gnu/store/68ry1kas1m0k1llka28g1k5g8wjj87d0-pango-1.50.4/lib/girepository-1.0/PangoXft-1.0.typelib
lrwxrwxrwx 1 root root  95 Dec 31  1969 RB-3.0.typelib -> /gnu/store/a3n3an3rffas0k8a86j4ga5gyy9m8jmq-rhythmbox-3.4.4/lib/girepository-1.0/RB-3.0.typelib
lrwxrwxrwx 1 root root  96 Dec 31  1969 Rsvg-2.0.typelib -> /gnu/store/3j7j9v2paqnwkm2xx4wpiil39pw0j3z9-librsvg-2.50.7/lib/girepository-1.0/Rsvg-2.0.typelib
lrwxrwxrwx 1 root root 112 Dec 31  1969 Vulkan-1.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/Vulkan-1.0.typelib
lrwxrwxrwx 1 root root 111 Dec 31  1969 win32-1.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/win32-1.0.typelib
lrwxrwxrwx 1 root root 112 Dec 31  1969 xfixes-4.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/xfixes-4.0.typelib
lrwxrwxrwx 1 root root 109 Dec 31  1969 xft-2.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/xft-2.0.typelib
lrwxrwxrwx 1 root root 110 Dec 31  1969 xlib-2.0.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/xlib-2.0.typelib
lrwxrwxrwx 1 root root 112 Dec 31  1969 xrandr-1.3.typelib -> /gnu/store/whngbagkibx40rsprgair62c59l0b2m8-gobject-introspection-1.66.1/lib/girepository-1.0/xrandr-1.3.typelib
bohonghuang commented 2 years ago

@timmydo Sorry, I'm not currently using Guix. You can eval (gir::repository-get-search-path) in REPL, whose result should be the directory where you find the typelib files. Also, you might install python-pygobject and then run the example to check whether GObject Introspection works fine.

timmydo commented 2 years ago

I tried the python one and it worked. Thanks, it helped me find the issue! Sorry for the distraction. It seems the way I set up LD_LIBRARY_PATH caused issues. I just needed to run this before starting:

(ql:quickload :cffi)
(push (format nil "~a/.guix-profile/lib/" (uiop:getenv "HOME")) cffi:*foreign-library-directories*)

Thanks again!