spk121 / guile-gi

Bindings for GObject Introspection and libgirepository for Guile
GNU General Public License v3.0
58 stars 7 forks source link

(use-typelib ("Gtk "4.0")) results in errors, whilst (require "Gtk" "4.0") does not #120

Closed lshoravi closed 2 years ago

lshoravi commented 2 years ago

Minimal reproducable example:

(define-module (example)
  #:use-module (gi)
  #:use-module (gi repository)
  #:use-module (gi util))

(use-typelibs ("Gtk" "4.0"))

Results in:

$ guile example.scm

(process:322459): GuileGI-WARNING **: 23:13:50.056: not redefining fundamental type GtkExpression

(process:322459): GuileGI-WARNING **: 23:13:50.073: no way of determining array size of GArray, coercing to pointer

(process:322459): GuileGI-WARNING **: 23:13:50.073: no way of determining array size of GArray, coercing to pointer

(process:322459): GLib-GObject-WARNING **: 23:13:50.087: cannot register existing type 'GdkPixbuf'

(process:322459): GLib-GObject-CRITICAL **: 23:13:50.087: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:322459): GLib-GObject-CRITICAL **: 23:13:50.087: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:322459): GLib-CRITICAL **: 23:13:50.087: g_once_init_leave: assertion 'result != 0' failed

However, the following works:

(define-module (example)
  #:use-module (gi)
  #:use-module (gi repository)
  #:use-module (gi util))

(require "Gtk" "4.0")

Reproduces in guix shell from the following manifest:

(package
  (name "example")
  (version "0.1")
  (source "./example-0.1.tar.gz")
  (build-system gnu-build-system)
  (arguments `())
  (native-inputs
    `(("autoconf" ,autoconf)
      ("automake" ,automake)
      ("pkg-config" ,pkg-config)
      ("texinfo" ,texinfo)))
  (inputs `(("guile" ,guile-3.0)
            ("guile-gi" ,guile-gi)
            ("gtk4" ,gtk)
            ("libadwaita" ,libadwaita)))
  (propagated-inputs `())
  (synopsis "")
  (description "")
  (home-page "")
  (license license:gpl3+))
spk121 commented 2 years ago

Hi. Are you using version 0.3.2? There was some work done to improve fundamental types in that revision.

lshoravi commented 2 years ago

Seems like it, judging by guix:

$ guix search guile-gi
name: guile-gi
version: 0.3.2
spk121 commented 2 years ago

Well, I can't reproduce, so this is probably another case of how guile-gi is just broken on guix, or on any distro where guile-gi itself is compiled with a different instance of the shared objects of GObject/GLib than ends up being used by the script itself. Slowly creeping toward a solution to this for 0.4.x

lshoravi commented 2 years ago

Indeed, entering the environment with guix shell --no-grafts results in no crashes. I'll close this.