diff mbox series

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

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

Commit Message

Fabrice Fontaine Jan. 24, 2022, 9:34 p.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>
---
 ...txt-allow-the-user-to-configure-INTR.patch | 43 +++++++++++++++++++
 package/poppler/poppler.mk                    |  4 +-
 2 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch

Comments

Thomas Petazzoni Jan. 26, 2022, 10:05 p.m. UTC | #1
Hello Fabrice,

+Adam for GOI expertise.

On Mon, 24 Jan 2022 22:34:45 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> 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>
> ---
>  ...txt-allow-the-user-to-configure-INTR.patch | 43 +++++++++++++++++++
>  package/poppler/poppler.mk                    |  4 +-
>  2 files changed, 46 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..473966d7c9
> --- /dev/null
> +++ b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> @@ -0,0 +1,43 @@
> +From f9e5d423b0f765f2393a95c3299a2d827b9d3fb3 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>
> +[Upstream status:
> +https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1049]
> +---
> + glib/CMakeLists.txt | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
> +index 7510e69e..f5130e3c 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}")

Is this the right way of doing this? I see that glib-2.0.pc file has a
"girdir" variable (which you have added in
package/libglib2/0004-meson.build-add-girdir-to-gio-2.0.pc-and-glib-2.0.pc.patch
to fix build issues in atk or libnice). So it seems like atk and
libnice are automatically able to use these pkg-config files to find
out this gir directory.

Shouldn't poppler do the same ?

Thomas
Fabrice Fontaine Jan. 26, 2022, 10:22 p.m. UTC | #2
Hello,

Le mer. 26 janv. 2022 à 23:05, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a écrit :
>
> Hello Fabrice,
>
> +Adam for GOI expertise.
>
> On Mon, 24 Jan 2022 22:34:45 +0100
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>
> > 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>
> > ---
> >  ...txt-allow-the-user-to-configure-INTR.patch | 43 +++++++++++++++++++
> >  package/poppler/poppler.mk                    |  4 +-
> >  2 files changed, 46 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..473966d7c9
> > --- /dev/null
> > +++ b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
> > @@ -0,0 +1,43 @@
> > +From f9e5d423b0f765f2393a95c3299a2d827b9d3fb3 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>
> > +[Upstream status:
> > +https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1049]
> > +---
> > + glib/CMakeLists.txt | 2 +-
> > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
> > +index 7510e69e..f5130e3c 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}")
>
> Is this the right way of doing this? I see that glib-2.0.pc file has a
> "girdir" variable (which you have added in
> package/libglib2/0004-meson.build-add-girdir-to-gio-2.0.pc-and-glib-2.0.pc.patch
> to fix build issues in atk or libnice). So it seems like atk and
> libnice are automatically able to use these pkg-config files to find
> out this gir directory.
Indeed, this is true but atk and libnice are meson packages.
For autotools packages, commit
8dda79970661090f202e1f20e5982ba53fdaeb95 updated
Makefile.introspection.
>
> Shouldn't poppler do the same ?
poppler is a cmake-package and I thought that the suggested approach
is the simplest, less invasive and quickest approach. Upstream is also
ok for this patch.
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
Best Regards,

Fabrice
Thomas Petazzoni Jan. 26, 2022, 10:35 p.m. UTC | #3
On Wed, 26 Jan 2022 23:22:24 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Indeed, this is true but atk and libnice are meson packages.
> For autotools packages, commit
> 8dda79970661090f202e1f20e5982ba53fdaeb95 updated
> Makefile.introspection.

Correct, I also looked into these :-)

> poppler is a cmake-package and I thought that the suggested approach
> is the simplest, less invasive and quickest approach. Upstream is also
> ok for this patch.

Yeah, maybe it's the most pragmatic solution. It just feels annoying
that we have to teach "all" users of GOI where the GIR files are
located.

Thomas
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..473966d7c9
--- /dev/null
+++ b/package/poppler/0002-glib-CMakeLists.txt-allow-the-user-to-configure-INTR.patch
@@ -0,0 +1,43 @@ 
+From f9e5d423b0f765f2393a95c3299a2d827b9d3fb3 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>
+[Upstream status:
+https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1049]
+---
+ glib/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
+index 7510e69e..f5130e3c 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")
+-- 
+2.34.1
+
diff --git a/package/poppler/poppler.mk b/package/poppler/poppler.mk
index 9e9bfc9cba..7062923c6c 100644
--- a/package/poppler/poppler.mk
+++ b/package/poppler/poppler.mk
@@ -44,7 +44,9 @@  endif
 
 ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
 POPPLER_DEPENDENCIES += gobject-introspection
-POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=ON
+POPPLER_CONF_OPTS += \
+	-DENABLE_GOBJECT_INTROSPECTION=ON \
+	-DINTROSPECTION_COMPILER_ARGS="--includedir=$(STAGING_DIR)/usr/share/gir-1.0"
 else
 POPPLER_CONF_OPTS += -DENABLE_GOBJECT_INTROSPECTION=OFF
 endif