Skip to contentSkip to conversation

gstreamer1.0: install Gst-1.0.gir to ${libdir} for multilib

PATCH Hongxu Jia 3 participants 4 messages Dec 16, 2025 – Dec 17, 2025 1 message not in the archive

lore
Share & tools
lore

Hongxu Jia

author
#1 lore raw
In reply to a message not in the archive

Hi Ross,

Randy said you had concerns on this patch?

//Hongxu

Quoted 223 lines · hongxu via lists.openembedded.org

While installing 32 bit gstreamer package and 64 bit gstreamer package to
one rootfs, package management (dnf) reported a conflict failure
|Error: Transaction test error:
| file /usr/share/gir-1.0/Gst-1.0.gir conflicts between attempted installs of gstreamer1.0-dev-1.26.7-r0.wr2500.corei7_64 and lib32-gstreamer1.0-dev-1.26.7-r0.wr2500.corei7_32

Due to upstream commit [1], the size of padding differs between 32 bit arch and 64 bit arch
...

|typedef struct {
|  /* < private > */
|  gpointer pointer;
|#if GLIB_SIZEOF_VOID_P == 8
|  guint8 padding[8];
|#elif GLIB_SIZEOF_VOID_P == 4
|  guint8 padding[12];
|#else
|  #error "Only 32 bit and 64 bit pointers supported currently"
|#endif
|} GstIdStr;

...

It made the generated Gst-1.0.gir be different for 32 bit and 64 bit packages, Install Gst-1.0.gir to ${libdir} which splits 32 bit and 64 bit libraries

Submit a patch to upstream to add meson option (gir_dir_prefix) to override default gir install location (datadir). When multilib is enabled, install .gir files to ${libdir} other than ${datadir}

[1] https://gitlab.freedesktop.org/-/commit/0ee18781f9b210129da23a85236266bf84bafa83#f9880c83c8bdc4d61ac7d51a4a212f602cad5d86_0_39

---
  ...ir_prefix-option-to-override-gir-def.patch | 149 ++++++++++++++++++
  .../gstreamer/gstreamer1.0_1.26.7.bb          |   3 +
  2 files changed, 152 insertions(+)

create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0/0001-meson-Add-gir_dir_prefix-option-to-override-gir-def.patch

