* bug#49122: gobject-introspection and not finding cairo
@ 2021-06-19 18:29 John Kehayias via Bug reports for GNU Guix
2021-06-20 23:59 ` bug#49122: (No Subject) John Kehayias via Bug reports for GNU Guix
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2021-06-19 18:29 UTC (permalink / raw)
To: 49122
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#49122: (No Subject)
2021-06-19 18:29 bug#49122: gobject-introspection and not finding cairo John Kehayias via Bug reports for GNU Guix
@ 2021-06-20 23:59 ` John Kehayias via Bug reports for GNU Guix
2024-01-20 22:18 ` bug#49122: gobject-introspection and not finding cairo Maxim Cournoyer
2021-06-21 2:04 ` bug#49122: (No Subject) John Kehayias via Bug reports for GNU Guix
2021-09-07 23:06 ` bug#49122: gobject-introspection and not finding cairo Raghav Gururajan via Bug reports for GNU Guix
2 siblings, 1 reply; 6+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2021-06-20 23:59 UTC (permalink / raw)
To: 49122@debbugs.gnu.org
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?
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#49122: (No Subject)
2021-06-19 18:29 bug#49122: gobject-introspection and not finding cairo John Kehayias via Bug reports for GNU Guix
2021-06-20 23:59 ` bug#49122: (No Subject) John Kehayias via Bug reports for GNU Guix
@ 2021-06-21 2:04 ` John Kehayias via Bug reports for GNU Guix
2021-09-07 23:06 ` bug#49122: gobject-introspection and not finding cairo Raghav Gururajan via Bug reports for GNU Guix
2 siblings, 0 replies; 6+ messages in thread
From: John Kehayias via Bug reports for GNU Guix @ 2021-06-21 2:04 UTC (permalink / raw)
To: 49122@debbugs.gnu.org
[-- Attachment #1: Type: text/plain, Size: 268 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: go-cairo.patch --]
[-- Type: text/x-patch; name=go-cairo.patch, Size: 1147 bytes --]
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index 206222b578..fb3dbdecb5 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -496,6 +496,13 @@ dynamic loading, and an object system.")
(arguments
`(#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'patch
+ ;; Patch for cairo library location
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "gir/cairo-1.0.gir.in"
+ (("shared-library=\"@CAIRO_SHARED_LIBRARY@\"")
+ (string-append "shared-library=\""
+ (assoc-ref inputs "cairo") "/lib/@CAIRO_SHARED_LIBRARY@\"")))))
(add-after 'unpack 'do-not-use-/usr/bin/env
(lambda _
(substitute* "tools/g-ir-tool-template.in"
@@ -507,6 +514,7 @@ dynamic loading, and an object system.")
("pkg-config" ,pkg-config)))
(inputs
`(("bison" ,bison)
+ ("cairo" ,cairo-sans-poppler) ; break dependency loop via poppler
("flex" ,flex)
("glib" ,glib)
("python" ,python-wrapper)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#49122: gobject-introspection and not finding cairo
2021-06-19 18:29 bug#49122: gobject-introspection and not finding cairo John Kehayias via Bug reports for GNU Guix
2021-06-20 23:59 ` bug#49122: (No Subject) John Kehayias via Bug reports for GNU Guix
2021-06-21 2:04 ` bug#49122: (No Subject) John Kehayias via Bug reports for GNU Guix
@ 2021-09-07 23:06 ` Raghav Gururajan via Bug reports for GNU Guix
2021-09-08 0:07 ` Raghav Gururajan via Bug reports for GNU Guix
2 siblings, 1 reply; 6+ messages in thread
From: Raghav Gururajan via Bug reports for GNU Guix @ 2021-09-07 23:06 UTC (permalink / raw)
To: 49122
[-- Attachment #1.1.1: Type: text/plain, Size: 600 bytes --]
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.
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2649 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#49122: gobject-introspection and not finding cairo
2021-09-07 23:06 ` bug#49122: gobject-introspection and not finding cairo Raghav Gururajan via Bug reports for GNU Guix
@ 2021-09-08 0:07 ` Raghav Gururajan via Bug reports for GNU Guix
0 siblings, 0 replies; 6+ messages in thread
From: Raghav Gururajan via Bug reports for GNU Guix @ 2021-09-08 0:07 UTC (permalink / raw)
To: 49122
[-- Attachment #1.1.1: Type: text/plain, Size: 1202 bytes --]
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.
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2649 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#49122: gobject-introspection and not finding cairo
2021-06-20 23:59 ` bug#49122: (No Subject) John Kehayias via Bug reports for GNU Guix
@ 2024-01-20 22:18 ` Maxim Cournoyer
0 siblings, 0 replies; 6+ messages in thread
From: Maxim Cournoyer @ 2024-01-20 22:18 UTC (permalink / raw)
To: John Kehayias; +Cc: 49122@debbugs.gnu.org
Hi John,
John Kehayias <john.kehayias@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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-20 22:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-19 18:29 bug#49122: gobject-introspection and not finding cairo John Kehayias via Bug reports for GNU Guix
2021-06-20 23:59 ` bug#49122: (No Subject) John Kehayias via Bug reports for GNU Guix
2024-01-20 22:18 ` bug#49122: gobject-introspection and not finding cairo Maxim Cournoyer
2021-06-21 2:04 ` bug#49122: (No Subject) John Kehayias via Bug reports for GNU Guix
2021-09-07 23:06 ` bug#49122: gobject-introspection and not finding cairo Raghav Gururajan via Bug reports for GNU Guix
2021-09-08 0:07 ` Raghav Gururajan via Bug reports for GNU Guix
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).