GNU bug report logs - #49122
gobject-introspection and not finding cairo

Previous Next

Package: guix;

Reported by: John Kehayias <john.kehayias <at> protonmail.com>

Date: Sun, 20 Jun 2021 00:25:02 UTC

Severity: normal

To reply to this bug, email your comments to 49122 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#49122; Package guix. (Sun, 20 Jun 2021 00:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Kehayias <john.kehayias <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 20 Jun 2021 00:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: "bug-guix <at> gnu.org" <bug-guix <at> gnu.org>
Subject: gobject-introspection and not finding cairo
Date: Sat, 19 Jun 2021 18:29:05 +0000
Hello,

I'm trying to build some new packages, one of which is ghc-gi-cairo (from ghc-haskell-gi: https://github.com/haskell-gi/haskell-gi). These depend on gobject-introspection and finding library information from gir. However, it appears the typelib for cairo does not include the absolute path for cairo (though gobject-introspection right now does not depend on cairo, so that makes sense?) and the library cannot be found from this info.

Perhaps the name exposed in the typelib should be something else? I know there are patches for paths in gobject-introspection, and this issue of library path from gobject-introspection is not just in guix (e.g. https://github.com/Cimbali/pympress/issues/58). In building I do see LIBRARY_PATH includes the correct gobject-introspection (it does find the girepository in configure) and cairo, but as far as I can tell the path to cairo must be found via the typelib when using gobject-introspection?

I've tried building gobject-introspection with cairo enabled in meson, which didn't help. I also tried patching the cairo.gir file (as in https://github.com/Cimbali/pympress/issues/58#issuecomment-503174954), but haven't figured out what needs to go in there to make it work. Probably gobject-introspection needs to be build with cairo as an input and correctly get the full path to the library in generating the typelib? But what goes in the gir/cairo-1.0.gir.in file exactly?

From the gobject-introspection package running:

strings /gnu/store/irmw6agiw3adqphw8c3m19g31fw1yf34-gobject-introspection-1.62.0/lib/girepository-1.0/cairo-1.0.typelib | grep lib

has output:

libcairo-gobject.so.2
xlib


End of building ghc-gi-cairo has the following message:

starting phase `configure'
running "runhaskell Setup.hs" with command "configure" and parameters ("--prefix=/gnu/store/w95yciqs7i7aqm6v7qa6fiy6m6f25czb-ghc-gi-cairo-1.0.25" "--libdir=/gnu/store/w95yciqs7i7aqm6v7qa6fiy6m6f25czb-ghc-gi-cairo-1.0.25/lib" "--docdir=/gnu/store/w95yciqs7i7aqm6v7qa6fiy6m6f25czb-ghc-gi-cairo-1.0.25/share/doc/ghc-gi-cairo-1.0.25" "--libsubdir=$compiler/$pkg-$version" "--package-db=/tmp/guix-build-ghc-gi-cairo-1.0.25.drv-0/package.conf.d" "--global" "--enable-tests" "--enable-shared" "--enable-executable-dynamic" "--ghc-option=-fPIC" "--ghc-option=-optl=-Wl,-rpath=/gnu/store/w95yciqs7i7aqm6v7qa6fiy6m6f25czb-ghc-gi-cairo-1.0.25/lib/$compiler/$pkg-$version")

** (process:19): WARNING **: 17:28:36.142: Failed to load shared library 'libcairo-gobject.so.2' referenced by the typelib: libcairo-gobject.so.2: cannot open shared object file: No such file or directory
Could not resolve symbol "cairo_gobject_context_get_type" in namespace "cairo-1.0"

Appreciate any tips, help, or things to try!

John




Information forwarded to bug-guix <at> gnu.org:
bug#49122; Package guix. (Mon, 21 Jun 2021 00:00:01 GMT) Full text and rfc822 format available.

Message #8 received at 49122 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: "49122 <at> debbugs.gnu.org" <49122 <at> debbugs.gnu.org>
Subject: (No Subject)
Date: Sun, 20 Jun 2021 23:59:38 +0000
I've managed to fix the initial problem I noted, but this would depend on having cairo as an input so that gobject-introspection can find the library to patch the typelib. Unfortunately, this would be a circular dependency. This is a long standing issue with how cairo is handled here (see, e.g., https://gitlab.freedesktop.org/cairo/cairo/-/issues/141).

I don't know how circular dependencies are solved in guix, so I'm not sure what to do to fix this. gobject-introspection doesn't need cairo to build or function, so the build depends is not really needed other than to fix this bug. So this could be done with a separate package or in two steps?




Information forwarded to bug-guix <at> gnu.org:
bug#49122; Package guix. (Mon, 21 Jun 2021 02:05:01 GMT) Full text and rfc822 format available.

Message #11 received at 49122 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: "49122 <at> debbugs.gnu.org" <49122 <at> debbugs.gnu.org>
Subject: (No Subject)
Date: Mon, 21 Jun 2021 02:04:06 +0000
[Message part 1 (text/plain, inline)]
Of course, saw right after my last message that the dependency cycle here is through poppler, and cairo-sans-poppler exists. So I think I've solved this problem and will submit a patch.

I've attached the current changes I've been working on and testing for now.

[go-cairo.patch (text/x-patch, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#49122; Package guix. (Tue, 07 Sep 2021 23:07:02 GMT) Full text and rfc822 format available.

Message #14 received at 49122 <at> debbugs.gnu.org (full text, mbox):

From: Raghav Gururajan <rg <at> raghavgururajan.name>
To: 49122 <at> debbugs.gnu.org
Subject: Re: gobject-introspection and not finding cairo
Date: Tue, 7 Sep 2021 19:06:42 -0400
[Message part 1 (text/plain, inline)]
Hi John!

You could try creating a gobject-introspection variant with cairo 
enabled and use that variant as native-input for your packages.

Something like this:

```
(define-public gobject-introspection+cairo
  (hidden-package
   (package
     (inherit gobject-introspection)
     (arguments
      (substitute-keyword-arguments (package-arguments 
gobject-introspection)
        ((#:configure-flags flags ''())
         `(cons* "-Dcairo=true" ,flags))))
     (inputs
      `(("cairo" ,cairo)
        ,@(package-inputs gobject-introspection))))))
```

Regards,
RG.
[OpenPGP_0x5F5816647F8BE551.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#49122; Package guix. (Wed, 08 Sep 2021 00:08:02 GMT) Full text and rfc822 format available.

Message #17 received at 49122 <at> debbugs.gnu.org (full text, mbox):

From: Raghav Gururajan <rg <at> raghavgururajan.name>
To: 49122 <at> debbugs.gnu.org
Subject: Re: gobject-introspection and not finding cairo
Date: Tue, 7 Sep 2021 20:07:31 -0400
[Message part 1 (text/plain, inline)]
Hi John!

> Something like this:
> 
> ```
> (define-public gobject-introspection+cairo
>    (hidden-package
>     (package
>       (inherit gobject-introspection)
>       (arguments
>        (substitute-keyword-arguments (package-arguments 
> gobject-introspection)
>          ((#:configure-flags flags ''())
>           `(cons* "-Dcairo=true" ,flags))))
>       (inputs
>        `(("cairo" ,cairo)
>          ,@(package-inputs gobject-introspection))))))
> ```

Or, something like this:

```
(define-public gobject-introspection+cairo
  (hidden-package
   (package
     (inherit gobject-introspection)
     (arguments
      (substitute-keyword-arguments (package-arguments 
gobject-introspection)
        ((#:configure-flags flags ''())
         `(append
           (list
            "-Dcairo=true"
            (string-append "-Dcairo_libname="
                           (assoc-ref %build-inputs "cairo")
                           "/lib/libcairo-gobject.so"))
           ,flags))))
     (inputs
      `(("cairo" ,cairo)
        ,@(package-inputs gobject-introspection))))))
```

Regards,
RG.
[OpenPGP_0x5F5816647F8BE551.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#49122; Package guix. (Sat, 20 Jan 2024 22:19:01 GMT) Full text and rfc822 format available.

Message #20 received at 49122 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: John Kehayias <john.kehayias <at> protonmail.com>
Cc: "49122 <at> debbugs.gnu.org" <49122 <at> debbugs.gnu.org>
Subject: Re: bug#49122: gobject-introspection and not finding cairo
Date: Sat, 20 Jan 2024 17:18:01 -0500
Hi John,

John Kehayias <john.kehayias <at> protonmail.com> writes:

> I've managed to fix the initial problem I noted, but this would depend
> on having cairo as an input so that gobject-introspection can find the
> library to patch the typelib. Unfortunately, this would be a circular
> dependency. This is a long standing issue with how cairo is handled
> here (see, e.g.,
> https://gitlab.freedesktop.org/cairo/cairo/-/issues/141).
>
> I don't know how circular dependencies are solved in guix, so I'm not
> sure what to do to fix this. gobject-introspection doesn't need cairo
> to build or function, so the build depends is not really needed other
> than to fix this bug. So this could be done with a separate package or
> in two steps?

Upstream said:

--8<---------------cut here---------------start------------->8---
The Cairo API is not really introspectable, because its type system does
not use GObject.

We could generate the introspection data by using a filter script to
turn the snake case cairo_*_t types into the expected CamelCase Cairo*
types, but it's not entirely trivial, and it would still not by usable
by anything.
--8<---------------cut here---------------end--------------->8---

Introducing an extra dependency to the closure of gobject-introspection,
we'd have applications soft-linking to potentially different versions of
cairo (cairo and cairo-sans-poppler), which seems ugly.

Could we move the cairo.gir file to the cairo package, and this would be
picked up by gobject-introspection if at the right location?

It'd differ from upstream, but that'd be cleaner.  Perhaps we could
contribute such fix for inclusion upstream too.

-- 
Thanks,
Maxim




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

Previous Next


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