meta/recipes-multimedia/gstreamer/gstreamer1.0/0001-meson-Add-gir_dir_prefix-option-to-override-gir-def.patch new file +149 -0
new file mode 100644
index 0000000000..506e33c61f
@@ -0,0 +1,149 @@
+From 6fb2149fc5c7b1805c138a52990305a4f53170fa Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <[email protected]>
+Date: Thu, 11 Dec 2025 18:38:24 -0800
+Subject: [PATCH] meson: Add gir_dir_prefix option to override gir default
+ location
+
+Originally, the .gir files would always get installed into the default
+location (datadir).
+
+This commit adds meson option (gir_dir_prefix) to override it as intermediate
+prefix for gir installation under ${prefix}, such as
+
+  $ meson setup -Dgir_dir_prefix=lib64
+
+The .gir files are installed to /usr/lib64/gir-1.0
+
+  Installing gst/Gst-1.0.gir to /usr/lib64/gir-1.0
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/10363]
+
+Signed-off-by: Hongxu Jia <[email protected]>
+---
+ gst/meson.build                 |  1 +
+ libs/gst/base/meson.build       |  1 +
+ libs/gst/check/meson.build      |  1 +
+ libs/gst/controller/meson.build |  1 +
+ libs/gst/net/meson.build        |  1 +
+ meson.build                     | 23 ++++++++++++++++++++++-
+ meson_options.txt               |  3 +++
+ 7 files changed, 30 insertions(+), 1 deletion(-)
+
+diff --git a/gst/meson.build b/gst/meson.build
+index c69a6dc..ebe673d 100644
+--- a/gst/meson.build
++++ b/gst/meson.build
+@@ -322,6 +322,7 @@ if build_gir
+     'export_packages' : pkg_name,
+     'includes' : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0' ],
+     'install' : true,
++    'install_dir_gir': gst_girdir,
+     'extra_args' : gst_gir_extra_args,
+   }
+   library_def += {'gir': [gir]}
+diff --git a/libs/gst/base/meson.build b/libs/gst/base/meson.build
+index b7aca73..2fb0590 100644
+--- a/libs/gst/base/meson.build
++++ b/libs/gst/base/meson.build
+@@ -89,6 +89,7 @@ if build_gir
+     'include_directories' : [configinc, libsinc, privinc],
+     'includes' : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0', 'Gst-1.0'],
+     'install' : true,
++    'install_dir_gir': gst_girdir,
+     'extra_args' : gst_gir_extra_args,
+   }
+
+diff --git a/libs/gst/check/meson.build b/libs/gst/check/meson.build
+index 679a15d..e934526 100644
+--- a/libs/gst/check/meson.build
++++ b/libs/gst/check/meson.build
+@@ -86,6 +86,7 @@ if build_gir
+     'include_directories' : [configinc, libsinc, privinc],
+     'includes' : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0', 'Gst-1.0'],
+     'install' : true,
++    'install_dir_gir': gst_girdir,
+     'extra_args' : gst_gir_extra_args,
+   }
+   library_def += {'gir': [gir]}
+diff --git a/libs/gst/controller/meson.build b/libs/gst/controller/meson.build
+index 9d38af8..411b951 100644
+--- a/libs/gst/controller/meson.build
++++ b/libs/gst/controller/meson.build
+@@ -81,6 +81,7 @@ if build_gir
+     'include_directories' : [configinc, libsinc, privinc],
+     'includes' : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0', 'Gst-1.0'],
+     'install' : true,
++    'install_dir_gir': gst_girdir,
+     'extra_args' : gst_gir_extra_args,
+   }
+   library_def += {'gir': [gir]}
+diff --git a/libs/gst/net/meson.build b/libs/gst/net/meson.build
+index 60ed92c..b81139e 100644
+--- a/libs/gst/net/meson.build
++++ b/libs/gst/net/meson.build
+@@ -67,6 +67,7 @@ if build_gir
+     'include_directories' : [configinc, libsinc],
+     'includes' : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0', 'Gio-2.0', 'Gst-1.0'],
+     'install' : true,
++    'install_dir_gir': gst_girdir,
+     'extra_args' : gst_gir_extra_args,
+   }
+   library_def += {'gir': [gir]}
+diff --git a/meson.build b/meson.build
+index e2127f6..7ecfc2d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -629,6 +629,27 @@ if static_build
+   gst_c_args += ['-DGST_STATIC_COMPILATION']
+ endif
+
++gir_dir_prefix = get_option('gir_dir_prefix')
++if gir_dir_prefix == '' or gir_dir_prefix == get_option('datadir')
++  gir_dir_prefix = get_option('datadir')
++  gir_dir_pc_prefix = '${datadir}'
++else
++  gir_dir_pc_prefix = '${prefix}' / gir_dir_prefix
++endif
++
++# This is effectively the GIR XML format major version
++gir_suffix = 'gir-1.0'
++
++gst_girdir = prefix / gir_dir_prefix / gir_suffix
++
++
++if build_gir
++  gst_c_args += [
++    '-DGIR_SUFFIX="@0@"'.format(gir_suffix),
++    '-DGIR_DIR="@0@"'.format(gst_girdir),
++  ]
++endif
++
+ # Used in gst/parse/meson.build and below
+ python3 = import('python').find_installation()
+
+@@ -680,7 +701,7 @@ pkgconfig_variables = [
+   'exec_prefix=${prefix}',
+   'toolsdir=${exec_prefix}/bin',
+   'pluginsdir=${libdir}/gstreamer-1.0',
+-  'girdir=${datadir}/gir-1.0',
++  'girdir=' + gir_dir_pc_prefix / gir_suffix,
+   'typelibdir=${libdir}/girepository-1.0',
+   'pluginscannerdir=${libexecdir}/gstreamer-1.0'
+ ]
+diff --git a/meson_options.txt b/meson_options.txt
+index 78af552..97c03c6 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -32,6 +32,9 @@ option('examples', type : 'feature', value : 'auto', yield : true)
+ option('tests', type : 'feature', value : 'auto', yield : true)
+ option('benchmarks', type : 'feature', value : 'auto', yield : true)
+ option('tools', type : 'feature', value : 'auto', yield : true)
++option('gir_dir_prefix',
++       type: 'string',
++       description: 'Intermediate prefix for gir installation under ${prefix}')
+ option('introspection', type : 'feature', value : 'auto', yield : true, description : 'Generate gobject-introspection bindings')
+ option('nls', type : 'feature', value : 'auto', yield: true, description : 'Enable native language support (translations)')
+ option('extra-checks', type : 'feature', value : 'enabled', yield : true, description : 'Enable extra runtime checks')
+--
+2.34.1
+
meta/recipes-multimedia/gstreamer/gstreamer1.0_1.26.7.bb +3 -1
index 444165a869..88b1af0796 100644
@@ -21,6 +21,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.x
             file://0002-tests-add-support-for-install-the-tests.patch \
             file://0003-tests-use-a-dictionaries-for-environment.patch \
             file://0004-tests-add-helper-script-to-run-the-installed_tests.patch \
