diff mbox series

[v2,1/1] package/poppler: fix introspection build

Message ID 20220812101718.47491-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series [v2,1/1] package/poppler: fix introspection build | expand

Commit Message

Fabrice Fontaine Aug. 12, 2022, 10:17 a.m. UTC
Fix the following build failure raised since commit
9d1d4818c39d97ad7a1cdf6e075b9acae6dfff71:

[ 98%] Generating Poppler-0.18.typelib
Could not find GIR file 'GObject-2.0.gir'; check XDG_DATA_DIRS or use --includedir
error parsing file /home/giuliobenetti/autobuild/run/instance-1/output-1/build/poppler-21.12.0/glib/Poppler-0.18.gir: Failed to parse included gir GObject-2.0
If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help.
Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"

Fixes:
 - http://autobuild.buildroot.org/results/d2f50aa56410c2fff8a0538c57038104906e747e

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2:
 - Rebase on top of master
 - Use upstream commit

 ...txt-allow-the-user-to-configure-INTR.patch | 43 +++++++++++++++++++
 package/poppler/poppler.mk                    |  3 +-
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch

Comments

Thomas Petazzoni Aug. 14, 2022, 10:37 a.m. UTC | #1
Hello Fabrice,

+Adam Duskett for GOI expertise.

On Fri, 12 Aug 2022 12:17:18 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> diff --git a/package/poppler/poppler.mk b/package/poppler/poppler.mk
> index b54262e7c4..db6da25d39 100644
> --- a/package/poppler/poppler.mk
> +++ b/package/poppler/poppler.mk
> @@ -47,7 +47,8 @@ POPPLER_DEPENDENCIES += gobject-introspection
>  POPPLER_CONF_OPTS += \
>  	-DENABLE_GOBJECT_INTROSPECTION=ON \
>  	-DINTROSPECTION_SCANNER=$(STAGING_DIR)/usr/bin/g-ir-scanner \
> -	-DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler
> +	-DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler \
> +	-DINTROSPECTION_COMPILER_ARGS="--includedir=$(STAGING_DIR)/usr/share/gir-1.0"
>  else
>  POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=OFF
>  endif

I am really not familiar with all the gobject-introspection stuff, but
I'm wondering if this is the right solution for this problem.

In package/gobject-introspection/, I can see that we create and install
a g-ir-scanner wrapper that passes --add-include-path="$(dirname
"$0")"/../share/gir-1.0.

In this same directory, we also have a g-ir-compiler wrapper, which is
used to execute things in Qemu. If a special path is needed, why don't
we pass it within this wrapper, so that the solution works for all
packages?

Apparently, according to
package/libglib2/0004-meson.build-add-girdir-to-gio-2.0.pc-and-glib-2.0.pc.patch
there are some packages that set girdir in their .pc file so that other
packages now where to find the GIR files.

Really not clear in my mind how all of this should work. My only
concern is that I would like us to find and use the same solution
everywhere to solve the same problem, rather than having 10 different
solutions for each package encountering the same issue.

Thomas
Thomas Petazzoni Aug. 20, 2022, 9:28 a.m. UTC | #2
Hello Fabrice,

Do you have some feedback? Or perhaps Adam?

Thanks!

Thomas

On Sun, 14 Aug 2022 12:37:48 +0200
Thomas Petazzoni via buildroot <buildroot@buildroot.org> wrote:

> Hello Fabrice,
> 
> +Adam Duskett for GOI expertise.
> 
> On Fri, 12 Aug 2022 12:17:18 +0200
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> 
> > diff --git a/package/poppler/poppler.mk b/package/poppler/poppler.mk
> > index b54262e7c4..db6da25d39 100644
> > --- a/package/poppler/poppler.mk
> > +++ b/package/poppler/poppler.mk
> > @@ -47,7 +47,8 @@ POPPLER_DEPENDENCIES += gobject-introspection
> >  POPPLER_CONF_OPTS += \
> >  	-DENABLE_GOBJECT_INTROSPECTION=ON \
> >  	-DINTROSPECTION_SCANNER=$(STAGING_DIR)/usr/bin/g-ir-scanner \
> > -	-DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler
> > +	-DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler \
> > +	-DINTROSPECTION_COMPILER_ARGS="--includedir=$(STAGING_DIR)/usr/share/gir-1.0"
> >  else
> >  POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=OFF
> >  endif  
> 
> I am really not familiar with all the gobject-introspection stuff, but
> I'm wondering if this is the right solution for this problem.
> 
> In package/gobject-introspection/, I can see that we create and install
> a g-ir-scanner wrapper that passes --add-include-path="$(dirname
> "$0")"/../share/gir-1.0.
> 
> In this same directory, we also have a g-ir-compiler wrapper, which is
> used to execute things in Qemu. If a special path is needed, why don't
> we pass it within this wrapper, so that the solution works for all
> packages?
> 
> Apparently, according to
> package/libglib2/0004-meson.build-add-girdir-to-gio-2.0.pc-and-glib-2.0.pc.patch
> there are some packages that set girdir in their .pc file so that other
> packages now where to find the GIR files.
> 
> Really not clear in my mind how all of this should work. My only
> concern is that I would like us to find and use the same solution
> everywhere to solve the same problem, rather than having 10 different
> solutions for each package encountering the same issue.
> 
> Thomas
Adam Duskett Sept. 21, 2022, 5:38 p.m. UTC | #3
Hello;

The above patch (and the existing patch currently in package/poppler)
are both in the latest version of poppler, so this is probably safe to
apply.
However; it may be more advantageous to instead simply bump the
poppler package instead of applying more patches.

Thoughts?

Adam

