From: "Collin J. Doering" via Bug reports for GNU Guix <bug-guix@gnu.org>
To: 62672@debbugs.gnu.org
Subject: bug#62672: Unexpected interaction between gobject-introspection and grafts
Date: Tue, 04 Apr 2023 20:04:00 -0400 [thread overview]
Message-ID: <87bkk3m9pm.fsf@rekahsoft.ca> (raw)
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
next reply other threads:[~2023-04-05 0:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 0:04 Collin J. Doering via Bug reports for GNU Guix [this message]
2023-04-05 8:11 ` bug#62672: Unexpected interaction between gobject-introspection and grafts 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bkk3m9pm.fsf@rekahsoft.ca \
--to=bug-guix@gnu.org \
--cc=62672@debbugs.gnu.org \
--cc=collin@rekahsoft.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).