+           file://0001-meson-Add-gir_dir_prefix-option-to-override-gir-def.patch \
             "
  SRC_URI[sha256sum] = "18a5e214114dc501407697dd458514bba62cadd5414c60f793cf70141a4d0bb3"
 
@@ -56,6 +57,8 @@ EXTRA_OEMESON += " \
      ${@gettext_oemeson(d)} \
  "
 
+EXTRA_OEMESON:append:class-target = " ${@'-Dgir_dir_prefix=${baselib}' if d.getVar('MULTILIBS') else ''}"
+
  GIR_MESON_ENABLE_FLAG = "enabled"
  GIR_MESON_DISABLE_FLAG = "disabled"
 
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#227590): https://lists.openembedded.org/g/openembedded-core/message/227590
Mute This Topic: https://lists.openembedded.org/mt/116745751/3617049
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 9 lines · hongxu via lists.openembedded.org
Quoted 8 lines · hongxu via lists.openembedded.org

While installing 32 bit gstreamer package and 64 bit gstreamer package to
one rootfs, package management (dnf) reported a conflict failure
|Error: Transaction test error:
| file /usr/share/gir-1.0/Gst-1.0.gir conflicts between attempted installs of gstreamer1.0-dev-1.26.7-r0.wr2500.corei7_64 and lib32-gstreamer1.0-dev-1.26.7-r0.wr2500.corei7_32

Due to upstream commit [1], the size of padding differs between 32 bit arch and 64 bit arch

The commit doesn’t exist anymore so that URL is 404, https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/0ee18781f9b210129da23a85236266bf84bafa83 is a working link.

This is a bit of a complex problem and just mv'ing the file isn’t all of it. It would be easier to just mv it in a do_install:append() considering upstream doesn’t seem interested. But the bigger problem is how does this interact with the rest of the G-I ecosystem? Is our G-I configured to search that location? What about PyGObject?

Absolutely worth referencing https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/323 where the core issue in G-I is fixed, by adding support for GI_GIR_PATH. So if we’re going to move .gir files around, that needs to be updated too.

Also, does this _actually_ work? Do we have on-target multi-arch g-ir-compilers so you can have a 64-bit rootfs with a 32-bit g-ir-compiler that does the right thing? Bandaiding a solution that breaks other users, and doesn’t actually do anything useful, isn’t a solution.

Ross

author
#3 lore raw
Quoted 11 lines · Ross Burton

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 7 lines · hongxu via lists.openembedded.org
Quoted 6 lines · hongxu via lists.openembedded.org

While installing 32 bit gstreamer package and 64 bit gstreamer package to
one rootfs, package management (dnf) reported a conflict failure
|Error: Transaction test error:
| file /usr/share/gir-1.0/Gst-1.0.gir conflicts between attempted installs of gstreamer1.0-dev-1.26.7-r0.wr2500.corei7_64 and lib32-gstreamer1.0-dev-1.26.7-r0.wr2500.corei7_32

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