On Sat, Aug 20, 2022 at 2:28 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello Fabrice,
>
> Do you have some feedback? Or perhaps Adam?
>
> Thanks!
>
> Thomas
>
> On Sun, 14 Aug 2022 12:37:48 +0200
> Thomas Petazzoni via buildroot <buildroot@buildroot.org> wrote:
>
> > Hello Fabrice,
> >
> > +Adam Duskett for GOI expertise.
> >
> > On Fri, 12 Aug 2022 12:17:18 +0200
> > Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> >
> > > diff --git a/package/poppler/poppler.mk b/package/poppler/poppler.mk
> > > index b54262e7c4..db6da25d39 100644
> > > --- a/package/poppler/poppler.mk
> > > +++ b/package/poppler/poppler.mk
> > > @@ -47,7 +47,8 @@ POPPLER_DEPENDENCIES += gobject-introspection
> > >  POPPLER_CONF_OPTS += \
> > >     -DENABLE_GOBJECT_INTROSPECTION=ON \
> > >     -DINTROSPECTION_SCANNER=$(STAGING_DIR)/usr/bin/g-ir-scanner \
> > > -   -DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler
> > > +   -DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler \
> > > +   -DINTROSPECTION_COMPILER_ARGS="--includedir=$(STAGING_DIR)/usr/share/gir-1.0"
> > >  else
> > >  POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=OFF
> > >  endif
> >
> > I am really not familiar with all the gobject-introspection stuff, but
> > I'm wondering if this is the right solution for this problem.
> >
> > In package/gobject-introspection/, I can see that we create and install
> > a g-ir-scanner wrapper that passes --add-include-path="$(dirname
> > "$0")"/../share/gir-1.0.
> >
> > In this same directory, we also have a g-ir-compiler wrapper, which is
> > used to execute things in Qemu. If a special path is needed, why don't
> > we pass it within this wrapper, so that the solution works for all
> > packages?
> >
> > Apparently, according to
> > package/libglib2/0004-meson.build-add-girdir-to-gio-2.0.pc-and-glib-2.0.pc.patch
> > there are some packages that set girdir in their .pc file so that other
> > packages now where to find the GIR files.
> >
> > Really not clear in my mind how all of this should work. My only
> > concern is that I would like us to find and use the same solution
> > everywhere to solve the same problem, rather than having 10 different
> > solutions for each package encountering the same issue.
> >
> > Thomas
>
>
>
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
Fabrice Fontaine Sept. 21, 2022, 8:41 p.m. UTC | #4
Hi Adam,

Bumping poppler will not been enough to fix the build failure.
--includedir=$(STAGING_DIR)/usr/share/gir-1.0 will also have to be passed
in -DINTROSPECTION_COMPILER_ARGS or do you think that g-ir-scanner wrapper
must handle this as suggested by Thomas above?

Best Regards,

Fabrice

Le mer. 21 sept. 2022 à 19:38, Adam Duskett <aduskett@gmail.com> a écrit :

> Hello;
>
> The above patch (and the existing patch currently in package/poppler)
> are both in the latest version of poppler, so this is probably safe to
> apply.
> However; it may be more advantageous to instead simply bump the
> poppler package instead of applying more patches.
>
> Thoughts?
>
> Adam
>
> On Sat, Aug 20, 2022 at 2:28 AM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
> >
> > Hello Fabrice,
> >
> > Do you have some feedback? Or perhaps Adam?
> >
> > Thanks!
> >
> > Thomas
> >
> > On Sun, 14 Aug 2022 12:37:48 +0200
> > Thomas Petazzoni via buildroot <buildroot@buildroot.org> wrote:
> >
> > > Hello Fabrice,
> > >
> > > +Adam Duskett for GOI expertise.
> > >
> > > On Fri, 12 Aug 2022 12:17:18 +0200
> > > Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> > >
> > > > diff --git a/package/poppler/poppler.mk b/package/poppler/poppler.mk
> > > > index b54262e7c4..db6da25d39 100644
> > > > --- a/package/poppler/poppler.mk
> > > > +++ b/package/poppler/poppler.mk
> > > > @@ -47,7 +47,8 @@ POPPLER_DEPENDENCIES += gobject-introspection
> > > >  POPPLER_CONF_OPTS += \
> > > >     -DENABLE_GOBJECT_INTROSPECTION=ON \
> > > >     -DINTROSPECTION_SCANNER=$(STAGING_DIR)/usr/bin/g-ir-scanner \
> > > > -   -DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler
> > > > +   -DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler \
> > > > +
>  -DINTROSPECTION_COMPILER_ARGS="--includedir=$(STAGING_DIR)/usr/share/gir-1.0"
> > > >  else
> > > >  POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=OFF
> > > >  endif
> > >
> > > I am really not familiar with all the gobject-introspection stuff, but
> > > I'm wondering if this is the right solution for this problem.
> > >
> > > In package/gobject-introspection/, I can see that we create and install
> > > a g-ir-scanner wrapper that passes --add-include-path="$(dirname
> > > "$0")"/../share/gir-1.0.
> > >
> > > In this same directory, we also have a g-ir-compiler wrapper, which is
> > > used to execute things in Qemu. If a special path is needed, why don't
> > > we pass it within this wrapper, so that the solution works for all
> > > packages?
> > >
> > > Apparently, according to
> > >
> package/libglib2/0004-meson.build-add-girdir-to-gio-2.0.pc-and-glib-2.0.pc.patch
> > > there are some packages that set girdir in their .pc file so that other
> > > packages now where to find the GIR files.
> > >
> > > Really not clear in my mind how all of this should work. My only
> > > concern is that I would like us to find and use the same solution
> > > everywhere to solve the same problem, rather than having 10 different
> > > solutions for each package encountering the same issue.
> > >
> > > Thomas
> >
> >
> >
> > --
> > Thomas Petazzoni, co-owner and CEO, Bootlin
> > Embedded Linux and Kernel engineering and training
> > https://bootlin.com
>
Adam Duskett Sept. 27, 2022, 6:33 p.m. UTC | #5
Hello Fabrice;

Sorry for the late reply, I had a cold which I didn't expect to make
me feel so terrible!
I should have been more clear in my earlier response. My suggestion is:

- Bump poppler
- Add -DINTROSPECTION_COMPILER_ARGS=--includedir=$(STAGING_DIR)/usr/share/gir-1.0

It's the simplest solution to the problem and avoids adding a new
patch while removing an old patch.

Thanks!

Adam

