all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#62672: Unexpected interaction between gobject-introspection and grafts
@ 2023-04-05  0:04 Collin J. Doering via Bug reports for GNU Guix
  2023-04-05  8:11 ` Josselin Poiret via Bug reports for GNU Guix
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Collin J. Doering via Bug reports for GNU Guix @ 2023-04-05  0:04 UTC (permalink / raw)
  To: 62672

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




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-27  1:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-05  0:04 bug#62672: Unexpected interaction between gobject-introspection and grafts Collin J. Doering via Bug reports for GNU Guix
2023-04-05  8:11 ` Josselin Poiret via Bug reports for GNU Guix
2023-04-05 16:59   ` Collin J. Doering via Bug reports for GNU Guix
2023-04-06 19:33     ` Josselin Poiret via Bug reports for GNU Guix
2023-04-05 19:55 ` John Kehayias via Bug reports for GNU Guix
2023-04-05 20:21   ` Collin J. Doering via Bug reports for GNU Guix
2024-04-27  1:32 ` Collin J. Doering via Bug reports for GNU Guix

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.