Due to upstream commit [1], the size of padding differs between 32 bit arch and 64 bit arch

The commit doesn’t exist anymore so that URL is 404, https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/0ee18781f9b210129da23a85236266bf84bafa83 is a working link.

OK, I will update the link

Quoted 1 line

This is a bit of a complex problem and just mv'ing the file isn’t all of it. It would be easier to just mv it in a do_install:append() considering upstream doesn’t seem interested. But the bigger problem is how does this interact with the rest of the G-I ecosystem? Is our G-I configured to search that location? What about PyGObject?

This patch reference glib [1][2][3], the meson option gir_dir_prefix: 'Intermediate prefix for gir installation under ${prefix}'

[1] https://gitlab.gnome.org/GNOME/glib/-/blob/main/girepository/meson.build?ref_type=heads#L24

and correctly install .gir files into custom locations [2]

[2] https://gitlab.gnome.org/GNOME/glib/-/commit/22ec5a96e3d7b1e17a4b0c31e00089ed17a12050

Quoted 1 line

Absolutely worth referencing https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/323 where the core issue in G-I is fixed, by adding support for GI_GIR_PATH. So if we’re going to move .gir files around, that needs to be updated too.

and compile with option -DGIR_DIR= [3] for C

[3] https://gitlab.gnome.org/GNOME/glib/-/blob/main/girepository/meson.build?ref_type=heads#L88

Quoted 2 lines

Also, does this _actually_ work? Do we have on-target multi-arch g-ir-compilers so you can have a 64-bit rootfs with a 32-bit g-ir-compiler that does the right thing? Bandaiding a solution that breaks other users, and doesn’t actually do anything useful, isn’t a solution.

I did not test it actually, yes, you are right, I will send v3 if runtime test passed, otherwise just use original v1 [ gstreamer1.0: add mulitlib scripts Gst-1.0.gir], treat as a multilib script

Alex, what is your option?

//Hongxu

Quoted 1 line

Ross

#4 lore raw
Quoted 1 line · hongxu via lists.openembedded.org

Alex, what is your option?

I kinda don't know what to say with certainty.

First, https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/10363
lacks important information for the upstream. It adds a meson option but doesn't explain why. You need to explain this:
=====
Due to upstream commit [1], the size of padding differs between 32 bit

Quoted 13 lines

arch and 64 bit arch
...

|typedef struct {
|  /* < private > */
|  gpointer pointer;
|#if GLIB_SIZEOF_VOID_P == 8
|  guint8 padding[8];
|#elif GLIB_SIZEOF_VOID_P == 4
|  guint8 padding[12];
|#else
|  #error "Only 32 bit and 64 bit pointers supported currently"
|#endif
|} GstIdStr;
Quoted 5 lines

...

It made the generated Gst-1.0.gir be different for 32 bit and 64 bit packages, Install Gst-1.0.gir to ${libdir} which splits 32 bit and 64 bit libraries

=====
so that gstreamer folks can see the actual issue, and not just the proposed solution. You should also reference
https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/323 to confirm for them that g-i upstream is aware of the problem, and (selectively) installing to libdir (and fixing tools to look there) is how they're dealing with it.

Second, on my Debian system I indeed see /usr/lib/x86_64-linux-gnu/gir-1.0/GLib-2.0.gir (but everything else remains in /usr/share), so presumably they managed to make it work (some details are in the ticket Ross mentioned:
https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/323#note_2118013).
Yet oe-core's glib recipe still installs to /usr/share/gir-1.0.

From reading that ticket I'd say the precedent is set, g-i/glib/gnome upstream has accepted that multiarch sytems are valid, and libdir is a viable location, and it's fair to do the same in gstreamer. g-i itself is fixed to support that, and the rest of the ecosystem is mostly fixed. But we still need to devise a test for this before we start moving files around.

Alternatively, if you just need to get rid of the do_rootfs error, and do not have any actual use for these .gir files, all of the above is way overkill, and you can just delete one of the files (or both) in a bbappend.

Alex