On Wed, Sep 21, 2022 at 1:41 PM Fabrice Fontaine
<fontaine.fabrice@gmail.com> wrote:
>
> Hi Adam,
>
> Bumping poppler will not been enough to fix the build failure.
> --includedir=$(STAGING_DIR)/usr/share/gir-1.0 will also have to be passed in -DINTROSPECTION_COMPILER_ARGS or do you think that g-ir-scanner wrapper must handle this as suggested by Thomas above?
>
> Best Regards,
>
> Fabrice
>
> Le mer. 21 sept. 2022 à 19:38, Adam Duskett <aduskett@gmail.com> a écrit :
>>
>> Hello;
>>
>> The above patch (and the existing patch currently in package/poppler)
>> are both in the latest version of poppler, so this is probably safe to
>> apply.
>> However; it may be more advantageous to instead simply bump the
>> poppler package instead of applying more patches.
>>
>> Thoughts?
>>
>> Adam
>>
>> On Sat, Aug 20, 2022 at 2:28 AM Thomas Petazzoni
>> <thomas.petazzoni@bootlin.com> wrote:
>> >
>> > Hello Fabrice,
>> >
>> > Do you have some feedback? Or perhaps Adam?
>> >
>> > Thanks!
>> >
>> > Thomas
>> >
>> > On Sun, 14 Aug 2022 12:37:48 +0200
>> > Thomas Petazzoni via buildroot <buildroot@buildroot.org> wrote:
>> >
>> > > Hello Fabrice,
>> > >
>> > > +Adam Duskett for GOI expertise.
>> > >
>> > > On Fri, 12 Aug 2022 12:17:18 +0200
>> > > Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>> > >
>> > > > diff --git a/package/poppler/poppler.mk b/package/poppler/poppler.mk
>> > > > index b54262e7c4..db6da25d39 100644
>> > > > --- a/package/poppler/poppler.mk
>> > > > +++ b/package/poppler/poppler.mk
>> > > > @@ -47,7 +47,8 @@ POPPLER_DEPENDENCIES += gobject-introspection
>> > > >  POPPLER_CONF_OPTS += \
>> > > >     -DENABLE_GOBJECT_INTROSPECTION=ON \
>> > > >     -DINTROSPECTION_SCANNER=$(STAGING_DIR)/usr/bin/g-ir-scanner \
>> > > > -   -DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler
>> > > > +   -DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler \
>> > > > +   -DINTROSPECTION_COMPILER_ARGS="--includedir=$(STAGING_DIR)/usr/share/gir-1.0"
>> > > >  else
>> > > >  POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=OFF
>> > > >  endif
>> > >
>> > > I am really not familiar with all the gobject-introspection stuff, but
>> > > I'm wondering if this is the right solution for this problem.
>> > >
>> > > In package/gobject-introspection/, I can see that we create and install
>> > > a g-ir-scanner wrapper that passes --add-include-path="$(dirname
>> > > "$0")"/../share/gir-1.0.
>> > >
>> > > In this same directory, we also have a g-ir-compiler wrapper, which is
>> > > used to execute things in Qemu. If a special path is needed, why don't
>> > > we pass it within this wrapper, so that the solution works for all
>> > > packages?
>> > >
>> > > Apparently, according to
>> > > package/libglib2/0004-meson.build-add-girdir-to-gio-2.0.pc-and-glib-2.0.pc.patch
>> > > there are some packages that set girdir in their .pc file so that other
>> > > packages now where to find the GIR files.
>> > >
>> > > Really not clear in my mind how all of this should work. My only
>> > > concern is that I would like us to find and use the same solution
>> > > everywhere to solve the same problem, rather than having 10 different
>> > > solutions for each package encountering the same issue.
>> > >
>> > > Thomas
>> >
>> >
>> >
>> > --
>> > Thomas Petazzoni, co-owner and CEO, Bootlin
>> > Embedded Linux and Kernel engineering and training
>> > https://bootlin.com
Yann E. MORIN April 15, 2023, 9:29 p.m. UTC | #6
Fabrice, All,

+Adam for your insight in GOI

On 2022-08-12 12:17 +0200, Fabrice Fontaine spake thusly:
> Fix the following build failure raised since commit
> 9d1d4818c39d97ad7a1cdf6e075b9acae6dfff71:
> 
> [ 98%] Generating Poppler-0.18.typelib
> Could not find GIR file 'GObject-2.0.gir'; check XDG_DATA_DIRS or use --includedir
> error parsing file /home/giuliobenetti/autobuild/run/instance-1/output-1/build/poppler-21.12.0/glib/Poppler-0.18.gir: Failed to parse included gir GObject-2.0
> If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help.
> Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/d2f50aa56410c2fff8a0538c57038104906e747e
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Sorry for the long delay, I had a look tonight...

I could not find the underlying reason why g-ir-compiler (through our
wrapper) could not find the directory with all the gir files.

Given that poppler is so far the only affect package, and since your
patch was accepted upstream, I think it is only reasonable that we do
indeed use this change. So..

Applied to master, thanks.

However, I would really like to understand why we don't have more
packages that are broken. Is it because poppler is the only one with
include directives in his gir file, which means it needs access to the
installed gir files from other packages (those from goi)?

Or is it because it is the only one that already passes an explicit
--includedir option to g-ir-compiler, and that disables searching the
standard directory?

As Thomas also suggested, should we be doing that systematically in our
g-ir-compiler wrapper?

I know Adam said your change was "the simplest solution to the problem".
Still, this is not very satisfying...

Regards,
Yann E. MORIN.

