Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run tutorial code in GNU Guix environment? #115

Open
ZelphirKaltstahl opened this issue Jan 10, 2022 · 2 comments
Open

How to run tutorial code in GNU Guix environment? #115

ZelphirKaltstahl opened this issue Jan 10, 2022 · 2 comments

Comments

@ZelphirKaltstahl
Copy link

I am trying to make the first examples of the tutorial run and am hitting a wall.

I have the following:

channels.scm file:

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

(I ran guix pull && guix package -u just before I tried running the code, today.)

A manifest.scm file looking as follows:

(specifications->manifest
 '("guile"
   "guile-gi"))

manifest.scm and channels.scm are both inside guix-env/.

I am trying to get a working environment as follows:

guix time-machine --channels="guix-env/channels.scm" -- environment --manifest="guix-env/manifest.scm"

That seems to work, no error. Then I have the following code from the tutorial at https://spk121.github.io/guile-gi/Parsing-Typelibs-and-Creating-Bindings.html:

(use-modules (gi))
(use-typelibs
 ("GLib" "2.0")
 ("Gtk" "3.0"))

When I try to run this, I get the following:

guile example-00.scm 
;;; note: source file /home/user/dev/guile/guile-examples/gui/example-00.scm
;;;       newer than compiled /home/user/.cache/guile/ccache/3.0-LE-8-4.5/home/user/dev/guile/guile-examples/gui/example-00.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/user/dev/guile/guile-examples/gui/example-00.scm

(process:119960): GuileGI-WARNING **: 23:30:30.755: no way of determining array size of GArray, coercing to pointer

(process:119960): GuileGI-WARNING **: 23:30:30.783: no way of determining array size of GArray, coercing to pointer

(process:119960): GuileGI-WARNING **: 23:30:30.783: no way of determining array size of GArray, coercing to pointer
;;; WARNING: compilation of /home/user/dev/guile/guile-examples/gui/example-00.scm failed:
;;; In procedure require: Typelib file for namespace 'Gtk', version '3.0' not found
Backtrace:
           6 (primitive-load "/home/user/dev/guile/guile-examples/gui/example-00.scm")
In ice-9/eval.scm:
   721:20  5 (primitive-eval (use-typelibs ("GLib" "2.0") ("Gtk" "3.0")))
In ice-9/psyntax.scm:
  1230:36  4 (expand-top-sequence ((use-typelibs ("GLib" "2.0") ("Gtk" "3.0"))) _ _ #f e (#) #)
  1222:19  3 (parse _ (("placeholder" placeholder)) ((top) #(ribcage () () ())) _ e (eval) (…))
   259:10  2 (parse _ (("placeholder" placeholder)) (()) _ c&e (eval) (hygiene guile-user))
In gi/repository.scm:
     48:2  1 (typelib->module _ "Gtk" _)
In unknown file:
           0 (require "Gtk" "3.0")

ERROR: In procedure require:
In procedure require: Typelib file for namespace 'Gtk', version '3.0' not found

I understand it somehow does not find Gtk. But what to do about it? Is there another package, that I need to install or add to my manifest.scm file, in order for the examples to work? Or perhaps a system package I need to install?

@ZelphirKaltstahl
Copy link
Author

I think I fixed it by changing my manifest.scm file to:

(specifications->manifest
 '("guile"
   "guile-gi"
   "gtk+@3.24.30"))

Running in my GNU Guix environment:

guile example-00.scm 
;;; note: source file /home/user/dev/guile/guile-examples/gui/example-00.scm
;;;       newer than compiled /home/user/.cache/guile/ccache/3.0-LE-8-4.5/home/user/dev/guile/guile-examples/gui/example-00.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/user/dev/guile/guile-examples/gui/example-00.scm

(process:123017): GuileGI-WARNING **: 23:45:35.490: no way of determining array size of GArray, coercing to pointer

(process:123017): GuileGI-WARNING **: 23:45:35.515: no way of determining array size of GArray, coercing to pointer

(process:123017): GuileGI-WARNING **: 23:45:35.515: no way of determining array size of GArray, coercing to pointer

(process:123017): GuileGI-WARNING **: 23:45:35.587: Editable - non-Object interface wants signals

(process:123017): GuileGI-WARNING **: 23:45:35.620: no way of determining array size of GArray, coercing to pointer

(process:123017): GuileGI-WARNING **: 23:45:35.620: no way of determining array size of GArray, coercing to pointer
;;; compiled /home/user/.cache/guile/ccache/3.0-LE-8-4.5/home/user/dev/guile/guile-examples/gui/example-00.scm.go
WARNING: (guile-user): imported module (gi) overrides core binding `quit'
WARNING: (guile-user): `quit' imported from both (gi) and (gi GLib-2.0)

@ZelphirKaltstahl
Copy link
Author

For generating HTML docs (as per https://spk121.github.io/guile-gi/Generating-Documentation-from-Typelibs.html), it seems to be necessary to expand the manifest.scm to the following:

(specifications->manifest
 '("guile"
   "guile-gi"
   "gtk+@3.24.30"
   "gtk-doc"))

Otherwise

guild gi-gtkdoc --format=html --output=docs --namespace=GLib --version=2.0

will give an error:

# more logs here
In execvp of gtkdoc-mkhtml: No such file or directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant