GNU bug report logs - #62672
Unexpected interaction between gobject-introspection and grafts

Previous Next

Package: guix;

Reported by: "Collin J. Doering" <collin <at> rekahsoft.ca>

Date: Wed, 5 Apr 2023 00:53:01 UTC

Severity: normal

Done: "Collin J. Doering" <collin <at> rekahsoft.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Collin J. Doering" <collin <at> rekahsoft.ca>
To: 62672 <at> debbugs.gnu.org
Subject: bug#62672: Unexpected interaction between gobject-introspection and grafts
Date: Tue, 04 Apr 2023 20:04:00 -0400
Hi team Guix!

I was working on packaging taffybar (https://github.com/taffybar/taffybar), which depends on haskell-gi (https://github.com/haskell-gi/haskell-gi) - haskell bindings for goject-introspection capable libraries. While packaging gi-gdk, I hit this error:

--8<---------------cut here---------------start------------->8---
** (process:23): WARNING **: 00:09:56.407: Failed to load shared library '/gnu/store/91ar3zh59n19rdn00png5r9hxp3k0y13-gtk-4.8.1/lib/libgtk-4.so.1' referenced by the typelib: libgtk-4.so.1: cannot open shared object file: No such file or directory
Could not resolve symbol "gdk_device_pad_get_type" in namespace "Gdk-4.0"
CallStack (from HasCallStack):
  error, called at lib/Data/GI/CodeGen/LibGIRepository.hs:202:16 in haskell-gi-0.26.4-HCp1omjln8S5hdZ8Oexk5N:Data.GI.CodeGen.LibGIRepository
error: in phase 'configure': uncaught exception:
--8<---------------cut here---------------end--------------->8---

However, confusingly enough the shared library that is referenced by the typelib exists in my store (and is also included via the gtk package as a dependency, so I would expect its available during the build). It took me a bit to realize that the un-grafted gtk package is being used in the typelib, but really the grafted one is needed.

--8<---------------cut here---------------start------------->8---
➜ guix build --no-grafts gtk                                                                   
...
/gnu/store/91ar3zh59n19rdn00png5r9hxp3k0y13-gtk-4.8.1
➜ guix build gtk            
...
/gnu/store/sz90zf6yynsymb1a74zai87f2yi3da82-gtk-4.8.1
--8<---------------cut here---------------end--------------->8---

In the manual "Debugging Build Failures" (https://guix.gnu.org/manual/devel/en/html_node/Debugging-Build-Failures.html#Debugging-Build-Failures), it notes that the build environment can be mimicked using guix shell (explicitly specifying the '--no-grafts' options). Entering this environment and looking more closely at the gtk package in use, it appears that its typelib for libgtk references the .so appropriately.

--8<---------------cut here---------------start------------->8---
➜ guix shell --no-grafts -L . -C -D ghc-gi-gdk binutils
[env]$ readlink -f $GUIX_ENVIRONMENT/lib/girepository-1.0/Gtk-4.0.typelib
/gnu/store/91ar3zh59n19rdn00png5r9hxp3k0y13-gtk-4.8.1/lib/girepository-1.0/Gtk-4.0.typelib
[env]$ strings $GUIX_ENVIRONMENT/lib/girepository-1.0/Gtk-4.0.typelib | grep libgtk
/gnu/store/91ar3zh59n19rdn00png5r9hxp3k0y13-gtk-4.8.1/lib/libgtk-4.so.1
--8<---------------cut here---------------end--------------->8---

So this all to say that I'm not sure whats going wrong with my build, but I suspect it has something to do with grafting. Any help appreciated.

Here is my definition of ghc-gi-gtk (the package that causes this build failure to become apparent):

--8<---------------cut here---------------start------------->8---
(define-public ghc-gi-gdk
  (package
    (name "ghc-gi-gdk")
    (version "4.0.5")
    (source (origin
              (method url-fetch)
              (uri (hackage-uri "gi-gdk" version))
              (sha256
               (base32
                "1pa8vbm931xq3rb9xr441sccga9h1y03lzf6hp2rwkhyhs006hax"))))
    (build-system haskell-build-system)
    (properties '((upstream-name . "gi-gdk")))
    (inputs (list gtk
                  gdk-pixbuf
                  ghc-haskell-gi-base
                  ghc-haskell-gi
                  ghc-haskell-gi-overloading
                  ghc-gi-cairo
                  ghc-gi-pango
                  ghc-gi-gio
                  ghc-gi-gdkpixbuf
                  ghc-gi-gobject
                  ghc-gi-glib))
    (native-inputs (list pkg-config
                         gobject-introspection-cairo)) ; for GI repository files (.gir files)
    (home-page "https://github.com/haskell-gi/haskell-gi")
    (synopsis "Gdk bindings")
    (description "Bindings for Gdk, autogenerated by haskell-gi.")
    (license license:lgpl2.1)))
--8<---------------cut here---------------end--------------->8---

I did not include other dependencies that are not yet packaged upstream (eg. ghc-gi-*, ...), but am happy to provide them if they are useful for reproduction of this issue.

PS: If you noticed I'm using the package 'gobject-introspection-cairo', this is because I found that the cairo typelibs are not included in the cairo package, or gobject-introspection. I worked around this using the aforementioned variant, which is defined like so:

--8<---------------cut here---------------start------------->8---
(define-public gobject-introspection-cairo
  (package
    (inherit gobject-introspection)
    (name "gobject-introspection")
    (inputs (cons* (list "cairo" cairo) (package-inputs gobject-introspection)))
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'configure 'patch-cairo-gir
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (cairo (assoc-ref inputs "cairo")))
               (substitute* '("gir/cairo-1.0.gir.in")
                 (("@CAIRO_SHARED_LIBRARY@")
                  (string-append cairo "/lib/@CAIRO_SHARED_LIBRARY@")))
               #t))))))))
--8<---------------cut here---------------end--------------->8---

Note: this adjustment to gobject-introspection should likely make it upstream (and was inspired by a similar change to nix (described https://github.com/NixOS/nixpkgs/pull/34081)).

-- 
Collin J. Doering

http://rekahsoft.ca
http://blog.rekahsoft.ca
http://git.rekahsoft.ca




This bug report was last modified 1 year and 23 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.