> ---
> Changes v1 -> v2:
>  - Rebase on top of master
>  - Use upstream commit
> 
>  ...txt-allow-the-user-to-configure-INTR.patch | 43 +++++++++++++++++++
>  package/poppler/poppler.mk                    |  3 +-
>  2 files changed, 45 insertions(+), 1 deletion(-)
>  create mode 100644 package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> 
> diff --git a/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> new file mode 100644
> index 0000000000..079cf7234d
> --- /dev/null
> +++ b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> @@ -0,0 +1,43 @@
> +From e9d5731ba254f35e2d94b628c51e48c50a945271 Mon Sep 17 00:00:00 2001
> +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +Date: Mon, 24 Jan 2022 09:28:20 +0100
> +Subject: [PATCH] glib/CMakeLists.txt: allow the user to configure
> + INTROSPECTION_COMPILER_ARGS
> +
> +Allow the user to add its own parameters such as
> +--includedir=$(STAGING_DIR)/usr/share/gir-1.0 to
> +INTROSPECTION_COMPILER_ARGS to avoid the following build failure when
> +cross-compiling with buildroot:
> +
> +[ 98%] Generating Poppler-0.18.typelib
> +Could not find GIR file 'GObject-2.0.gir'; check XDG_DATA_DIRS or use --includedir
> +error parsing file /home/giuliobenetti/autobuild/run/instance-1/output-1/build/poppler-21.12.0/glib/Poppler-0.18.gir: Failed to parse included gir GObject-2.0
> +If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help.
> +Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"
> +
> +Fixes:
> + - http://autobuild.buildroot.org/results/d2f50aa56410c2fff8a0538c57038104906e747e
> +
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +[Retrieved from:
> +https://gitlab.freedesktop.org/poppler/poppler/-/commit/e9d5731ba254f35e2d94b628c51e48c50a945271]
> +---
> + glib/CMakeLists.txt | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
> +index 7510e69ee..f5130e3c9 100644
> +--- a/glib/CMakeLists.txt
> ++++ b/glib/CMakeLists.txt
> +@@ -119,7 +119,7 @@ if (HAVE_INTROSPECTION AND BUILD_SHARED_LIBS)
> +   # General gir: Reset object-list for introspection & load tool args
> +   set(INTROSPECTION_GIRS)
> +   set(INTROSPECTION_SCANNER_ARGS "--add-include-path=${CMAKE_CURRENT_SOURCE_DIR}" "--warn-all")
> +-  set(INTROSPECTION_COMPILER_ARGS "--includedir=${CMAKE_CURRENT_SOURCE_DIR}")
> ++  set(INTROSPECTION_COMPILER_ARGS ${INTROSPECTION_COMPILER_ARGS} "--includedir=${CMAKE_CURRENT_SOURCE_DIR}")
> + 
> +   # Poppler: Assign package to gir & export keys
> +   set(Poppler_0_18_gir "poppler-glib")
> +-- 
> +GitLab
> +
> diff --git a/package/poppler/poppler.mk b/package/poppler/poppler.mk
> index b54262e7c4..db6da25d39 100644
> --- a/package/poppler/poppler.mk
> +++ b/package/poppler/poppler.mk
> @@ -47,7 +47,8 @@ POPPLER_DEPENDENCIES += gobject-introspection
>  POPPLER_CONF_OPTS += \
>  	-DENABLE_GOBJECT_INTROSPECTION=ON \
>  	-DINTROSPECTION_SCANNER=$(STAGING_DIR)/usr/bin/g-ir-scanner \
> -	-DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler
> +	-DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler \
> +	-DINTROSPECTION_COMPILER_ARGS="--includedir=$(STAGING_DIR)/usr/share/gir-1.0"
>  else
>  POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=OFF
>  endif
> -- 
> 2.35.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
James Hilliard April 16, 2023, 2:44 a.m. UTC | #7
On Sat, Apr 15, 2023 at 3:30 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> Fabrice, All,
>
> +Adam for your insight in GOI
>
> On 2022-08-12 12:17 +0200, Fabrice Fontaine spake thusly:
> > Fix the following build failure raised since commit
> > 9d1d4818c39d97ad7a1cdf6e075b9acae6dfff71:
> >
> > [ 98%] Generating Poppler-0.18.typelib
> > Could not find GIR file 'GObject-2.0.gir'; check XDG_DATA_DIRS or use --includedir
> > error parsing file /home/giuliobenetti/autobuild/run/instance-1/output-1/build/poppler-21.12.0/glib/Poppler-0.18.gir: Failed to parse included gir GObject-2.0
> > If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help.
> > Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"
> >
> > Fixes:
> >  - http://autobuild.buildroot.org/results/d2f50aa56410c2fff8a0538c57038104906e747e
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>
> Sorry for the long delay, I had a look tonight...
>
> I could not find the underlying reason why g-ir-compiler (through our
> wrapper) could not find the directory with all the gir files.
>
> Given that poppler is so far the only affect package, and since your
> patch was accepted upstream, I think it is only reasonable that we do
> indeed use this change. So..
>
> Applied to master, thanks.
>
> However, I would really like to understand why we don't have more
> packages that are broken. Is it because poppler is the only one with
> include directives in his gir file, which means it needs access to the
> installed gir files from other packages (those from goi)?
>
> Or is it because it is the only one that already passes an explicit
> --includedir option to g-ir-compiler, and that disables searching the
> standard directory?

From the looks of it most of our packages with a gobject-introspection
dependency are meson based which use the native meson integration.

https://gi.readthedocs.io/en/latest/buildsystems/meson.html

From my understanding there is no standardized cmake
gobject-introspection integration so there's more likely to be bugs that only
affect say one package for cmake packages.

>
> As Thomas also suggested, should we be doing that systematically in our
> g-ir-compiler wrapper?

I'm thinking it's probably not needed as it's likely a package specific issue
and could interfere with meson's gobject-introspection integration.

>
> I know Adam said your change was "the simplest solution to the problem".
> Still, this is not very satisfying...
>
> Regards,
> Yann E. MORIN.
>
> > ---
> > Changes v1 -> v2:
> >  - Rebase on top of master
> >  - Use upstream commit
> >
> >  ...txt-allow-the-user-to-configure-INTR.patch | 43 +++++++++++++++++++
> >  package/poppler/poppler.mk                    |  3 +-
> >  2 files changed, 45 insertions(+), 1 deletion(-)
> >  create mode 100644 package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> >
> > diff --git a/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> > new file mode 100644
> > index 0000000000..079cf7234d
> > --- /dev/null
> > +++ b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> > @@ -0,0 +1,43 @@
> > +From e9d5731ba254f35e2d94b628c51e48c50a945271 Mon Sep 17 00:00:00 2001
> > +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > +Date: Mon, 24 Jan 2022 09:28:20 +0100
> > +Subject: [PATCH] glib/CMakeLists.txt: allow the user to configure
> > + INTROSPECTION_COMPILER_ARGS
> > +
> > +Allow the user to add its own parameters such as
> > +--includedir=$(STAGING_DIR)/usr/share/gir-1.0 to
> > +INTROSPECTION_COMPILER_ARGS to avoid the following build failure when
> > +cross-compiling with buildroot:
> > +
> > +[ 98%] Generating Poppler-0.18.typelib
> > +Could not find GIR file 'GObject-2.0.gir'; check XDG_DATA_DIRS or use --includedir
> > +error parsing file /home/giuliobenetti/autobuild/run/instance-1/output-1/build/poppler-21.12.0/glib/Poppler-0.18.gir: Failed to parse included gir GObject-2.0
> > +If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help.
> > +Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"
> > +
> > +Fixes:
> > + - http://autobuild.buildroot.org/results/d2f50aa56410c2fff8a0538c57038104906e747e
> > +
> > +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > +[Retrieved from:
> > +https://gitlab.freedesktop.org/poppler/poppler/-/commit/e9d5731ba254f35e2d94b628c51e48c50a945271]
> > +---
> > + glib/CMakeLists.txt | 2 +-
> > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
> > +index 7510e69ee..f5130e3c9 100644
> > +--- a/glib/CMakeLists.txt
> > ++++ b/glib/CMakeLists.txt
> > +@@ -119,7 +119,7 @@ if (HAVE_INTROSPECTION AND BUILD_SHARED_LIBS)
> > +   # General gir: Reset object-list for introspection & load tool args
> > +   set(INTROSPECTION_GIRS)
> > +   set(INTROSPECTION_SCANNER_ARGS "--add-include-path=${CMAKE_CURRENT_SOURCE_DIR}" "--warn-all")
> > +-  set(INTROSPECTION_COMPILER_ARGS "--includedir=${CMAKE_CURRENT_SOURCE_DIR}")
> > ++  set(INTROSPECTION_COMPILER_ARGS ${INTROSPECTION_COMPILER_ARGS} "--includedir=${CMAKE_CURRENT_SOURCE_DIR}")
> > +
> > +   # Poppler: Assign package to gir & export keys
> > +   set(Poppler_0_18_gir "poppler-glib")
> > +--
> > +GitLab
> > +
> > diff --git a/package/poppler/poppler.mk b/package/poppler/poppler.mk
> > index b54262e7c4..db6da25d39 100644
> > --- a/package/poppler/poppler.mk
> > +++ b/package/poppler/poppler.mk
> > @@ -47,7 +47,8 @@ POPPLER_DEPENDENCIES += gobject-introspection
> >  POPPLER_CONF_OPTS += \
> >       -DENABLE_GOBJECT_INTROSPECTION=ON \
> >       -DINTROSPECTION_SCANNER=$(STAGING_DIR)/usr/bin/g-ir-scanner \
> > -     -DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler
> > +     -DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler \
> > +     -DINTROSPECTION_COMPILER_ARGS="--includedir=$(STAGING_DIR)/usr/share/gir-1.0"
> >  else
> >  POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=OFF
> >  endif
> > --
> > 2.35.1
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN April 16, 2023, 8:25 a.m. UTC | #8
James, All,

On 2023-04-15 20:44 -0600, James Hilliard spake thusly:
> On Sat, Apr 15, 2023 at 3:30 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
[--SNIP--]
> > However, I would really like to understand why we don't have more
> > packages that are broken. Is it because poppler is the only one with
> > include directives in his gir file, which means it needs access to the
> > installed gir files from other packages (those from goi)?
> >
> > Or is it because it is the only one that already passes an explicit
> > --includedir option to g-ir-compiler, and that disables searching the
> > standard directory?
> 
> From the looks of it most of our packages with a gobject-introspection
> dependency are meson based which use the native meson integration.

Ah, good point, that would explain.

We have 33 (target) packages that use meson, and 12 that don't; that's
25%, not a small part. But lets look at those:

    $ grep -E '\$\(eval \$\([^-]+-package\)\)' \
        $(git grep -l gobject-introspection '*.mk') \
      |grep -v meson
    package/gconf/gconf.mk:$(eval $(autotools-package))
    package/libffi/libffi.mk:$(eval $(autotools-package))
    package/libgee/libgee.mk:$(eval $(autotools-package))
    package/libgtk2/libgtk2.mk:$(eval $(autotools-package))
    package/libostree/libostree.mk:$(eval $(autotools-package))
    package/libqrtr-glib/libqrtr-glib.mk:$(eval $(autotools-package))
    package/librsvg/librsvg.mk:$(eval $(autotools-package))
    package/libvips/libvips.mk:$(eval $(autotools-package))
    package/midori/midori.mk:$(eval $(cmake-package))
    package/nodejs/nodejs.mk:$(eval $(generic-package))
    package/poppler/poppler.mk:$(eval $(cmake-package))
    package/webkitgtk/webkitgtk.mk:$(eval $(cmake-package))

So, a generic, 3 cmake, the rest is autotools.

  - poppler we just fixed

  - nodejs is a false positive, goi only appears in a comment.

  - midori hasn't failed since 2021-08-22, but hasn't succeed since
    2020-04-19 either... The last config that had midori enabled was in
    2022-10-19 and failed for another reason. I've started a build
    locally...

  - webkitgtk hasn't failed since 2022-11-13, but hasn't succeeded since
    2021-12-07 either... There have been recent configs with webkitgtk
    enabled since 2022-11-13, but they failed for other reasons. I've
    started a build here...

  - I got bored investigating on the autotools packages, so I started a
    build here, with as many enabled as possible (a few were missing
    arch supports, as I'm resuing the failed config as reported by
    Fabrice, which is on riscv...)

> https://gi.readthedocs.io/en/latest/buildsystems/meson.html
> From my understanding there is no standardized cmake
> gobject-introspection integration so there's more likely to be bugs that only
> affect say one package for cmake packages.

OK, that makes sense: the poppler fix is really an exception, so we do
not need to catter for that in the wrapper.

Thanks for your feedback!

Regards,
Yann E. MORIN.

> > As Thomas also suggested, should we be doing that systematically in our
> > g-ir-compiler wrapper?
> 
> I'm thinking it's probably not needed as it's likely a package specific issue
> and could interfere with meson's gobject-introspection integration.
> 
> >
> > I know Adam said your change was "the simplest solution to the problem".
> > Still, this is not very satisfying...
> >
> > Regards,
> > Yann E. MORIN.
> >
> > > ---
> > > Changes v1 -> v2:
> > >  - Rebase on top of master
> > >  - Use upstream commit
> > >
> > >  ...txt-allow-the-user-to-configure-INTR.patch | 43 +++++++++++++++++++
> > >  package/poppler/poppler.mk                    |  3 +-
> > >  2 files changed, 45 insertions(+), 1 deletion(-)
> > >  create mode 100644 package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> > >
> > > diff --git a/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> > > new file mode 100644
> > > index 0000000000..079cf7234d
> > > --- /dev/null
> > > +++ b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> > > @@ -0,0 +1,43 @@
> > > +From e9d5731ba254f35e2d94b628c51e48c50a945271 Mon Sep 17 00:00:00 2001
> > > +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > > +Date: Mon, 24 Jan 2022 09:28:20 +0100
> > > +Subject: [PATCH] glib/CMakeLists.txt: allow the user to configure
> > > + INTROSPECTION_COMPILER_ARGS
> > > +
> > > +Allow the user to add its own parameters such as
> > > +--includedir=$(STAGING_DIR)/usr/share/gir-1.0 to
> > > +INTROSPECTION_COMPILER_ARGS to avoid the following build failure when
> > > +cross-compiling with buildroot:
> > > +
> > > +[ 98%] Generating Poppler-0.18.typelib
> > > +Could not find GIR file 'GObject-2.0.gir'; check XDG_DATA_DIRS or use --includedir
> > > +error parsing file /home/giuliobenetti/autobuild/run/instance-1/output-1/build/poppler-21.12.0/glib/Poppler-0.18.gir: Failed to parse included gir GObject-2.0
> > > +If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help.
> > > +Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"
> > > +
> > > +Fixes:
> > > + - http://autobuild.buildroot.org/results/d2f50aa56410c2fff8a0538c57038104906e747e
> > > +
> > > +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > > +[Retrieved from:
> > > +https://gitlab.freedesktop.org/poppler/poppler/-/commit/e9d5731ba254f35e2d94b628c51e48c50a945271]
> > > +---
> > > + glib/CMakeLists.txt | 2 +-
> > > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > > +
> > > +diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
> > > +index 7510e69ee..f5130e3c9 100644
> > > +--- a/glib/CMakeLists.txt
> > > ++++ b/glib/CMakeLists.txt
> > > +@@ -119,7 +119,7 @@ if (HAVE_INTROSPECTION AND BUILD_SHARED_LIBS)
> > > +   # General gir: Reset object-list for introspection & load tool args
> > > +   set(INTROSPECTION_GIRS)
> > > +   set(INTROSPECTION_SCANNER_ARGS "--add-include-path=${CMAKE_CURRENT_SOURCE_DIR}" "--warn-all")
> > > +-  set(INTROSPECTION_COMPILER_ARGS "--includedir=${CMAKE_CURRENT_SOURCE_DIR}")
> > > ++  set(INTROSPECTION_COMPILER_ARGS ${INTROSPECTION_COMPILER_ARGS} "--includedir=${CMAKE_CURRENT_SOURCE_DIR}")
> > > +
> > > +   # Poppler: Assign package to gir & export keys
> > > +   set(Poppler_0_18_gir "poppler-glib")
> > > +--
> > > +GitLab
> > > +
> > > diff --git a/package/poppler/poppler.mk b/package/poppler/poppler.mk
> > > index b54262e7c4..db6da25d39 100644
> > > --- a/package/poppler/poppler.mk
> > > +++ b/package/poppler/poppler.mk
> > > @@ -47,7 +47,8 @@ POPPLER_DEPENDENCIES += gobject-introspection
> > >  POPPLER_CONF_OPTS += \
> > >       -DENABLE_GOBJECT_INTROSPECTION=ON \
> > >       -DINTROSPECTION_SCANNER=$(STAGING_DIR)/usr/bin/g-ir-scanner \
> > > -     -DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler
> > > +     -DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler \
> > > +     -DINTROSPECTION_COMPILER_ARGS="--includedir=$(STAGING_DIR)/usr/share/gir-1.0"
> > >  else
> > >  POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=OFF
> > >  endif
> > > --
> > > 2.35.1
> > >
> > > _______________________________________________
> > > buildroot mailing list
> > > buildroot@buildroot.org
> > > https://lists.buildroot.org/mailman/listinfo/buildroot
> >
> > --
> > .-----------------.--------------------.------------------.--------------------.
> > |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> > | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> > | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> > | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> > '------------------------------^-------^------------------^--------------------'
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN April 16, 2023, 11:16 a.m. UTC | #9
James, All,

On 2023-04-16 10:25 +0200, Yann E. MORIN spake thusly:
> On 2023-04-15 20:44 -0600, James Hilliard spake thusly:
> > On Sat, Apr 15, 2023 at 3:30 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> [--SNIP--]
> > > However, I would really like to understand why we don't have more
> > > packages that are broken. Is it because poppler is the only one with
> > > include directives in his gir file, which means it needs access to the
> > > installed gir files from other packages (those from goi)?
> > >
> > > Or is it because it is the only one that already passes an explicit
> > > --includedir option to g-ir-compiler, and that disables searching the
> > > standard directory?
> > From the looks of it most of our packages with a gobject-introspection
> > dependency are meson based which use the native meson integration.
> Ah, good point, that would explain.

Unfortuantely, that assumption is wrong: granite uses meson, but fails
in the same way:

    [51/275] Generating lib/Granite-1.0.typelib with a custom command
    FAILED: lib/Granite-1.0.typelibi
    /home/ymorin/dev/buildroot/O/master/per-package/granite/host/riscv32-buildroot-linux-gnu/sysroot/usr/bin/g-ir-compiler --shared-library libgranite.so.6.0.0 --output lib/Granite-1.0.typelib /home/ymorin/dev/buildroot/O/master/build/granite-6.0.0/build/lib/Granite-1.0.gir
    Could not find GIR file 'GLib-2.0.gir'; check XDG_DATA_DIRS or use --includedir
    error parsing file /home/ymorin/dev/buildroot/O/master/build/granite-6.0.0/build/lib/Granite-1.0.gir:
    Failed to parse included gir GLib-2.0
    If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help.
    Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"
    ninja: build stopped: subcommand failed.
    make[1]: *** [package/pkg-generic.mk:293: /home/ymorin/dev/buildroot/O/master/build/granite-6.0.0/.stamp_built] Error 1

Regards,
Yann E. MORIN.
James Hilliard April 18, 2023, 8:03 a.m. UTC | #10
On Sun, Apr 16, 2023 at 5:17 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> James, All,
>
> On 2023-04-16 10:25 +0200, Yann E. MORIN spake thusly:
> > On 2023-04-15 20:44 -0600, James Hilliard spake thusly:
> > > On Sat, Apr 15, 2023 at 3:30 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > [--SNIP--]
> > > > However, I would really like to understand why we don't have more
> > > > packages that are broken. Is it because poppler is the only one with
> > > > include directives in his gir file, which means it needs access to the
> > > > installed gir files from other packages (those from goi)?
> > > >
> > > > Or is it because it is the only one that already passes an explicit
> > > > --includedir option to g-ir-compiler, and that disables searching the
> > > > standard directory?
> > > From the looks of it most of our packages with a gobject-introspection
> > > dependency are meson based which use the native meson integration.
> > Ah, good point, that would explain.
>
> Unfortuantely, that assumption is wrong: granite uses meson, but fails
> in the same way:

While it's true it does use meson...it does not in fact use the native meson
integration but rather uses a project specific gobject-introspection generator:
https://github.com/elementary/granite/blob/6.0.0/lib/meson.build#L102-L121

>
>     [51/275] Generating lib/Granite-1.0.typelib with a custom command
>     FAILED: lib/Granite-1.0.typelibi
>     /home/ymorin/dev/buildroot/O/master/per-package/granite/host/riscv32-buildroot-linux-gnu/sysroot/usr/bin/g-ir-compiler --shared-library libgranite.so.6.0.0 --output lib/Granite-1.0.typelib /home/ymorin/dev/buildroot/O/master/build/granite-6.0.0/build/lib/Granite-1.0.gir
>     Could not find GIR file 'GLib-2.0.gir'; check XDG_DATA_DIRS or use --includedir
>     error parsing file /home/ymorin/dev/buildroot/O/master/build/granite-6.0.0/build/lib/Granite-1.0.gir:
>     Failed to parse included gir GLib-2.0
>     If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help.
>     Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"
>     ninja: build stopped: subcommand failed.
>     make[1]: *** [package/pkg-generic.mk:293: /home/ymorin/dev/buildroot/O/master/build/granite-6.0.0/.stamp_built] Error 1
>
> Regards,
> Yann E. MORIN.
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
Yann E. MORIN April 18, 2023, 5:44 p.m. UTC | #11
James, All,

On 2023-04-18 02:03 -0600, James Hilliard spake thusly:
> On Sun, Apr 16, 2023 at 5:17 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > On 2023-04-16 10:25 +0200, Yann E. MORIN spake thusly:
> > > On 2023-04-15 20:44 -0600, James Hilliard spake thusly:
> > > > On Sat, Apr 15, 2023 at 3:30 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > > [--SNIP--]
> > > > > However, I would really like to understand why we don't have more
> > > > > packages that are broken. Is it because poppler is the only one with
> > > > > include directives in his gir file, which means it needs access to the
> > > > > installed gir files from other packages (those from goi)?
> > > > >
> > > > > Or is it because it is the only one that already passes an explicit
> > > > > --includedir option to g-ir-compiler, and that disables searching the
> > > > > standard directory?
> > > > From the looks of it most of our packages with a gobject-introspection
> > > > dependency are meson based which use the native meson integration.
> > > Ah, good point, that would explain.
> > Unfortuantely, that assumption is wrong: granite uses meson, but fails
> > in the same way:
> While it's true it does use meson...it does not in fact use the native meson
> integration but rather uses a project specific gobject-introspection generator:
> https://github.com/elementary/granite/blob/6.0.0/lib/meson.build#L102-L121

Sure, but then maybe it begs for a generic solution, that works for all
packages?

Maybe something like we used GIR_EXTRA_LIBS_PATH from the environment,
we could allow paclages to specify additional include directories with
GIR_EXTRA_INCLUDE_PATH ?

Regards,
Yann E. MORIN.
James Hilliard April 18, 2023, 9:58 p.m. UTC | #12
On Tue, Apr 18, 2023 at 11:44 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> James, All,
>
> On 2023-04-18 02:03 -0600, James Hilliard spake thusly:
> > On Sun, Apr 16, 2023 at 5:17 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > > On 2023-04-16 10:25 +0200, Yann E. MORIN spake thusly:
> > > > On 2023-04-15 20:44 -0600, James Hilliard spake thusly:
> > > > > On Sat, Apr 15, 2023 at 3:30 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > > > [--SNIP--]
> > > > > > However, I would really like to understand why we don't have more
> > > > > > packages that are broken. Is it because poppler is the only one with
> > > > > > include directives in his gir file, which means it needs access to the
> > > > > > installed gir files from other packages (those from goi)?
> > > > > >
> > > > > > Or is it because it is the only one that already passes an explicit
> > > > > > --includedir option to g-ir-compiler, and that disables searching the
> > > > > > standard directory?
> > > > > From the looks of it most of our packages with a gobject-introspection
> > > > > dependency are meson based which use the native meson integration.
> > > > Ah, good point, that would explain.
> > > Unfortuantely, that assumption is wrong: granite uses meson, but fails
> > > in the same way:
> > While it's true it does use meson...it does not in fact use the native meson
> > integration but rather uses a project specific gobject-introspection generator:
> > https://github.com/elementary/granite/blob/6.0.0/lib/meson.build#L102-L121
>
> Sure, but then maybe it begs for a generic solution, that works for all
> packages?

I reported this issue upstream to granite:
https://github.com/elementary/granite/issues/645

>
> Maybe something like we used GIR_EXTRA_LIBS_PATH from the environment,
> we could allow paclages to specify additional include directories with
> GIR_EXTRA_INCLUDE_PATH ?

I'm not really sure if this makes sense to do for all packages as it
could have side
effects which may interfere with meson's native gobject-introspection
integration.

>
> Regards,
> Yann E. MORIN.
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
Yann E. MORIN April 19, 2023, 7:50 p.m. UTC | #13
James, All,

On 2023-04-18 15:58 -0600, James Hilliard spake thusly:
> On Tue, Apr 18, 2023 at 11:44 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > On 2023-04-18 02:03 -0600, James Hilliard spake thusly:
> > > On Sun, Apr 16, 2023 at 5:17 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > > > On 2023-04-16 10:25 +0200, Yann E. MORIN spake thusly:
> > Sure, but then maybe it begs for a generic solution, that works for all
> > packages?
> I reported this issue upstream to granite:
> https://github.com/elementary/granite/issues/645

Thanks for beinging this upstream; They have explained why they can't
use the "standard meson way", and the solution does not seem to be
straightforward, so we'll definitely will have to have a way to
workaround that.

Also, nothing would prevent any other cmake-based package to use
introspection, and that would be similarly broken...

> > Maybe something like we used GIR_EXTRA_LIBS_PATH from the environment,
> > we could allow paclages to specify additional include directories with
> > GIR_EXTRA_INCLUDE_PATH ?
> I'm not really sure if this makes sense to do for all packages as it
> could have side
> effects which may interfere with meson's native gobject-introspection
> integration.

As I said, it would not be for *all* packages, but only for those that
actually set GIR_EXTRA_INCLUDE_PATH; it would be handled the same way
we currently handle GIR_EXTRA_LIBS_PATH: if a package needs a special
path to find libraries, it can set GIR_EXTRA_LIBS_PATH [0] in its
environment, e.g.:

    FOO_ENV += GIR_EXTRA_LIBS_PATH=$(@D)/src/.libs

And that will be automatically added to the library search path in our
g-ir-scanner wrappers:

    package/gobject-introspection/g-ir-scanner-qemuwrapper.in
    package/gobject-introspection/g-ir-scanner.in

So, we could very well do something similar for GIR_EXTRA_INCLUDE_PATH:

    diff --git a/package/gobject-introspection/g-ir-compiler.in b/package/gobject-introspection/g-ir-compiler.in
    index 712753023a..97a6d7333e 100644
    --- a/package/gobject-introspection/g-ir-compiler.in
    +++ b/package/gobject-introspection/g-ir-compiler.in
    @@ -1,3 +1,5 @@
    -#!/usr/bin/env sh
    +#!/usr/bin/env bash
    +
    +set $(printf ' --includedir=%s' ${GIR_EXTRA_INCLUDE_PATH//:/ }) "${@}"
     
     "$(dirname "$0")"/g-ir-scanner-qemuwrapper "$(dirname "$0")"/g-ir-compiler.real "$@"
    diff --git a/package/granite/granite.mk b/package/granite/granite.mk
    index 71dfbf4c03..8309d21414 100644
    --- a/package/granite/granite.mk
    +++ b/package/granite/granite.mk
    @@ -20,6 +20,8 @@ GRANITE_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)
    
     ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
     GRANITE_CONF_OPTS += -Dintrospection=true
    +GRANITE_CONF_ENV += GIR_EXTRA_INCLUDE_PATH=$(STAGING_DIR)/usr/share/gir-1.0
    +GRANITE_NINJA_ENV += GIR_EXTRA_INCLUDE_PATH=$(STAGING_DIR)/usr/share/gir-1.0
     GRANITE_DEPENDENCIES += gobject-introspection
     else
     GRANITE_CONF_OPTS += -Dintrospection=false

We could do the same for poppler, but it's better to use upstream's
mechanism, as they now have one. But for granite, if upstream can't find
a solution, and does not want to add a config option, we'll have to
resort to that...

[0] We currently have no package that sets GIR_EXTRA_LIBS_PATH, and
never had, but support is there...

Regards,
Yann E. MORIN.
diff mbox series

Patch

diff --git a/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
new file mode 100644
index 0000000000..079cf7234d
--- /dev/null
+++ b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
@@ -0,0 +1,43 @@ 
+From e9d5731ba254f35e2d94b628c51e48c50a945271 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Mon, 24 Jan 2022 09:28:20 +0100
+Subject: [PATCH] glib/CMakeLists.txt: allow the user to configure
+ INTROSPECTION_COMPILER_ARGS
+
+Allow the user to add its own parameters such as
+--includedir=$(STAGING_DIR)/usr/share/gir-1.0 to
+INTROSPECTION_COMPILER_ARGS to avoid the following build failure when
+cross-compiling with buildroot:
+
+[ 98%] Generating Poppler-0.18.typelib
+Could not find GIR file 'GObject-2.0.gir'; check XDG_DATA_DIRS or use --includedir
+error parsing file /home/giuliobenetti/autobuild/run/instance-1/output-1/build/poppler-21.12.0/glib/Poppler-0.18.gir: Failed to parse included gir GObject-2.0
+If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help.
+Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"
+
+Fixes:
+ - http://autobuild.buildroot.org/results/d2f50aa56410c2fff8a0538c57038104906e747e
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Retrieved from:
+https://gitlab.freedesktop.org/poppler/poppler/-/commit/e9d5731ba254f35e2d94b628c51e48c50a945271]
+---
+ glib/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
+index 7510e69ee..f5130e3c9 100644
+--- a/glib/CMakeLists.txt
++++ b/glib/CMakeLists.txt
+@@ -119,7 +119,7 @@ if (HAVE_INTROSPECTION AND BUILD_SHARED_LIBS)
+   # General gir: Reset object-list for introspection & load tool args
+   set(INTROSPECTION_GIRS)
+   set(INTROSPECTION_SCANNER_ARGS "--add-include-path=${CMAKE_CURRENT_SOURCE_DIR}" "--warn-all")
+-  set(INTROSPECTION_COMPILER_ARGS "--includedir=${CMAKE_CURRENT_SOURCE_DIR}")
++  set(INTROSPECTION_COMPILER_ARGS ${INTROSPECTION_COMPILER_ARGS} "--includedir=${CMAKE_CURRENT_SOURCE_DIR}")
+ 
+   # Poppler: Assign package to gir & export keys
+   set(Poppler_0_18_gir "poppler-glib")
+-- 
+GitLab
+
diff --git a/package/poppler/poppler.mk b/package/poppler/poppler.mk
index b54262e7c4..db6da25d39 100644
--- a/package/poppler/poppler.mk
+++ b/package/poppler/poppler.mk
@@ -47,7 +47,8 @@  POPPLER_DEPENDENCIES += gobject-introspection
 POPPLER_CONF_OPTS += \
 	-DENABLE_GOBJECT_INTROSPECTION=ON \
 	-DINTROSPECTION_SCANNER=$(STAGING_DIR)/usr/bin/g-ir-scanner \
-	-DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler
+	-DINTROSPECTION_COMPILER=$(STAGING_DIR)/usr/bin/g-ir-compiler \
+	-DINTROSPECTION_COMPILER_ARGS="--includedir=$(STAGING_DIR)/usr/share/gir-1.0"
 else
 POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=OFF
 endif