Hello Guile Users!

Yesterday I decided to give g-golf a try. Unfortunately I did not get very far at all. I tried running the hello world example, and it already crashed:

~~~~main.scm~~~~
;;;;
;;;; Copyright (C) 2022 - 2023
;;;; Free Software Foundation, Inc.

;;;; This file is part of GNU G-Golf

;;;; GNU G-Golf is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU Lesser General Public License as
;;;; published by the Free Software Foundation; either version 3 of the
;;;; License, or (at your option) any later version.

;;;; GNU G-Golf is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;;; Lesser General Public License for more details.

;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with GNU G-Golf.  If not, see
;;;;<https://www.gnu.org/licenses/lgpl.html>.
;;;;

;;; Commentary:

;;; Code:

(eval-when (expand load eval)
  (use-modules (oop goops))

  (default-duplicate-binding-handler
    '(merge-generics replace warn-override-core warn last))

  (use-modules (g-golf))

  (g-irepository-require "Gtk" #:version "4.0")
  (for-each (lambda (name)
              (gi-import-by-name "Gtk" name))
      '("Application"
        "ApplicationWindow"
        "Box"
        "Label"
        "Button")))


(define (activate app)
  (let ((window (make <gtk-application-window>
                  #:title "Hello"
                  #:default-width 320
                  #:default-height 240
                  #:application app))
        (box    (make <gtk-box>
                  #:margin-top 6
                  #:margin-start 6
                  #:margin-bottom 6
                  #:margin-end 6
                  #:orientation 'vertical))
        (label  (make <gtk-label>
                  #:label "Hello, World!"
                  #:hexpand #t
                  #:vexpand #t))
        (button (make <gtk-button>
                  #:label "Close")))

    (connect button
         'clicked
         (lambda (b)
               (close window)))

    (set-child window box)
    (append box label)
    (append box button)
    (present window)))


(define (main args)
  (let ((app (make <gtk-application>
               #:application-id "org.gtk.example")))
    (connect app 'activate activate)
    (let ((status (g-application-run app args)))
      (exit status))))
~~~~

Running this results in the following error:

~~~~
guix shell: checking the environment variables visible from shell '/bin/bash'...
guix shell: All is good!  The shell gets correct environment variables.
;;; note: source file /home/hans/dev/guile/gui/g-golf/example-01/main.scm
;;;       newer than compiled 
/home/hans/.cache/guile/ccache/3.0-LE-8-4.6/home/hans/dev/guile/gui/g-golf/example-01/main.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/hans/dev/guile/gui/g-golf/example-01/main.scm
**
GLib-GObject:ERROR:../glib-2.82.1/gobject/gbinding.c:874:g_binding_class_init: 
assertion failed: (gobject_notify_signal_id != 0)
Bail 
out!GLib-GObject:ERROR:../glib-2.82.1/gobject/gbinding.c:874:g_binding_class_init:
 assertion failed: (gobject_notify_signal_id != 0)
make: *** [Makefile:18: run] Error 134
~~~~

I am running it in a guix shell, which has the package "guile" and the package "guile-g-golf" installed.

~~~~channels.scm~~~~
(list (channel
        (name 'guix)
        (url"https://git.savannah.gnu.org/git/guix.git";)
        (branch "master")
        (commit
          "f0c0769189d11debf7b237a02695c44c9773d52a")
        (introduction
          (make-channel-introduction
            "9edb3f66fd807b096b48283debdcddccfea34bad"
            (openpgp-fingerprint
              "BBB0 2DDF 2CEA F6A8 0D1D  E643 A2A0 6DF2 A33A 54FA")))))
~~~~

~~~~manifest.scm~~~~
(specifications->manifest
 '("guile"
   "guile-g-golf"
   "make"
   "bash"))
~~~~

Using time machine:

~~~~
guix time-machine --channels=guix-env/channels.scm -- shell --check 
--manifest=guix-env/manifest.scm -- bash -c guile -L . main.scm
~~~~

What is going wrong?

Is the example code meant to be run in a different way?

Does anyone know how to deal with this error and make it work?

Best regards,
Zelphir

--
repositories:https://notabug.org/ZelphirKaltstahl,https://codeberg.org/ZelphirKaltstahl

Reply via email to